Build 310 brings new, extended features for XML localization. Below is a short description of the main improvements for XML localization available in build 310.
Improved Localize attribute functionality
With previous builds you could set upÂ trigger values for disabling selected items from localization by adding Localize attribute for these values. With build 310 this feature was completely rebuilt. For example you can now use positive values for enabling selected items to localization, or localize only items with positive values of localize attribute. You can set up behavior of this functionality in “Options” tab of XML source properties dialog.
Here you can configure the following settings
- Enable values field (new in build 310) – here you can type triggers for enablingÂ items to localization. By default Sisulizer use “1”, “true” and “yes” values, but of course you can type here any value. Type values should be separated by semicolons. When you type the same value in”Enabled values” and “Disable values”, Sisulizer uses this value only as disable value.
- Disable values field – here you can type triggers for disabling items from localization. By default Sisulizer use “0”, “false” and “no” values, but of course you can type here any value. Type values should be separated by semicolons. When you type the same value in”Enabled values” and “Disable values”, Sisulizer uses this value only as disable value.
- Localize only those elements that have enabled localize attribute checkbox (new in build 310) – when you check this option, Sisulizer automatically disables all items without enabled localize attributeÂ from localization (attribute with values from “Enable values” field). It could be very useful if you want localize only a few items in a huge XML file.
Below I want to show how it works on this XML sample:
- When you have unchecked “Localize only those elements that have enabled localize attribute”, Sisulizer disables from localization “Do not localize this” string, because this item has localize attribute with disable value, while “Localize this” (with positive value of localize attribute) and “Standard string” (without localize attribute) are enabled to localization.
- When you have checked “Localize only those elements that have enabled localize attribute”, Sisulizer disables from localization both “Do not localize this” string, because this item has localize attribute with disable value, and “Standard string” because this item hasn’t localize attribute and to localization is enabled only “Localize this” item with positive value of localize attribute.
You can assign localize attribute to selected item from your XML file by selecting “Localize value” item in contetxt menu of tag/attribute itemÂ in tags tree. Tga tree is available via “Tags” tab of XML source properties. Sisulizer can automatically assign “Localize value” for items with attribute names identical with names typed in “Tools” menu ->”Platforms” -> “XML” -> “Localize attributes”. Here you can also disable automatic detection of those items. You can read more about it in this article on our blog.
Localization of XML with included original – translation items pairs
From build 310 you can localize with Sisulizer bilingual files which contains both translations and original items. If you localize such file Sisulize should automatically import translation values to project. However, it requires some preparations in Sisulizer Project Wizard or later in XML source properties of your Sisulizer project. Below is example of XML code with original and translation values:
When we create new Sisulizer project for above file, we should set up context, context and original and translation values. You can do it via item’s context menu in tag tree. Of course, after changes in tag tree (for already existing projects) you need to re-scan the project.
When you set selected element as “Original value”, you should see small padlock icon on this item in tag tree. Notice, when you select misappropriated elements as context value, Sisulizer won’t import translations from source file.
XML specification has a xml:lang attribute that specifies the language of the element. For example in below sample values “xml:lang” tells that text in the data element is written in English.
<data xml:lang=”en”>This is a sample</data>
If XML file contains “xml:lang” attributes Sisulizer automatically changes the value in the localized files and our example in Finnish output file should look like this:
<data xml:lang=”fi”>This is a sample</data>
Starting from the build 310 there is a new option that specifies if Sisulizer should add “xml:lang” attributes. You can select the following settings for this option:
- No – This is default setting and Sisulizer does not add any “xml:lang” attribute, but it translates if it already exists.
- Root element – Sisulizer adds language attribute into the root element only.
- Localized elements -Â Sisulizer adds language attribute into each element that is marked as translatable.
This new option is available in “Options” tab of XML source properties.
Build 310 also contains a feature where you can set any attribute to be a language attribute. So you can use any attribute beside or instead “xml:lang” attribute. For doing it you should open XML properties, go to “Tags” tab, select appropriated element in tag tree. Next right click on this element and select “Language attribute” from context menu. This makes Sisulizer to set the attribute value in the localized files to match the target lanugage.
Sisulizer can automatically assign â€œLanguage valueâ€ for items with attribute names identical with names typed in â€œToolsâ€ menu ->â€Platformsâ€ -> â€œXMLâ€ -> â€œLanguage attributesâ€. Here you can also disable automatic detection of those items.
- More about XML localization you can find in this article of our blog
- Items visible in context menu for selected element of tag tree depends on source structure and position of selected element in this structure. So, not for all elements you will see “Language value” or “Original value” in context menu.
- XML samples from this article are based on sample XML and Sisulizer project files from XML directory installed with Sisulizer to installation directory on Windows XP and Sisulizer user directory on Vista/Windows 7. I recommend review those files and experiment both with code of XML files and tags settings in appropriated Sisulizer projects included to this directory.