News for hackers. Stuff that matters.
Re:Improving your (Python) code with modern idioms by DeepDuh on Tuesday May 08, 2012 @04:22AM (#3942749)
Do you really want to keep the same format strings when localizing an application? Isn't it much cleaner to just define multiple format strings? Translations in general don't work that way, you can't just move around words and translate them individually, usually the whole expression changes.
Re:Improving your (Python) code with modern idioms by psquid on Tuesday May 08, 2012 @06:53AM (#3943052)
That's the point. You can't change the format strings to a different word order if the selection of values used to fill the fields is entirely dependent on word order (i.e., how the basic printf syntax works), unless you have a separate line/block of code that executes when the word order of the current locale differs.
Re:Improving your (Python) code with modern idioms by DeepDuh on Tuesday May 08, 2012 @12:02PM (#3944290)
I see your point now. Yes, I can see Python 3's syntax facilitate some of that work. I still think you will need branches and/or polymorphisms to do more complex localizations, especially when you need to support east asian languages.
Re:Improving your (Python) code with modern idioms by sausagefeet on Tuesday May 08, 2012 @08:43AM (#3943315)
We just have a database of sentences and a translation is a lookup in the DB by some unique identifier. Trying to semi-translate a string just doesn't work very well in the long run (for us).