Hide

YetaWF Documentation

Display
Print

National Language Support

YetaWF is prepared to support multiple languages easily. The same page can be designed to support multiple site-defined languages. Depending on the current language selection by a visiting user, the page is rendered in the selected language.

Page settings are entered for each language. For example the page title and description are entered in each language, selectable using the language dropdown list next to or below the page title and description. This multi-language data is supported by YetaWF's built-in type MultiString (YetaWF.Core.Views.Shared.MultiString).

The following shows the Page Settings with the dropdown lists used to select the language.

Language Selection

Some modules, like the Text Module, can be used to provide language dependent content. While editing the module and module settings, use the Site Language dropdown list to select in which language to edit. The dropdown list to select the site's default language is located in the upper center of the page.

Language Selection

Fallback Language

YetaWF currently doesn't provide any languages other than the provided US English text. This may change over time. If multiple languages are defined in your site, US English is used as the default language for any data that is not provided when another language is selected.

Defining Languages

Languages are defined using the LanguageSettings.json file. See the YetaWF.Languages Package for more information.

Built-In Strings

Forms and all strings embedded in YetaWF source code can be translated without changing the program source code. This is done using the Localization Resources Module, part of the YetaWF.Languages Package, and its localization services.

Localization resources are extracted directly from the source code when the Localize All Packages action is selected in Admin > Panel > Packages (see image below). Whenever any source code is updated, the Localize All Packages action must be used to update the localization resources. This is a manual step that must be done when developing modules.

The Localization Resources Module displays and manages localization resources for a package. It is used by the YetaWF.Packages Package to offer access to localization services. This module allows access to all localizable resources of a package, such as strings used in views and in code.

Using Admin > Panel > Packages, click on the Edit Localization Resources icon next to the package name you want to edit. Make sure you have selected the appropriate language using the Site Language dropdown list to select which language to edit.

Packages - Localization Resources

This will display all available localization resources for selected package.

Localization Resources

The resources shown match the class names within the package that implement any kind of strings that can be displayed to the end user. Click the Edit icon next to the class name to edit the strings within that class.

Localization Resources

All classes, properties, enums, strings can be updated. These are saved and cached for one site within your YetaWF instance and apply to the current site only. This means each site hosted within your YetaWF instance can use different localization resources, even for the same language.

Localization Resources Location

Installed Localization Resources

Installed localization resources are part of the package and are distributed with the package. These should never be modified directly (unless you are the developer/publisher of the package).

The default localization resources (always in en-US) are provided with each package in the Addons folder.

The general location (for US-English, the default language) is

./Website/AddOns/company/product/_Main/Localization

where company is the domain of the company publishing the package product.

For example, all localization resources for the YetaWF.Text Package are located at

./Website/AddOns/YetaWF/Text/_Main/Localization

The location for non US-English (i.e., other languages) is

./Website/AddOns/company/product/_Main/Localization/languageId

where company is the domain of the company publishing the package product. languageId is the language id as defined in LanguageSettings.json.

For example, all German localization resources for the YetaWF.Text Package are located at

./Website/AddOns/YetaWF/Text/_Main/Localization/de-DE

Custom Localization Resources

Any customizations made by editing the file or by editing the localization resources using Admin > Panel > Packages are saved in the AddOnsCustom folder (never in the AddOns folder).

The general location is

./Website/AddOnsCustom/company/product/_Main/Localization/languageId

where languageId represents the language id as defined in LanguageSettings.json.

For example, all customized localization resources for the YetaWF.Text Package are located at

./Website/AddOnsCustom/YetaWF/Text/_Main/Localization/en-US

Localization resources are saved as Xml files. While not the most efficient file format, it can be edited by users, is easily understood and can easily be used by third-party tools. All localization resources are cached so most resources are read once only.

Translating Localization Resources

Publishers of packages can localize their packages into multiple languages by providing language-specific localization resources (see Installed Localization Resources above).

Translating packages can be a tedious process, so YetaWF offers automatic translation of packages into various languages. The translation itself is performed by Google Translate or Microsoft Translator.

In order to use automatic translation, enable your preferred translation service using Admin > Settings > Localization Settings. The Google Translate or Microsoft Translator services require you to set up account. You can choose which service you want to use. In either case, these translation services are not free.

Once enabled, use Admin > Panel > Packages, then click on the Edit Localization Resources icon next to the package name you want to edit.

Make sure you have selected the appropriate language using the Site Language dropdown list to select which language to edit.

On the Localization Resources page for a specific package, the actions Create Localization Resources (Custom) and Create Localization Resources (Installed) will be available. With these actions the default US-English localization resources for this package will be translated to the currently selected language. If you are translating your own package (for distribution), use "Installed". If you are translating someone else's package for customization purposes, use "Custom".

Packages - Localization Resources

The translated text provided by Google Translate or Microsoft Translator is not directly usable. The translations require (a lot) of manual changes, but they do provide a tremendous head start, compared to translating everything manually.