[ckan-dev] Renaming CKAN terms/labels

Harald von Waldow harald.vonwaldow at eawag.ch
Mon Apr 10 10:41:43 UTC 2017


Here is how we do that. Special case but maybe helpful:

We change a couple of words: "Dataset"-> "Package", "Group"->"Project", ...

We only support default English: There are no variables ckan.locale* or
ckan.i18n* set whatsoever.

We used the supplied en_GB (I believe) po-file as a base, modified it
and put it together with the derived mo-file here:

ckanext-eaw_theme/ckanext/eaw_theme/i18n/en/LC_MESSAGES/ckanext-eaw_theme.po

ckanext-eaw_theme/ckanext/eaw_theme/i18n/en/LC_MESSAGES/ckanext-eaw_theme.mo

ckanext-eaw_theme is our theming extension.

This is being activated by simply having the plugin inherit from
DefaultTranslation:

--- plugin.py -----------------

from ckan.lib.plugins import DefaultTranslation

class Eaw_ThemePlugin(plugins.SingletonPlugin, DefaultTranslation):

-------------------------------


Greeting,
Harald


On 2017-04-06 21:01, Ted Strauss wrote:
> The en_GB hack doesn't seem to be working either.
> I'll follow progress on the relevant github issues+PRs, to see where
> this goes.
> Thanks
>> 
> On Thu, Apr 6, 2017 at 2:37 PM, Ian Ward <ian at excess.org
> <mailto:ian at excess.org>> wrote:
> 
>     Repeating what I said on the issue: I mistakenly believed
>     that https://github.com/ckan/ckan/pull/2909
>     <https://github.com/ckan/ckan/pull/2909> had been merged. Without
>     that change replacing English terms in CKAN involves something like
>     the en_GB hack you describe, but I'm not sure.
> 
>     On Thu, Apr 6, 2017 at 2:34 PM, Ted Strauss <ted.strauss at gmail.com
>     <mailto:ted.strauss at gmail.com>> wrote:
> 
>         Posting an update on my issue:
>         - I have modified the en_GB/ ckan.po file to maek desired changes
>         - I compiled the po file into an mo file using the command:
>         sudo python setup.py compile_catalog -f --locale en_GB
>         - I have updated the production.ini file to set:
>         ckan.locale_default = en_GB
>         (also removed en_GN from locale_filtered_out)
>         - restarted apache
> 
>         Unfortunately there is no change in the front end, it didn't work.
>         Checking /api/util/status confirms that en_GB is the active locale.
> 
>         Have tried clearing cache and loading in multiple browsers.
> 
>         Any suggestions?
> 
>         I found this open issue on github, that is related:
>         https://github.com/ckan/ckan/issues/2475
>         <https://github.com/ckan/ckan/issues/2475>
> 
>         Thx
> 
>> 
>         On Thu, Apr 6, 2017 at 12:46 PM, Ted Strauss
>         <ted.strauss at gmail.com <mailto:ted.strauss at gmail.com>> wrote:
> 
>             Thanks.
>             The i18n folder contains en_AU and en_GB folders. (None
>             called just en.)
> 
>             And the production.ini file contains this:
> 
>             ## Internationalisation Settings
>             ckan.locale_default = en
>             ckan.locale_order = en pt_BR ja it cs_CZ ca es fr el sv sr
>             sr at latin no sk fi ru de pl nl bg ko_KR hu sa sl lv
>             ckan.locales_offered =
>             ckan.locales_filtered_out = en_GB
> 
>             Does this mean that en_GB is treated as the default
>             language? Or en_AU ?
>             So if I modify  i18n/en_GB/LC_MESSAGES/ckan.po
> 
>             And then compile the translation with the setup.py script,
>             that will update the front-end, right?
> 
>             Ted
> 
>> 
>             On Thu, Apr 6, 2017 at 9:58 AM, Ian Ward <ian at excess.org
>             <mailto:ian at excess.org>> wrote:
> 
>                 recent CKANs support adding English "translation" files.
>                 You can use that to rename the labels you listed without
>                 having to modify all the templates. 
> 
>                 On Thu, Apr 6, 2017 at 9:52 AM, Ted Strauss
>                 <ted.strauss at gmail.com <mailto:ted.strauss at gmail.com>>
>                 wrote:
> 
>                     I am setting up CKAN for a research institute and in
>                     this context
>                     I would like to modify some of the top-level labels
>                     as follows:
>                     datasets --> studies
>                     organizations  --> labs
>                     ... and maybe a couple others
> 
>                     I understand that because of localization this is
>                     not a simple change.
>                     Is this something that has come up before, such that
>                     there is a guide
>                     or previous discussion on the best way to do this?
> 
>                     Thanks for any tips.
> 
>                     Ted 
>                     _                             _
>                     _
>                     _
>                     Ted Strauss / Manager, Data Resources
>                     McConnell Brain Imaging Centre / Montreal
>                     Neurological Institute
>                     McGill University
>> 
>                     _______________________________________________
>                     ckan-dev mailing list
>                     ckan-dev at lists.okfn.org <mailto:ckan-dev at lists.okfn.org>
>                     https://lists.okfn.org/mailman/listinfo/ckan-dev
>                     <https://lists.okfn.org/mailman/listinfo/ckan-dev>
>                     Unsubscribe:
>                     https://lists.okfn.org/mailman/options/ckan-dev
>                     <https://lists.okfn.org/mailman/options/ckan-dev>
> 
> 
> 
>                 _______________________________________________
>                 ckan-dev mailing list
>                 ckan-dev at lists.okfn.org <mailto:ckan-dev at lists.okfn.org>
>                 https://lists.okfn.org/mailman/listinfo/ckan-dev
>                 <https://lists.okfn.org/mailman/listinfo/ckan-dev>
>                 Unsubscribe:
>                 https://lists.okfn.org/mailman/options/ckan-dev
>                 <https://lists.okfn.org/mailman/options/ckan-dev>
> 
> 
> 
> 
>         _______________________________________________
>         ckan-dev mailing list
>         ckan-dev at lists.okfn.org <mailto:ckan-dev at lists.okfn.org>
>         https://lists.okfn.org/mailman/listinfo/ckan-dev
>         <https://lists.okfn.org/mailman/listinfo/ckan-dev>
>         Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>         <https://lists.okfn.org/mailman/options/ckan-dev>
> 
> 
> 
>     _______________________________________________
>     ckan-dev mailing list
>     ckan-dev at lists.okfn.org <mailto:ckan-dev at lists.okfn.org>
>     https://lists.okfn.org/mailman/listinfo/ckan-dev
>     <https://lists.okfn.org/mailman/listinfo/ckan-dev>
>     Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>     <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
> 

-- 
Harald von Waldow
Eawag
ICT Services
Ueberlandstrasse 133
8600 Duebendorf
http://www.eawag.ch

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20170410/f24454dc/attachment-0003.sig>


More information about the ckan-dev mailing list