Opened 12 years ago

Last modified 15 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 by Jakob Kramer, 12 years ago

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 by Christopher Allan Webber, 12 years ago

Component: component1programming

comment:3 by ShawnRisk, 12 years ago

Owner: somebody removed
Status: newassigned

comment:4 by pythonsnake, 11 years ago

Owner: set to pythonsnake
Status: newassigned

comment:5 by Emily O'Leary, 11 years ago

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


comment:6 by Christopher Allan Webber, 11 years ago

Keywords: review added

comment:7 by Christopher Allan Webber, 11 years ago

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 by Christopher Allan Webber, 11 years ago

Owner: pythonsnake removed
Status: assignedaccepted

comment:9 by Amirouche, 11 years ago

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.