Missing language translation button - BUG

I start Corteza locally for testing with this command:

docker run -d -p 1080:80 -e DOMAIN="localhost:1080" -e DB_DSN="sqlite3:///data/database.db" -e LOG_LEVEL
="debug" -e LOCALE_LOG="true" -e LOCALE_LANGUAGES="en,de" cortezaproject/corteza:2024.9

I register and login as the first SuperAdmin. I’m able to switch between English and German (there are some missing translations in German).

However, when I go to my namespaces or modules, I’m unable to create translations for them - the language button is not there. Resource Translations :: Corteza Docs

I tried multiple combinations of LOCALE_LANGUAGES and LOCALE_PATH env.variables values. I also tried all Corteza versions from 2021 up. The example docker command above is just one of many, but the behavior (missing button for translations) is still the same.

Am I doing anything wrong?

Browser: Brave, Chrome
No errors in JS console.

From the code

  • /cortezaproject/corteza/blob/31d38a227db129965752b422ff5bb91767ddf9ce/client/web/compose/src/views/Namespace/Edit.vue#L41
  • /cortezaproject/corteza/blob/31d38a227db129965752b422ff5bb91767ddf9ce/client/web/compose/src/components/Namespaces/NamespaceTranslator.vue#L3

I see only these conditions:

  • v-if="namespace": it exists and is saved, closed and reopened
  • canManageResourceTranslations: I’m a SuperAdmin
  • resourceTranslationsEnabled: now this is tricky. I can see 2 possible definitions:
    • /cortezaproject/corteza/blob/31d38a227db129965752b422ff5bb91767ddf9ce/client/web/compose/src/mixins/resource-translations.js#L22
    • /cortezaproject/corteza/blob/31d38a227db129965752b422ff5bb91767ddf9ce/server/pkg/options/options.gen.go#L173

And the last one was it - I had to add LOCALE_RESOURCE_TRANSLATIONS_ENABLED=true to my environment variables. I’m pretty sure i haven’t seen this one anywhere. So I will look in the documentation and add it somewhere.

docker run -d -p 1080:80 -e DOMAIN="localhost:1080" -e DB_DSN="sqlite3:///data/database.db" -e LOG_LEVEL="debug" -e LOCALE_LOG="true" -e LOCALE_RESOURCE_TRANSLATIONS_ENABLED="true" -e LOCALE_LANGUAGES="en,de" cortezaproject/corteza:2024.9

I believe, this (below) is the intended behavior. I can’t see a reason to explicitly allow 2 languages and on top of that also explicitly allow translations.

     * Resource translations are enabled when there is more than 1 language
     * @returns {boolean}
     */
    resourceTranslationsEnabled () {
      return this.resourceTranslationLanguages.length > 1
    },

@tjerman Is it a bug in the documentation? I still can’t find LOCALE_RESOURCE_TRANSLATIONS_ENABLED anywhere in the documentation, only mentioned here:

Or is it a bug in the code and instead of LOCALE_RESOURCE_TRANSLATIONS_ENABLED the condition should be whether LOCALE_LANGUAGES contains multiple languages?

I can do a pull request fixing any of these two. I just need a decision on what the intentions were.

Strange that it isn’t anywhere in the docs. It is referenced in the server .env.example

Like you said yourself, you have to have at least 2 languages defined and the LOCALE_RESOURCE_TRANSLATIONS_ENABLED has to be set to true to allow the button to be visible.

@tjerman any thoughts on this?

Yes, this is an issue in the docs.
There is an explicit option to toggle translations on and off. If there is only one language, it makes no sense to provide the option neither, so both are needed.

Feel free to propose a revision in the docs repo.

Thanks to you both.

Sorry, i missed the LOCALE_RESOURCE_TRANSLATIONS_ENABLED in the .env.example. I will check more carefully, where LOCALE_LANGUAGES and LOCALE_RESOURCE_TRANSLATIONS_ENABLED are mentioned in the doc, and I will send a pull request for the documentation probably during the weekend.

1 Like

Thanks for amending the docs, I appreciate it.
Will merge asap.

Feel free to add stuff that’s missing in the future as well (or things that could be helpful)