Closed torfsen closed 7 years ago
Regarding the second approach: The combination step could be done during server startup and cached until a translation file from CKAN or an extension changes.
There is now a PR for this feature: ckan/ckan#3272. Feedback is welcome!
ckan/ckan#3272 has been merged.
It seems that while CKAN extensions can provide their own i18n translation strings, these strings are only used in Python code and in the Jinja templates, but not in JavaScript.
As far as I understand it, the mechanisms for looking up translations differ quite a bit between Python (incl. templates) and JavaScript. While the former is done dynamically at runtime, the latter is done via JSON files that are statically generated using
paster trans js
before a release. The translations generated usingpaster trans js
are then downloaded by the JavaScript client.It seems that currently,
paster trans js
only takes CKAN's own translations into account, and not those added by extensions. I therefore see two possibilities for adding support for JavaScript translations in extensions:paster trans js
gather translations not only from CKAN but also from the extensions.The first approach seems to be quite easy to implement but has some major drawbacks: For example,
paster trans js
would need to be re-run whenever you add or update an extension.The second approach looks like more work but would be far easier to use once implemented.