Commit fd1ac08a authored by Michal Čihař's avatar Michal Čihař

Allow to disable language code mappings

In some rare cases this causes troubles as few projects translate to
both fr and fr-FR.

Issue #437
parent c576de5c
......@@ -347,6 +347,18 @@ Enables self advertisement of Weblate in case there are no configured ads.
.. seealso:: :ref:`advertisement`
.. setting:: SIMPLIFY_LANGUAGES
SIMPLIFY_LANGUAGES
------------------
Use simple language codes for default language/country combinations. For
example ``fr_FR`` translation will use ``fr`` language code. This is usually
desired behavior as it simplifies listing of the languages for these default
combinations.
Disable this if you are having different translations for both variants.
.. setting:: SITE_TITLE
SITE_TITLE
......
......@@ -161,3 +161,6 @@ SOURCE_LANGUAGE = get('SOURCE_LANGUAGE', 'en')
# Self advertisement
SELF_ADVERTISEMENT = get('SELF_ADVERTISEMENT', False)
# Use simple language codes for default language/country combinations
SIMPLIFY_LANGUAGES = GET('SIMPLIFY_LANGUAGES', True)
......@@ -28,6 +28,7 @@ from weblate.trans.mixins import PercentMixin
from south.signals import post_migrate
from django.db.models.signals import post_syncdb
from django.dispatch import receiver
from weblate.appsettings import SIMPLIFY_LANGUAGES
import weblate
# Plural types definition
......@@ -166,7 +167,7 @@ class LanguageManager(models.Manager):
return ret
# Try canonical variant
if newcode in data.DEFAULT_LANGS:
if SIMPLIFY_LANGUAGES and newcode in data.DEFAULT_LANGS:
ret = self.try_get(lang.lower())
if ret is not None:
return ret
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment