From cef98dd9c435ad27822fc800bfd5aed11bbebf9c Mon Sep 17 00:00:00 2001 From: Jacob Laursen Date: Sun, 3 Jul 2022 22:49:51 +0200 Subject: [PATCH] Describe generation of i18n properties using tool (#1833) * Describe generation of i18n properties using tool Signed-off-by: Jacob Laursen * Bumped heading up one level Signed-off-by: Jacob Laursen * Comply with rule: Fenced code blocks should be surrounded by blank lines Signed-off-by: Jacob Laursen * Remove plugin version from command Signed-off-by: Jacob Laursen --- developers/utils/i18n.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/developers/utils/i18n.md b/developers/utils/i18n.md index e4b5deae4..ef98c87f3 100644 --- a/developers/utils/i18n.md +++ b/developers/utils/i18n.md @@ -444,6 +444,17 @@ The custom keys are a very good practice to translate bundle dependent error mes updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR, "@text/offline.communication-error"); ``` +## Generating I18N properties file + +To automatically generate an I18N properties file from XML files, the following command can be run: + +```shell +mvn org.openhab.core.tools:i18n-maven-plugin:generate-default-translations +``` + +This tool can also be used to update an existing file. +Custom texts will be preserved when doing this. + ## I18n Text Provider API To programmatically resolve texts for certain languages openHAB provides the OSGi service `TranslationProvider`. @@ -478,7 +489,7 @@ For Binding Info and ConfigDescription, the localized objects can be retrieved v ## Managing translations -Localization is managed with the cloud service [Crowdin](https://crowdin.com/) where translators can contribute translations. +Localization is managed with the cloud service [Crowdin](https://crowdin.com/) where translators can contribute translations in different languages. This is the process: