Opened 11 years ago

Last modified 2 months ago

#417 accepted defect

JavaScripts and WTForms messages are not translated

Reported by: Jakob Kramer Owned by:
Priority: major Milestone:
Component: programming Keywords:
Cc: Parent Tickets:


The strings in the JavaScripts (e. g. show_password.js) and the !WTForms messages (e. g. “Invalid Input”) cannot be translated right now.


Change History (9)

comment:1 Changed 11 years ago by Jakob Kramer

The problem with WTForms can be solved easily by translating our own strings with our own function and by using an own “Form” class.

comment:2 Changed 11 years ago by Christopher Allan Webber

Component: component1programming

comment:3 Changed 11 years ago by ShawnRisk

Owner: somebody deleted
Status: newassigned

comment:4 Changed 10 years ago by pythonsnake

Owner: set to pythonsnake
Status: newassigned

comment:5 Changed 10 years ago by Emily O'Leary

I added the appropriate translation tags where I had text displayed in what I was working on for in #492.


comment:6 Changed 10 years ago by Christopher Allan Webber

Keywords: review added

comment:7 Changed 10 years ago by Christopher Allan Webber

Keywords: review removed

I've looked at the work done for #453; as said there, the javascript stuff isn't really translated via that method, since it doesn't pass through jinja2.

I think this requires some extra thinking about how to do translations for javascript. One option is that the browser can pull down .mo files and read and parse them in-browser, but that seems kind of strange.

Some suggestions:

  • We can try to avoid using translatable strings as much possible in JS, and use hidden fields that are translated in the browser, etc.
  • We can have an additional page that serves up a big ol json document with all the relevant strings translated at a path like /i18n-es.js ... but this is actually served (and cached) by the mediagoblin application. (It would actually be really nice if this could be rendered once and served via apache for each language somewhere, but I don't know how to do that.)

comment:8 Changed 10 years ago by Christopher Allan Webber

Owner: pythonsnake deleted
Status: assignedaccepted

comment:9 Changed 10 years ago by Amirouche

Current command that generate the strings to be translated should also take care of javascript files using something like and/or This process should generate two file client.po and server.po (for instance) and merge them in app.po. app.po will be submitted for translation.

Another command will take care of splitting the translated files into two .po per language one for client side consumption another for server side consumtion.

Note: See TracTickets for help on using tickets.