Summary
Coming from a speaker who escaped a notion to "why would we need to translate?" this talk aims to show what actually goes into translating a website or app using Django's Internationalization tools. Covered will be an overview of batteries included, best practices and anti-patterns in using them, and some third party tools to help make your life escaping the myth of a Lingua Franca easier.
Description
There's often a bubble in the English-speaking programming world that the entire internet runs on English. Our Top-level domains are shortened english words. Our programming languages--Python in particular--try to emulate English words and grammar.
Firmly in place in this world for many years, my first attempt to translate a pre-existing site came with a high sticker shock of nuanced difficulty. This talk covers all the lessons I learned in taking a fully-fleshed web app with no translation (and a programmer with no translation experience) to being completely translated.
Talk Overview
- Introduction to Translation
- Overview of gettext
- Brief history of a translation
- Add gettext calls
- django-admin.py makemessages
- Ship po file to translation service
- Receive file back
- Compile
- Fin
- gettext vs gettext_lazy
- Batteries Included
- gettext Python calls
- Middleware
- template tags
- trans vs. blocktrans
- Anti-patterns of the battery included use.
- Heavy whitespace in blocktrans
- Monster-sized translations
- The best laid plans of mice and men...
- Problems that get in the way of A history of a translation.
- Realize half the site is still untranslated
- Edit out the translations you already had translated to avoid re-curring costs
- Have the product adjust so two words change
- Realize common text that's in the database
- Fin?
- Patterns and tools to help
- poxx.py and the idea of a 'canonical' po file.
- dbgettext
- Wholly-translated template files (translate_include, trans_render)
- Advanced Translation Technique
- While undocumented, translation backend is pretty darn flexible and the source code is a treasure trove to make 'impossible' use cases not too bad.
- Overview of how the translation service works behind the scenes
- _translation thread local
- Merged translations (root->app->default)
- Sessions vs. Accept-Language
- Middleware and Context processors
- Example of advanced translation code: Multi-tenancy translation.
- Translating some sites, not translating others
- Translating Site A one way, Site B another
- Using an English translation for duct-tape and profit.
- Why Django's i18n sucks.
- In the vein of the "Django Sucks" Key note. It doesn't really, but it could use some changes--from minor to major.
- Why .po Files are archaic and limited.
- What we can do to improve for 1.5 and beyond.