Changes to Dotcom translation workflow#3307
Conversation
More WIP More changes Update ReadMe
WIP Revert changes to cldr See if this works for CI Check on every file change
076bc9b to
a47600b
Compare
| # See the documentation for `Mix` for more info on aliases. | ||
| defp aliases do | ||
| [ | ||
| localize: ["gettext.extract", "gettext.merge priv/gettext --no-fuzzy"] |
There was a problem hiding this comment.
Praise / Minor Suggestion: I really like this!
How would you feel about adding another one, like 👇
check_localized: ["gettext.extract --check-up-to-date"](This would largely be a convenience for me, since I have an easy way of running individual commands with no flags in my editor... this is the least blocking of any suggestions lol)
| config :dotcom, | ||
| default_locale_code: "en", | ||
| locale_codes: ["en", "es", "ht", "pt", "vi", "zh"] | ||
| locale_codes: ["en", "es", "ht", "pt-BR", "vi", "zh-CN", "zh-TW", "fr-FR"] |
There was a problem hiding this comment.
Issue: I think by virtue of adding fr-FR, you've caused another .po file to com into existence on mix compile. Would it make sense to commit that file as well?
There was a problem hiding this comment.
Gotta be honest - I was rushing when I typed this - it's not a .po file 🤦♂️ - it's a JSON file - priv/cldr/locales/fr.json.
I stand by my question/suggestion/request to commit it though!
|
|
||
| - Wrap strings to be translated in the `gettext` function, i.e. `gettext("your string here")`. | ||
| Note that you may need to wrap the function call in `{...}` for attribute strings and | ||
| `<%= ... %>` for text on the page. |
There was a problem hiding this comment.
Nit: HEEx works with {} for text on the page as well, so 👇 are equivalent.
<span><%= foo(@bar) %></span><span>{foo(@bar)}</span>All that to say, you can drop the "<%= ... %> for text on the page" part of this note.
|
|
||
| 1. No newlines inside a gettext call. Newlines are a new gettext call. | ||
| 2. Don't start or end with whitespace. If you break a sentence up, leave the whitespace in the HTML untranslated. | ||
| 3. If you break apart a sentence across multiple gettext calls, use `pgettext` and add context including the full sentence to help translators. Grep the app for `pgettext` for examples. |
There was a problem hiding this comment.
Is this the sort of thing that would apply to links... e.g. in a sentence like "transfer to the Orange Line at Downtown Crossing"?
| config :dotcom, | ||
| default_locale_code: "en", | ||
| locale_codes: ["en", "es", "ht", "pt", "vi", "zh"] | ||
| locale_codes: ["en", "es", "ht", "pt-BR", "vi", "zh-CN", "zh-TW", "fr-FR"] |
There was a problem hiding this comment.
Gotta be honest - I was rushing when I typed this - it's not a .po file 🤦♂️ - it's a JSON file - priv/cldr/locales/fr.json.
I stand by my question/suggestion/request to commit it though!
joshlarson
left a comment
There was a problem hiding this comment.
This seems quite reasonable, and the workflow you described in the README is quite cool!
Thanks for setting this up.
(I snuck a commit on to add that new file 😇)
Scope
We realized that Dotcom's custom translation task is making it so a single string,
All clear, captain!was the only thing getting translated from English. This changes the code so we can properly update our.pofiles for translations going forward.Asana Ticket: Implement: Fix workflows/Add CI checks/Update ReadMe
Implementation
translator.ymlandtranslate.exterminologiesgettextpluralization logicmix localize, that should be run manually to update.pofiles before making PRs.pofiles have been properly updated.pofile for English phrasesScreenshots
How to test
mix localizelocally to update your.pofiles (particularly the one for English phrases). Review the files to make sure they look as expected.