question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What is the set of supported languages and their language codes

See original GitHub issue

I can’t find this information in the documentation.

I need to support Tagalog and Chinese Traditional, but when I include 'tl' for Tagalog in PARLER_LANGUAGES, I get

ImproperlyConfigured("{0}[{1}][{2}]['code'] does not exist in LANGUAGES".format(var_name, site_id, i))

After quite a bit of digging around, I discovered that 'zh-hans' is the code for Chinese Simplified (this ought to be simple to discover), but I still don’t know what to use for Chinese Traditional.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
theguy159commented, Feb 5, 2019

Hi @vdboor, thanks for the update!

this is my LANGUAGES in settings.py

LANGUAGES = (
    ('en', _("English")),
    ('nb', _('Norwegian')),
    ('ar', _('Arabic')),
    ('pl', _('Polish')),
    ('se', _('Northern Sami')),
)

and PARLER_LANGUAGES looks like this:

PARLER_LANGUAGES = {
    None: (
        {'code': 'en', },
        {'code': 'nb', },
        {'code': 'ar', },
        {'code': 'pl', },
        {'code': 'se', },
    ),
    'default': {
        'fallbacks': ['nb'],          # defaults to PARLER_DEFAULT_LANGUAGE_CODE
        'hide_untranslated': False,   # the default; let .active_translations() return fallbacks too.
    }
}

After debugging I found that this is the Exception Django raises in our project when it doesn’t find the translation files (when clicking on the tab in django-admin) which is picked up by django-parler here

As previously mentioned I can add translations on a model with the se language without any problems and I can also get the values from the api, what I don’t understand is it seems like the language must be supported in Django in order to view/edit the fields in django-admin when the content of the fields are the only parts that has changed (at least in our project)

1reaction
theguy159commented, Jan 11, 2019

I am also running into the same problem when I try to use languages that django doesn’t have translation files for.

If I add the language in LANGUAGES in settings I am able to save all of the translated fields of a model using switch_language from a management command.

I am also able to get the translated value from a DRF endpoint without problem.

But if I click on a tab of a language that django doesn’t have translation files for in django-admin I get:

ValueError: Translatable forms can't be initialized for the language 'se', that option does not exist in the 'LANGUAGES' setting.

And because of that I can’t edit the translations (or add new ones) in django-admin after I’ve originally imported them.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Supported language codes - IBM
You use language codes to set the locale that is associated with the language and regional settings on the documents that are processed...
Read more >
Supported languages and language codes - Amazon Translate
Supported languages and language codes ; Chinese (Traditional), zh-TW ; Croatian, hr ; Czech, cs ; Danish, da.
Read more >
ISO 639-2 Language Code List - Library of Congress
ISO 639‑2 Code ISO 639‑1 Code German name of Language aar aa Danakil‑Sprache abk ab Abchasisch ace Aceh‑Sprache
Read more >
Supported languages
Supported languages · Arabic — ar · Catalan — ca · Chinese, simplified — zh_CN · Chinese, traditional — zh_TW · Croatian —...
Read more >
ISO 639-1 Language Code List - Localizely
ISO Code Language Text Direction aa Afar Left‑to‑Right ab Abkhazian Left‑to‑Right ae Avestan Left‑to‑Right
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found