Table of Contents
Docserv² supports localization of the templates for navigational pages via localization files in conjunction with Server Side Includes (SSI) fragments (see Chapter 9, SSI fragments). Use of the SSI fragment feature also necessitates use of localization files.
All localization files must be collected in a single directory.
There must be at least one localization file for the default UI language. This file must contain all requested localization strings.
Files for alternative UI languages and the strings within them are optional. In case they are missing, the default UI language’s string will be used as a fallback.
Localization files are based on a simple file format and easy to validate. Each file represents a single language. Within a localization file, localization strings are uniquely identified by their localization key.
Localization files must be named [LANGUAGE_CODE].xml
.
The [LANGUAGE_CODE]
must use the format la-ng
(see also the section called “Language code”).
The file format of localization files looks like this:
<?xml version="1.0" encoding="UTF-8"?> <locale xmlns="https://github.com/openSUSE/docserv/l10n" lang="[LANGUAGE_CODE]"> <content key="[LOCALIZATION_KEY]">[LOCALIZED_CONTENT]</content> </locale>
The [LANGUAGE_CODE]
must use the format la-ng
(see also the section called “Language code”).
This language code definition is purely informative, as Docserv² will pick up the language code from the file name.
The [LOCALIZATION_KEY]
must be unique within each localization file.
The localization key uses an xsd:ID
data type.
It must not contain spaces or a leading digit.
The [LOCALIZED_CONTENT]
can be any content, including a limited XHTML subset.
Localized content can contain the following placeholders:
@{{year}}
within the content:
Placeholder for the current year (for example, 2022
).
This replacement is not handled by XML tools.
@({{ui_language}}
within the content:
Placeholder for the language code of the generated fragment (in the format la-ng
, see also the section called “Language code”).
This replacement is not handled by XML tools.
@{{ui_language_omissible}}
Placeholder for the UI language of the generated fragment, for situations where the language code is omissible in URLs (for example, empty string for the default UI language or la-ng
for alternative UI languages).
This replacement is not handled by XML tools.
@{{ui_language_omissible_slash}}
Placeholder for the UI language of the generated fragment with a slash appended, for situations where the language code is omissible in URLs (for example, empty string for the default UI language or la-ng/
for alternative UI languages).
This replacement is not handled by XML tools.