如何在django3中添加新语言

nuypyhwy  于 2023-01-27  发布在  Go
关注(0)|答案(1)|浏览(110)

我想添加新的语言。它是土库曼(tm)我花了很多时间,但我不能解决它请帮我解决它

PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
LOCALE_PATHS = (
    os.path.join(BASE_DIR, 'locale'),
)
gettext = lambda s:s
LANGUAGES = (
    ('ru', gettext('Russia')),
    ('tm', gettext('Turkmen')),
)
EXTRA_LANG_INFO = {
    'tm': {
        'bidi': False,
        'code': 'tm',
        'name': 'Turkmen',
        'name_local': u"Turkmence",
    },
}
import django.conf.locale
from django.conf import global_settings
import django.conf.locale
LANG_INFO = dict(django.conf.locale.LANG_INFO, **EXTRA_LANG_INFO)
django.conf.locale.LANG_INFO = LANG_INFO
global_settings.LANGUAGES = global_settings.LANGUAGES + [("tm", 'Turkmenche')]
a11xaf1n

a11xaf1n1#

1.安装获取文本
django-管理员创建消息-l tm
django-admin编译消息

相关问题