data-for-change / anyway

ANYWAY - Car accidents map
http://www.anyway.co.il
MIT License
77 stars 243 forks source link

Automatic localization for messages #94

Open danielhers opened 10 years ago

danielhers commented 10 years ago

Currently messages are written as Hebrew strings hard-coded in the source code. They should be written in a .po file and translated.

esegal commented 9 years ago

Which i18n framework should be used? I saw https://pythonhosted.org/Flask-Babel/ for server side and http://l20n.org/ for client side. Do we have a preference?

danielhers commented 9 years ago

Flask-Babel looks good. I think it also works for the templates: http://stackoverflow.com/questions/9515156/flask-babel-how-to-use-translation-in-jinja-template-file

esegal commented 9 years ago

I started working on integrating Flask-Babel. I'll soon push the changes, and then we need to start translating everything to English.

omerxx commented 9 years ago

I think an English translation already exists, ask @galraij

danielhers commented 9 years ago

Right, for the fields but not the messages, I think. Both can be integrated into .po files.

On Fri, Sep 18, 2015, 18:42 Omer Hamerman notifications@github.com wrote:

I think an English translation already exists, ask @galraij https://github.com/galraij

— Reply to this email directly or view it on GitHub https://github.com/hasadna/anyway/issues/94#issuecomment-141486027.

esegal commented 9 years ago

To start, I've integrated Flask-Babel (https://github.com/hasadna/anyway/pull/438). This will allow replacing strings with gettext('Message') function, to get the translated message according to the current request's chosen locale.

danielhers commented 9 years ago

From #310, here is the translation file for the data fields: https://docs.google.com/spreadsheets/d/1TxRQukcLzfno8kG-6eH_XEMrcuk2h8PNJOmY5IZUEzg/edit?usp=sharing

danielhers commented 9 years ago

See #438 for instructions on how to write translations.

danielhers commented 9 years ago

Accident details field translations:

Anyway ACC code book translation into english.xlsx