[ckan-discuss] Translation of custom templates?

Sean Hammond sean.hammond at okfn.org
Thu Jan 10 16:20:02 GMT 2013


> A example on how I plan to translate pages is:
> https://github.com/openumea/openumea-theme/commit/788143f67b4df95d31ab2b0f4439f4da121dd11c

I wouldn't recommend using a Genshi <py:choose> for every string that
gets translated. Just pass translatable strings in your Genshi templates
to the translation function _ in the usual way, IIRC it looks something
like this in Genshi: ${_("Hello World)}.

Then make the translations available to CKAN following the process I
outlined in my previous email.

> The other way I thought about was to hook in another translator in the
> template chain to be able to translate our added strings. I don't have a
> working prototype but the plan would be to add a extra_translations
> config and in ckan/config/environment.py:~200 add a extra Translator()
> that uses the extra translations as a second translation step.

But can't you just add a "message extractor" in your setup.py file as I
explained in my previous email? Maybe CKAN should support specifying
extra message extractors in the ini file so you don't have to modify the
setup.py file, but modifying the setup.py file isn't hard anyway.



More information about the ckan-discuss mailing list