|
|
|
|
|
by cbsmith
3825 days ago
|
|
You're looking for something like: l8n_context.format('file_not_found', file)
'file_not_found' is just an identifier to lookup the actual format template (likely a format string) that will be combined with the file object to render the error message. |
|
If translators are cooperating with you, it's very easy to provide the needed elements directly in the format's dictionary (that is: you extract the translatable pieces for them). It also means you don't have to worry that they're going to fiddle with mutable state.
I generally write everything in english, and do back-translation to my own locale (I also cooperate for translating external projects into my locale), so I eat my own dogfood here.
I know I do not want to deal with extra lower-level subtleties here. Translation is hard already by itself. It's impressive how a good translation of a simple UI can take so much time. If I had to inspect the object to know what I can get out of it I would get crazy.
I'd take a pre-baked dictionary any time.
I've also already used the string-catalog approach in the past (heh, XUL), and I'd personally take gettext any day.