0

我正在尝试将(库尔德语)语言添加到我的 django 应用程序,但settings.LANGUAGES不支持库尔德语(ku)代码,我还尝试使用在其语言网站列表中包含库尔德语的 Rosetta(ROSETTA_LANGUAGES),但它也没有显示在我的模板中

            <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                  languages
                </a>
                <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
                    {% get_current_language as LANGUAGE_CODE %}
                    {% get_available_languages as LANGUAGES %}
                    {% get_language_info_list for LANGUAGES  as languages %}
                    {% for lang in languages %}
                    <li>                        
                        <a class="dropdown-item" href="/{{lang.code}}/"> {{lang.name_local}}</a>
                    </li>
                    {% endfor %}

                </ul>
              </li>

这是我的 settings.py

from django.conf import global_settings
import django.conf.locale
from django.utils.translation import gettext_lazy as _
LANGUAGE_CODE = 'ku'

#ROSETTA_LANGUAGES = (
#   ('en',_('english')),
#   ('ar',_('arabic')),
#   ('ku',_('kurdish'))
#)

LANGUAGES = (
   ('en',_('english')),
   ('ar',_('arabic')),
   ('ku',_('kurdish'))
)

ROSETTA_WSGI_AUTO_RELOAD = True

EXTRA_LANG_INFO = {
    'ku': {
       'bidi': True, # right-to-left
       'code': 'ku',
       'name': 'Kurdish',
       'name_local': u'\u0626\u06C7\u064A\u063A\u06C7\u0631 \u062A\u0649\u0644\u0649', 

LANG_INFO = dict(django.conf.locale.LANG_INFO, **EXTRA_LANG_INFO)
django.conf.locale.LANG_INFO = LANG_INFO

# Languages using BiDi (right-to-left) layout
LANGUAGES_BIDI = global_settings.LANGUAGES_BIDI + ["ku","kurdish"]

LOCALE_PATHS = (
   os.path.join(BASE_DIR,'locale/'),
)

请问我还有什么需要添加到设置中的吗?提前致谢 ..

4

0 回答 0