diff --git a/app/assets/javascripts/app/controllers/_plugin/translation_support.coffee b/app/assets/javascripts/app/controllers/_plugin/translation_support.coffee index a31afd3fc..7fe381270 100644 --- a/app/assets/javascripts/app/controllers/_plugin/translation_support.coffee +++ b/app/assets/javascripts/app/controllers/_plugin/translation_support.coffee @@ -19,7 +19,7 @@ class TranslationSupport extends App.Controller # verify current state of translation meta = App.i18n.meta() percent = parseInt( meta.translated / (meta.total / 100) ) - return if percent > 95 + return if percent > 90 # show message new Modal(percent: percent) diff --git a/app/assets/javascripts/app/views/profile/language.jst.eco b/app/assets/javascripts/app/views/profile/language.jst.eco index dd4ed5b84..34b9f8b68 100644 --- a/app/assets/javascripts/app/views/profile/language.jst.eco +++ b/app/assets/javascripts/app/views/profile/language.jst.eco @@ -9,4 +9,5 @@
+<%- @T('Did you know? You can help translating %s at:', 'Zammad') %> translations.zammad.org
\ No newline at end of file diff --git a/i18n/README.md b/i18n/README.md index d4563f03b..62cedc915 100644 --- a/i18n/README.md +++ b/i18n/README.md @@ -1,4 +1,6 @@ -# Zammad Translations - `i18n/*.po` +# Zammad Localization + +## Zammad GUI Translations - `i18n/*.po` Zammad translations are managed exclusively via [translations.zammad.org](https://translations.zammad.org/). @@ -6,10 +8,56 @@ You are welcome to contribute. Please get a free account there if you want to do Any pull requests modifying translation files directly will be rejected. -# Zammad Text Modules - `i18n/text_modules/*.yml` +## Zammad Text Modules - `i18n/text_modules/*.yml` Zammad text modules are automatically imported when the first admin user is created, according to this user's language. This is just meant to provide for a smooth start with some existing helpful text modules. They can be modified later on; no subsequent import from the example files will be performed. Feel free to send pull requests to add more helpful examples to existing files or even files for new languages. + +## Zammad Chat - `public/assets/chat` + +The Zammad chat currently has its own build pipeline and also a custom translation handling. +Messages and translations are directly baked into [chat.coffee](../public/assets/chat/chat.coffee) and have to be maintained +there. + +## Zammad Notification Templates - `app/views/mailer/*` + +Zammad contains a number of different notification templates which are currently stored directly in language-specific `ERB` +template files. Modifications of existing or addition of new translations must be made in these files directly. + +# Developer Workflows + +## Weblate Process Overview + +- The codebase has a translation catalog file [i18n/zammad.pot](zammad.pot), which must be kept up-to-date. +- Weblate automatically picks this file up from git and updates its database. Now translators see the new/changed strings and can work on them. +- From time to time, Weblate pushes the new/updated translations via merge request to git. +- After the merge, the translation files in `i18n/zammad.*.po` are updated. +- Zammad will pick them up as soon as `Translation.sync` gets called, which happens for example during a package update. + +## Updating the Source String Catalog + +If changes to translatable strings are made during the development process, developers can just run the following to +re-extract the strings to the catalog file: + +`rails generate translation_catalog` + +This will update the `i18n/zammad.pot` file in Zammad. To do this for an existing addon module, call + +`rails generate translation_catalog --addon-path /path/to/addon` + +## Testing Translation Changes from Weblate + +To test any changes made to translations in Weblate that are not yet published to Zammad, +you can use this workflow: + +- Download the current state of the language from Weblate as po file. +- Save it locally in the Zammad folder as `i18n/zammad.pt-br.po` (for `pt-br` in this case, use corresponding file names for other languages). +- Run `rails r Translation.sync` to import the latest state to the database. +- Now the changes should appear in the GUI. + +## Known Issues With Localization + +- There is currently no support for plural forms. diff --git a/i18n/zammad.pot b/i18n/zammad.pot index 0d59a88ab..172262591 100644 --- a/i18n/zammad.pot +++ b/i18n/zammad.pot @@ -3188,6 +3188,10 @@ msgstr "" msgid "Devices" msgstr "" +#: app/assets/javascripts/app/views/profile/language.jst.eco +msgid "Did you know? You can help translating %s at:" +msgstr "" + #: db/seeds/settings.rb msgid "Digit required" msgstr "" diff --git a/spec/system/system/translations_spec.rb b/spec/system/system/translations_spec.rb index 289119722..c61e58981 100644 --- a/spec/system/system/translations_spec.rb +++ b/spec/system/system/translations_spec.rb @@ -121,8 +121,8 @@ RSpec.describe 'System > Translations', type: :system do it 'asks to improve translations with solid coverage' do visit '/#system/translation' - page.evaluate_script('App.i18n.meta = function(){ return { total: 100, translated: 90 } }') - expect(page).to have_text('Up to 90% of this language is already translated. Please help to make Zammad even better and complete the translation.') + page.evaluate_script('App.i18n.meta = function(){ return { total: 100, translated: 89 } }') + expect(page).to have_text('Up to 89% of this language is already translated. Please help to make Zammad even better and complete the translation.') end end