Fallback Translations |
Fallback is a mechanism that finds an alternative translation if a specific translation does not exist. Let's have an example.
Original English string (en) | German (de) | Swiss German (de-CH) |
---|---|---|
Hello | Guten Tag | Grüezi |
One | Eins | |
Minute |
Translations that are used after fallback.
Original English string (en) | German (de) | Swiss German (de-CH) |
---|---|---|
Hello | Guten Tag | Grüezi |
One | Eins | Eins |
Minute | Minute | Minute |
We have three strings: "Hello", "One" and "Minute". For German, we have translations for two. However, for Swiss German, we have only one. For "Hello," there is no need for fallback because all languages have translations. However, "One" does not have a Swiss German translation, and we need to use fallback to find an alternative one. Swiss German (de-CH) is a child language of neutral German (de), so fallback will first look if that has a translation. In the case of "One," there is, and "Eins" will be used. However, for "Minute," there is no German translation either, so the original value "Minute" will be used for both German and Swiss German.
By default, the ultimate fallback is the original language. Sometimes you want to fall back to some other language but original. Let's have another sample. Now the original language is Finnish instead of English. However, we have English as one of the target languages. This makes it possible to fall back to English even it is not the original language.
Original Finnish string (fi) | English (en) | German (de) | Swiss German (de-CH) |
---|---|---|---|
moi | Hello | Guten Tag | Grüezi |
yksi | One | Eins | |
minuutti | Minute |
Translations that are used after fallback.
Original Finnish string (fi) | English (en) | German (de) | Swiss German (de-CH) |
---|---|---|---|
moi | Hello | Guten Tag | Grüezi |
yksi | One | Eins | Eins |
minuutti | Minute | Minute | Minute |
To fall back to some other but original, you need to either set the relative language in the language properties or the default language in the project properties.
Let's first look at the relative language. Each language can have a relative language. If you set it, then the build process falls back to the relative language if the current language or its parent has no translation. You can set the relative language by right-clicking a language column and choosing Properties. The following image shows the language properties of Estonian. Because Finnish is a relative language to Estonian, you could set Finnish to be a relative language. When building if there is no Estonian translation, a Finnish translation is used if it exists.
In addition, you can use the default language. Unlike relative language that is a property of a specific language, default language is a single common property of the project. You can set it by setting the Default language value in the Output sheet.
Below the default language, there is the Use language fallback checkbox. Check this if you want that Soluling uses fallback when creating localized files. Note that some platforms such as Java's properties file have a runtime fallback, so there is no need to use a fallback in Soluling on the build process. In such cases, the default value of the checkbox is unchecked, and you should keep it that way.
The complete chain of a translation search order is
Translation | Notes |
---|---|
Use the translation | |
Use the translation of the parent language | This is only used if the build language is a country-specific language such as en-US. |
Use the translation of the relative language | This is only used if you have set the relative language in the language properties dialog. |
Use the translation of the default language | This is only used if you have set the default language in the output configuration sheet. |
Use the original value | This is guaranteed to exist, and this is used if no translation were found during the above steps. |