Description
We have some basic internationalization/localization via the i18n
gem, but need to think through how to improve it, and ALSO come up with a streamlined workflow to recruit and integrate new translations on an ongoing basis. This is a planning issue for this set of projects.
Translation systems
Our translation files are spread over lots of files and folders in https://github.com/publiclab/plots2/tree/master/config/locales
I'm inclined to make them all one big file, or at least consolidate them some. One folder with key/value would be SO AWESOME! I wasn't sure why our implementation fragmented everything across so many folders. I think we could do this in Transifex.
Discussion of alternative platforms via @ebarry :
- LocalApp: https://www.localeapp.com/projects/9741/translations/5689967
- https://crowdin.com/ (github integration)
- https://poeditor.com/ (github integration)
Ongoing translation workflow
We need a workflow to regularly go from Transifex (or something similar) back into the translation files.
Transifex has GitHub integration: https://docs.transifex.com/integrations/github/ and awesome ability to auto-sync in TravisCI: https://docs.transifex.com/integrations/github/#integrating-the-client-with-travis-ci
This would grab new translations each time we accepted a pull request, and register new texts that need translation!
Outreach
For actually doing the translations, I'm hesitant to make a huge # of translation issues in the same repository, even if they are first-timer type issues. I think we could maybe get more contributors to translate outside the GitHub interface (which is most welcoming to coders).
I think we'll need a good outreach game to actually recruit people to do translations! Maybe, we could tweet them out? We could show a random phrase at the bottom of the site each time the site is loaded, that needs translation?
If we happen to find alternatives (especially open source ones) that's great, but we can stick with Transifex if there's no big reason to switch.
The ideal might be that with fewer files, we could copy in new changes from either another service like Transifex periodically (monthly?), or from files in another repository (although this doesn't make it more accessible by going outside the GitHub interface)
We might even try to automate the import and run it periodically. But it could be a regular task manually too.
Translation prompts
Anywhere we display translated text using the t('some_string_here')
helper, we ought to display a little globe icon with a tooltip saying Needs translation? Click to help translate this text.
or something (ideally in the browser-configured language!)
Translating content
We'll need to think about how to translate both regular site content (wiki pages + notes) and ALSO features, which are used around the site for things like the static footer, explanatory text, etc.
Perhaps there should be a language type on revisions, and we could make it possible to track translated revisions alongside regular ones. Or perhaps a translated node, linked to the main node?
Compare https://publiclab.org/barnraising to https://publiclab.org/wiki/barnraising-guangzhou-china for an example of 2 versions of a page in 2 languages.
Features
Some parts of site content -- like the footer and front page -- are run in nodes, as database content. Let's think of a way to have features like frontpage-en
vs frontpage-zh
and frontpage-es
Helpers for translation
@siaw23 points out, and I agree, that translation is tough for newcomers submitting new code. The current format is something like:
<%= t('some_string_here') %>
...where some_string_here
is the key to some string of text.
I propose a new helper, maybe called translate()
, which looks for translations, but if none are present, displays the key text itself. That way, we can create new interfaces that include text, without first having to do translation for them -- they'll have the fallback text. So:
<%= translate('Click here to begin') %>
which initially would have only the default english, but via the prompts (above) would encourage community translation efforts.
Scanning for translation opportunities
Finally, we might have a script which scans for uses of the new helper (from above) that don't have entries in the default translation file, and copies them in.
This is a lot. Just kicking off some discussion and we can start to move things into separate issues soon! Love to hear peoples' input!