[ckan-discuss] Translation of custom templates?

Anton Lundin anton at dohi.se
Tue Jan 8 20:41:19 GMT 2013


On 21 December, 2012 - Sean Hammond wrote:

> > I was more thinking in the context of translating our extra_template's.
> > 
> > We add our own theme by overriding some templates by using:
> > extra_template_paths = %(here)s/theme/templates
> > 
> > And if i introduce additional strings there, it would be nice to keep
> > those translations there allso somehow.
> > 
> > Currently it works just great if we don't change any of the
> > "default"-strings in the templates, then the translation system picks
> > those up just fine, but if i would like to add additional strings or
> > change some of the existing they don't get translated.
> > 
> > It would be great if there were a translation section of the theming
> > help.
> 
> Hey, did you find a solution to this?

I haven't produced a solution yet but a proof of concept, and I would
like to start to thank you for the support in my efforts.

Our current plan is to start to support a very limited set of
translations and trying to keep all our content contained to our theme
and extensions.

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

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.

I think that the second approach could be something that could benefit
more communities out there, and meanwhile, the first approach can be a
workaround.


//Anton


-- 
Anton Lundin

anton at dohi.se

http://www.dohi.se/



More information about the ckan-discuss mailing list