Problem creating a new addon localization

I have created localization files for language Khmer(km) for the following custom addon. I have followed all recommended settings for declaration of l18n namespace and marked the strings with '_'.

However the localization strings are not picked up when you request for the translated language Khmer (km).

Using the debug shell I tried to see if the language strings are translated:

>>> site = app.plone
>>> site
<PloneSite at /plone>
>>> translation_service = site.translation_service
>>> translation_service.translate("A Person", domain="popolo.contenttypes", target_language="km")
'A Person'

Wonder if someone could tell me what am I missing?


@erral Do you spot anything that I am doing wrong? The documentation on L10N is quite sparse right now.

Hi @arky – does the translation work if you choose a different language? I'm missing some context here: are you creating a new translation or are you trying to add translation capability to your add-on, or both? If both, maybe try to test one before you test both?

I could load other translations such German locale of Plone core and also addons with German, Dutch, Finnish from collective addons. Only the language localization Khmer(km) from my custom addon does not load.

My guess is that 'zope_i18n_compile_mo_files true' is not building and loading the localization strings.

Adding my extended_buildout.cfg for reference:


politikus.contenttypes = git
popolo.contenttypes = git
ocds.contenttypes = git
politikus.bods = git
politikus.theme = git
collective.vocabularies.iso = git
politikus.extractives = git branch=main
politikus.naturalresource = git branch=main
odm.naturalresources = git branch=main


extends = buildout.cfg 

extensions = mr.developer
always-checkout = force
auto-checkout = *

eggs += 

languages = en km 

environment-vars =
    zope_i18n_compile_mo_files true

Products.PloneHotfix20210518 = 1.2
eea.faceted.vocabularies = 7.0
eea.facetednavigation = 14.6
eea.jquery = 11.2 = 2.2.2 = 1.11.2
collective.dexteritytextindexer = 2.4.0
collective.themefragments = 2.12 = 1.1 = 4.0.0a1
collective.relationhelpers = 1.5

parts +=
unzip = true
recipe = zc.recipe.egg
eggs = i18ndude  

IIRC the domain of those XML files is always "plone" and "i18n:domain" is ignored. This is especially true for all which is rendered in the toolbar menu using the template ( at master · plone/ · GitHub).

To solves this you need to add a plone.po with the few entries needed for the values in the types/**.xml


So what worked for me so far is adding 'precompile' step to the buildout to load the custom localizations. There might be simpler way to load locales, if so please let me know.

Also adding a custom 'plone.pot' file to translate the strings in XML files solved the problem of untranslated string in toolbar (Thanks @jensens)

recipe = plone.recipe.precompiler
eggs =
compile-mo-files = true

Overall I think plone L10N documentation could be improved to make life easier for anyone who are trying to add new localization to their addons.

Plone Foundation Code of Conduct