Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add translation capability to the userlog service #410

Merged
merged 2 commits into from
Mar 16, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions modules/ROOT/pages/deployment/services/s-list/userlog.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,29 @@ https://<your-ocis-instance>/ocs/v2.php/apps/notifications/api/v1/notification

containing the IDs to delete.

== Translations

The `userlog` service has embedded translations sourced via transifex to provide a basic set of translated languages. These embedded translations are available for all deployment scenarios. In addition, the service supports custom translations, though it is currently not possible to just add custom translations to embedded ones. If custom translations are configured, the embedded ones are not used. To configure custom translations, the `USERLOG_TRANSLATION_PATH` environment variable needs to point to a base folder that will further contain the translation files. This path must be available from all instances of the userlog service, a shared storage is recommended. Translation files must be of type https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html#PO-Files[.po] or https://www.gnu.org/software/gettext/manual/html_node/Binaries.html[.mo]. For each language, the filename needs to be `userlog.po` (or `userlog.mo`) and stored in a folder structure defining the language code. In general the path/name pattern for a translation file needs to be:
EParzefall marked this conversation as resolved.
Show resolved Hide resolved

[source,plaintext]
----
{USERLOG_TRANSLATION_PATH}/{language-code}/LC_MESSAGES/userlog.po
----

The language-code pattern is composed as `language[_territory]` where `language` is the base language and `_territory` is optional defining a country.
EParzefall marked this conversation as resolved.
Show resolved Hide resolved

As example, for the language `de_DE`, one needs to place the corresponding translation files to
EParzefall marked this conversation as resolved.
Show resolved Hide resolved

[source,plaintext]
----
{USERLOG_TRANSLATION_PATH}/de_DE/LC_MESSAGES/userlog.po
----

=== Translation Rules

* If a requested language-code is not available, the service tries to fallback to the base language if available. As example, if `de_DE` is not available, the service tries to fall back to translations in `de` folder.
EParzefall marked this conversation as resolved.
Show resolved Hide resolved
* If the base language is also not available like when the language code is `de_DE` and neither `de_DE` nor the `de` folder is available, the service falls back to the systems default `en`, which is the source of the texts provided by the code.
EParzefall marked this conversation as resolved.
Show resolved Hide resolved

== Configuration

include::partial$deployment/services/env-and-yaml.adoc[]