Loading

Español  English

Blog

By Enrique González

Translating a very long language file quickly

If you install Joomla in a non-English language very often, you usually need to translate a lot of modules or components from English to your language. For translating it, you need to translate a language file, a text file where all the language strings are located. These strings use this syntax:

RS1_INPUT_SCRN_CANCEL_CODE_INVALID=Cancel Code not found, Please re-enter

So it is like CONSTANT=STRING. For translating purpouses, we need to create a document that only has the "STRING" part. How to get this if the language file has tons of lines? We are going to use an advanced text editor (BBEdit, Ultraedit, etc...) and Excel. First, we load the language file in the advanced editor. Now with the help of a Regex search, we will remove the "CONSTANT=" part of each line. Use the "Search and replace" dialog, and a Regex expression:

^(.*?)(=)

This expression will select all the characters of a line until an equal sign is found. So use this expression and replace with (nothing). With this tip, we will get the "STRING" part of the language file. Ok, save it in a new document and give it to your translator. Very important: The number of lines can't change, say it to your translator,he must not delete any blank line or add new lines. Once the document is translate, we must join it again with the "CONSTANT=" part that we deleted earlier. Open the advanced editor with the original language file. Now we are going to delete the "STRING" part and preserve the "CONSTANT" part. To do this, we will use another Regex expression:

(=)(.*)$

So use this expression and replace with (nothing). Now select all CONSTANTS, open Excel, and paste them in the first column of the Excel document. In the second column, first cell, write "=" and extend it across the column. Now open the translated STRING document, select all the lines and paste them in the third column of the Excel document. Watch that the three columns must have the same number of cells. That's it. Now export the Excel document to TXT or CSV (text file) and we have the language file translated.

  • Date03-05-2010
  • 0

    comments

  • +

    Leave a comment