Localization
The core SanteDB applets are designed to easily be localized and branded to suit your particular deployment of SanteDB.
Localizing Your Applets
When writing your applets, there are a variety of ways to make localization and branding of your applet easier. First, in all HTML assets you can use the i18n service in Angular to localize your asset.
It is recommended you use the manifest file and i18n service as SanteDB will pre-translate the file before sending it to the browser and will cache the result. This reduces the amount of processing power required for repeat viewing of the page.
You should then register my.ui.local.string in the applet's manifest file.
If you want to fetch a string from JavaScript in the current locale, you can use the localization service
Switch Locales
By default, SanteDB will switch the current locale of the user interface to that preferred by the user when they authenticate. You can also manually set the locale by calling
When you call this, a cookie is set in the browser which controls the rendering on the server side. However, this is the lowest order of preference for the server. In short, the server will render assets using the following preference:
The user's preference (stored at :
UserEntity.languageCommunication
) is used, if the user has no preference then,The
lang
cookie provided by the browser, if there is no setting thenThe value of
Accept-Language
HTTP header sent by the browser, if not sent thenThe configured server preference (set in the SanteDB.config.xml file)
Registering New Locales
Locales are registered using the applet manifest.xml
, within the manifest, you can specify one or more assets (css, javascript, etc.) to be loaded for the particular locale. For example, to define a localization for Esperanto:
This instructs the SanteDB application framework to register a new locale "EO" and load the two supplied assets whenever the user interface is switched to locale eo.
Overriding Default Translations
The core SanteDB applets provide default translations for all core SanteDB concepts. Sometimes, depending on the context, these need to be changed. This is supported in the manifest.xml
file using the priority
attribute on your translation, for example, to override the default title of the Administrative Panel you could use:
Mozilla Pontoon
Once complete, you can reference your strings files in the manifest (as shown in the example below):
Finally, you should create a file called i18n.toml
in your applet to allow Mozilla Pontoon to import your strings.
Community Translations
SanteDB community translations are collected via the SanteDB Pontoon service. The following process is used:
As the SanteDB community implements new features they add them to the appropriate
strings.xml
file with an English translation.Prior to a new minor release the SanteDB team merges the new terms from
develop
branch into thei18n
branch - and the new strings become available in SanteDB.The community can contribute translations of the new strings into the
i18n
branchPrior to a major release the
i18n
branch is merged intodevelop
(all community translations are present)The build is validated and the
develop
branch is merged intomaster
where a new release is packaged.
Last updated
Was this helpful?