Text Files LocalizationOne feature of Localtransformer is Text Files Localization. Localtransformer provides a flexible and powerful way to localize text files based on custom rule definitions. The structure of Text Files can vary very much , therefore in order to localize Text Files it is necessary to define rules for the parsing of such files.
In the "New Project" screen press the "Project Options" button , or select "Project Options" in the Project menu. There select the "Text" options. Select a rule definition from the combobox or create a new one by pressing the plus sign button.
In order to create a new rule definition you have to specify rules. There are four types of rules : Text,Comments,Ignore and Key. In order to specify a new rule it is necessary to specify the regular expression that is before the text starts and the regular expression that is after the text ends. A Text Type Rule is related to the text that will be extracted in order to be localized. A Comments Type Rule is related to the comments of the text of a Text Rule. An Ignore Type Rule is related to the text that will be ignored and not extracted. Finally a Key Type Rule is related to the Key of a Text Type Rule.
After specifying the rules it is possible to view a preview of the parsing.
If , for example, the contents of the text file are :
id=1000;name=DS 150 Mobile Phone;description=Popular mobile phone with 5 mega pixels camera , GPRS and Java;comment=ID#1000;
id=1001;name=SGM 2000 Mobile Phone;description=The latest 3G mobile phone from SGM;comment=ID#1001;
id=1003;name=PhonST Mobile Phone;description=New mobile phone very light and ultra thin;comment=ID#1003;
The id of a text item in such a file starts with the "id=" string and ends with a ";" character. Therefore, we specify a Key Type Rule with starts with "id=" and ends with ";". Afterwards, we specify a Text Type Rule that starts with "name=" and ends with ";" in order to extract the name of the product. Moreover, we specify another Text Type Rule in order to extract the description of the product by specifying that it starts with "description=" and ends with ";". In addition, we specify a Comments Type Rule for the first text item (name of the product) by specifying that it starts with "comment=" and ends with ";". In the end, we edit the Key Type Rule and set that it should be for the first Text Type Rule.
For more information regarding Regular Expressions consult the following website: