Using multiple languages is a comprehensive topic, which we will try to cover in this chapter.
AxCMS.net does not use resource files (.resx) to save language-dependent resources. Proprietary AxLanguage technology is used instead, which allows developer to use natural language during programming and not caring about resource IDs. It is still possible to translate all the strings, used in an application, into other languages and decide on a target language at runtime.
First we describe how to use AxLanguage to switch the user interface language of AxCMS.net itself. Then we will explain, how to take advantage of AxLanguage in your customer projects.
Using multiple languages for AxCMS.net GUI
As for the time of this writing AxCMS.net GUI is available in German and English. Possibly new languages will be added by Axinom in the future. After successful installation of Sample or PremiumSample with AxCMS.net 7.0 you will have the latest language pack installed.
You will find language tables in your CMS-database: CMS_AX, CMS_DE and CMS_EN. These tables contain the language resources. AX is the default table, containing the texts, which were used during development, DE - German translation, EN - English translation, etc. AxCMS.net loads all the configured language-tables during startup and saves them in a cache.
To configure AxCMS.net to use these tables it is necessary to define a ResourceManager in web.config:
And the section itself:
DefaultLanguage is the language used in code of the application (it this case - AxCMS.net). It is "ax" and you cannot change it. It is NOT the target language, used if a user hasn't set his language explicitly.
Languages is a comma-separated list of the supported languages. For each language code a CMS_[language] table must exist. You cannot extend the list to the languages, where no translation is available, but you can reduce the list, excluding the languages you don't need. E.g. if you don't have german users, you can exclude "de" from the list. You save some memory space through it. The order of the languages does not matter, except the first language - it is the default target language, which is used, if no desired language is specified by user. Please always include the default language ("ax") into the list.
InsertLanguage defines, if a new record should be inserted into default language table, if a term is not found there. Always set to "false"; to get better translations, check the Axinom web-site for LanguagePack updates periodically.
IsEditable defines, if your editors should be able to edit translations through the CMS-GUI. For CMS itself set it to false; to get better translations, check the Axinom web-site for LanguagePack updates periodically. Only set it to true for the code, you control yourself (see below ?).
Notification defines, if an exception should be published in case a new term without translation was added to the default language table. If InsertLanguage=false, the value of Notification does not matter. Set it to false.
CheckDefaultLanguage defines, if a lookup in the translation tables should be made even if the target language is the same as the default language. On one hand, you only want to set CheckDefaultLanguage to true, if you have InsertLanguage=true. Translation result does not depend on it. On the other hand, for CMS, it is impossible, that someone sets "ax" as a target language. Please set CheckDefaultLanguage to false.
Table configures the prefix for all the language tables for this resource manager. Set to "CMS" for CMS-translations.
Define your own ResourceManager for your template translation
Read here for more...