I really like that Mozilla has a strong L10n team made up of both employees and community volunteers. Months ago we made some cool localization changes to MDN, and I learned a lot about django localization, gettext, pootle, and translate toolkit.
Back then Leszek, a localization volunteer and add-on developer, filed a bug about a bunch of un-localized MDN strings, and then found a bunch more un-localized strings again recently. I remembered I had read about using pseudo-translations for localizability testing, and thought I'd try it for MDN.
MDN, like (almost?) all Mozilla webdev projects, uses gettext message files (svn), so we can use translate toolkit. (woo! SourceForge project!) We also use a product_details repository (svn) to closely track the same language and country codes used by other Mozilla products. I needed to add the new test locale, but Pike pointed out we have to use a single-character subtag (x-testing) to indicate a privately-defined language code (per ietf bcp47), while Stas pointed out that pootle requires a two-character subtag. So, we added 'x-testing' language to the product_details (bug), then I added xx_testing in locale/ for pootle, along with a x_testing -> xx_testing symlink so django uses the xx_testing files for the x-testing locale.
I installed toolkit and ran podebug on our message.pot file:
cd locale/ mkdir -p xx_testing/LC_MESSAGES podebug --rewrite=bracket templates/LC_MESSAGES/messages.pot \ xx_testing/LC_MESSAGES/messages.po ./compile-mo.sh .
Which gave me a pseudo-translated messages.po file and a compiled .mo file.
I changed MDN to use the environment-specific language-loading snippet (found in playdoh funfactory) to keep the test locale from showing up in production. (We have to add the 'x-testing' locale to linux on our staging servers so gettext can use it there, which proves to be quite a chore.)
Voilà - a new pseudo-translated locale for MDN development. It shows which strings we forgot to mark for localization:
Couple of items I'd like help with:
- Find out how to exclude jinja template variable names so that
{{ _('Welcome back, {username}]) }}
doesn't create
#: templates/includes/login.html:3 msgid "Welcome back, {username}" msgstr "Ẇḗŀƈǿḿḗ ƀȧƈķ, {ŭşḗřƞȧḿḗ}"
- Put all this into tower