[ckan-dev] howto do a custom translation for a external plugin
Armin Retterath
armin.retterath at gmail.com
Thu Mar 2 07:47:50 UTC 2017
hi florian,
thanx for the answer - it works as you expected ;-) .
i first copied the spatial/snippets directory to my extension and than
generate the pot file where i can find the relevant strings. after the
translation and compile, i deleted my local copy and it works ;-) .
now i have to fix some solr problems when enabling spatial search :-(
best regards
armin
2017-03-01 17:26 GMT+01:00 <Florian.Brucker at it.karlsruhe.de>:
> Hi Armin,
>
> one extension can provide/override the translations for another extension
> without problems, we're doing that quite a bit.
>
> As far as I know, ckanext-spatial does mark its strings as translatable
> but isn't really set up for i18n otherwise. In particular, there's no
> ".pot" file containing the translatable strings. That's probably something
> that should be fixed in ckanext-spatial itself.
>
> However, you can still translate strings of ckanext-spatial in your own
> extension:
>
>
> 1. Make sure that your extension is set up correctly for i18n (see
> http://docs.ckan.org/en/latest/extensions/translating-extensions.html)
>
> 2. Generate the ".pot" and ".po" files for your extension
>
> 3. Locate the strings in ckanext-spatial that you want to translate (e.g.
> "Clear"), and add them to your ".po" file manually. You will need to add
> the PO-syntax, but it's not hard:
>
> msgid "Clear"
> msgstr "Your translation"
>
> 4. Run "python setup.py compile_catalog" for your extension to compile the
> ".mo" files
>
> 5. Restart CKAN
>
>
> I hope that helps, report back if it doesn't :)
>
>
> Regards
> Florian
>
>
>
> "ckan-dev" <ckan-dev-bounces at lists.okfn.org> schrieb am 01.03.2017
> 16:12:11:
>
> > Von: Armin Retterath <armin.retterath at gmail.com>
> > An: CKAN Development Discussions <ckan-dev at lists.okfn.org>,
> > Datum: 01.03.2017 16:12
> > Betreff: [ckan-dev] howto do a custom translation for a external plugin
> > Gesendet von: "ckan-dev" <ckan-dev-bounces at lists.okfn.org>
> >
> > hi together,
>
> > is there a simple way to do a custom translation for an external plugin?
> > i have an own plugin and did the translation via
> > python setup.py extract_messages
> > ...
> > successfully
>
> > now i enabled ckanext-spatial and adopted my own
> > ckanext/transparencyderp/templates/package/search.html
>
> > to show the spatial filter window. but the translation of the
> > strings like 'Clear' is not done. i may add own .po files to the
> > ckanext-spatial plugin, but in the setup.py of ckanext-spatial
> > [babel] is not referenced.
> > do i have to copy all needed templates of ckanext-spatial to my
> repository?
>
> > thanx in advance and best regards
>
> > armin_______________________________________________
> > ckan-dev mailing list
> > ckan-dev at lists.okfn.org
> > https://lists.okfn.org/mailman/listinfo/ckan-dev
> > Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20170302/f4cc6f32/attachment-0003.html>
More information about the ckan-dev
mailing list