A common issue when working with multi-language websites is handling translations of basic elements such as labels, buttons, etc.
In Dynamicweb this is handled by using the Translate()-method inside a template to create translation keys, and then using the Translations interface in the backend to translate the keys to other languages.
Once the first translation key is created on your solution, a translations.xml file is created in the Templates/Designs/YourDesign folder.
Translations.xml files may be moved freely from one design to another, if necessary, or to Templates/Designs for shared (global) translations.
Translating keys can be done in two ways:
- From each language layer
- From the Settings > Item types > Translations interface
The first way is well suited to solutions where language layer translations are maintained by a dedicated translator, whereas the second way is well suited for getting an overview of the translation status on the entire solution.
Translating keys for one language layer
If you work with dedicated translators, it is much easier for them to work with one language layer only when translating, rather than go through the settings (which they may not have access to either).
To translate keys for only one language layer:
- Switch to the language layer using the website selector
- Right-click the website selector and click translations (Figure 3.1)
This opens the translation interface for that language layer (Figure 3.2).
From the translation interface, you can:
- View the translation key in the left column - any default translation values are shown below
- View and edit the translation (if any) in the middle column
- See the scope of the translation key in the right column (here the scope is the design called Condition).
The translations overview
From the Settings area, you can get an overview of all the keys and translations on your solution.
To open the translations overview:
- Go to Settings > Translations
- Click on either Shared or one of your designs to open the relevant translations overview (Figure 4.1)
From the translations interface, you can view all keys and the translation status for each regional setting (language) on the solution (here French, US English, Danish & UK English). You can also search for translation keys using the search field in the toolbar.
A checkmark on the grid means that the key is translated into that language – but not, of course, that it is correct.
Clicking any key will open the translation key edit view (Figure 4.2)
From the translation key view, you can:
- Rename the key
- Set a default translation value
- View, delete or enter a translation of the key for each website language on the solution
By clicking the Shared node under Settings > Translations you can create and manage translations and keys created in the Templates/Designs/Translations.xml file.
Shared translations are created and managed in exactly the same way as design-specific translations, but are available from all designs, provided that the same key is not also present in the design-specific translations.xml file.
In other words:
- All translations in the translation.xml in the /Templates/Designs/DesignName/translation.xml file AND /Templates/Designs/translation.xml are available
- If the same key exists in both places, the key in /Templates/Designs/DesignName/translation.xml will be used
Adding translation keys manually
You can add translation keys (and translations) manually from both the language layer translation interface and the translations overview for the entire solution.
To add a translation key manually, click the Add translation key button to open an empty translation key edit view (Figure 6.1).
From the translation key edit view, you must:
- Name the key
- Set a default translation value (optional)
- Provide one or more language specific translation values for the key
Once created, the translation key can be used in all templates employed by the current design.