-
Notifications
You must be signed in to change notification settings - Fork 17
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
Import translations and sync locales #2615
Conversation
a6944bb
to
4169572
Compare
`bundle exec rake translation:import:all['dir/to/csvs.csv, true']`
The about page was previously hard coded for the English and Welsh link only. This commit adds support for the rest of the languages.
4169572
to
6bb97d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great! Some very minor suggestions below:
config/locales/bn/shared.yml
Outdated
@@ -7,6 +7,6 @@ bn: | |||
title: GOV.UK ব্রাউজ করুন | |||
get_emails: এই বিষয়ের জন্য ইমেইল নিন | |||
language_direction: ltr | |||
language_name: ইংরেজি |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well spotted!
Collections uses language subdirectories to organise it's locales. We have to add custom config which tells i18n-tasks how the keys are organised. The write config: `['{:}.*', 'config/locales/\1.%{locale}.yml'` was copied from the i18n-tasks documentation which tells i18n-tasks to write every top-level key namespace to its own file. For example, 'fr.organisation.parent.key' would be added to the French directory ('fr') and the top level key would become the filename ('organisation.yml'). This config complies with the current Collections formatting. [1]: https://github.com/glebm/i18n-tasks/tree/1b9e0465e984df8f7890f620b0bbb6646d40d77f#pattern-router
This list of 'ignore_unused' keys tells i18n-tasks which keys to ignore when it attempts to remove unused keys from the codebase. The keys in the list are used, but are called upon dynamically (string interpolation etc), for example: 'schema.#{doc_type}.#{count}'. I18n-tasks default scanners can't detect these and so we need to add an ignore list.
bundle exec i18n-tasks remove-unused
Safeguard against raw HTML being rendered in the application. See [1] for more information. [1]: https://guides.rubyonrails.org/i18n.html#using-safe-html-translations
After the translations import, the language direction for these languages was updated to LTR which is incorrect. The correct direction for these languades were sourced from the translators themselves and verified using Google.
`language_name` has been incorrectly translated to English, in various languages, rather than the actual languages name. These translations have been copied from Whitehall's locale keys.
These were missed from the original import as the translations supplier renamed the CSV column 'translation' to 'source'. This reverts the name change and imports the CSV.
The Brexit header key was renamed in [1]. [1]: 2e0c57f#diff-00648522a19891bcbb78dabc62e30df49f094cac8cc115ee81e256da7a48b840R70
bundle exec rake translation:add_missing
6bb97d9
to
6a504bc
Compare
Cheers for the review @ChrisBAshton. I've addressed your comments and thanks for making them as my commit messages were quite non-descriptive! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff - thanks Peter ⭐
Imports translations and sync locales.
More info in the commits ->
Trello:
https://trello.com/c/Xz78vNR4/2757-import-newly-sourced-translations-into-locale-files-5