zoukankan      html  css  js  c++  java
  • django之全局默认设置查看及admin语言设置

    django之admin语言设置

      admin后台管理默认使用的是英文,有时我们需要将其设置成自己的语言以方便使用管理;

       将 LANGUAGE_CODE = '' 设置为欲设置的语言即可。

      以下为django源码中给定的语言可选项:

    # Languages we provide translations for, out of the box.
    LANGUAGES = [
        ('af', gettext_noop('Afrikaans')),
        ('ar', gettext_noop('Arabic')),
        ('ast', gettext_noop('Asturian')),
        ('az', gettext_noop('Azerbaijani')),
        ('bg', gettext_noop('Bulgarian')),
        ('be', gettext_noop('Belarusian')),
        ('bn', gettext_noop('Bengali')),
        ('br', gettext_noop('Breton')),
        ('bs', gettext_noop('Bosnian')),
        ('ca', gettext_noop('Catalan')),
        ('cs', gettext_noop('Czech')),
        ('cy', gettext_noop('Welsh')),
        ('da', gettext_noop('Danish')),
        ('de', gettext_noop('German')),
        ('dsb', gettext_noop('Lower Sorbian')),
        ('el', gettext_noop('Greek')),
        ('en', gettext_noop('English')),  # 英文
        ('en-au', gettext_noop('Australian English')),  # 澳大利亚英语
        ('en-gb', gettext_noop('British English')),  # 英国英语
        ('eo', gettext_noop('Esperanto')),
        ('es', gettext_noop('Spanish')),
        ('es-ar', gettext_noop('Argentinian Spanish')),
        ('es-co', gettext_noop('Colombian Spanish')),
        ('es-mx', gettext_noop('Mexican Spanish')),
        ('es-ni', gettext_noop('Nicaraguan Spanish')),
        ('es-ve', gettext_noop('Venezuelan Spanish')),
        ('et', gettext_noop('Estonian')),
        ('eu', gettext_noop('Basque')),
        ('fa', gettext_noop('Persian')),
        ('fi', gettext_noop('Finnish')),
        ('fr', gettext_noop('French')),
        ('fy', gettext_noop('Frisian')),
        ('ga', gettext_noop('Irish')),
        ('gd', gettext_noop('Scottish Gaelic')),
        ('gl', gettext_noop('Galician')),
        ('he', gettext_noop('Hebrew')),
        ('hi', gettext_noop('Hindi')),
        ('hr', gettext_noop('Croatian')),
        ('hsb', gettext_noop('Upper Sorbian')),
        ('hu', gettext_noop('Hungarian')),
        ('ia', gettext_noop('Interlingua')),
        ('id', gettext_noop('Indonesian')),
        ('io', gettext_noop('Ido')),
        ('is', gettext_noop('Icelandic')),
        ('it', gettext_noop('Italian')),
        ('ja', gettext_noop('Japanese')),
        ('ka', gettext_noop('Georgian')),
        ('kk', gettext_noop('Kazakh')),
        ('km', gettext_noop('Khmer')),
        ('kn', gettext_noop('Kannada')),
        ('ko', gettext_noop('Korean')),
        ('lb', gettext_noop('Luxembourgish')),
        ('lt', gettext_noop('Lithuanian')),
        ('lv', gettext_noop('Latvian')),
        ('mk', gettext_noop('Macedonian')),
        ('ml', gettext_noop('Malayalam')),
        ('mn', gettext_noop('Mongolian')),
        ('mr', gettext_noop('Marathi')),
        ('my', gettext_noop('Burmese')),
        ('nb', gettext_noop('Norwegian Bokmål')),
        ('ne', gettext_noop('Nepali')),
        ('nl', gettext_noop('Dutch')),
        ('nn', gettext_noop('Norwegian Nynorsk')),
        ('os', gettext_noop('Ossetic')),
        ('pa', gettext_noop('Punjabi')),
        ('pl', gettext_noop('Polish')),
        ('pt', gettext_noop('Portuguese')),
        ('pt-br', gettext_noop('Brazilian Portuguese')),
        ('ro', gettext_noop('Romanian')),
        ('ru', gettext_noop('Russian')),
        ('sk', gettext_noop('Slovak')),
        ('sl', gettext_noop('Slovenian')),
        ('sq', gettext_noop('Albanian')),
        ('sr', gettext_noop('Serbian')),
        ('sr-latn', gettext_noop('Serbian Latin')),
        ('sv', gettext_noop('Swedish')),
        ('sw', gettext_noop('Swahili')),
        ('ta', gettext_noop('Tamil')),
        ('te', gettext_noop('Telugu')),
        ('th', gettext_noop('Thai')),
        ('tr', gettext_noop('Turkish')),
        ('tt', gettext_noop('Tatar')),
        ('udm', gettext_noop('Udmurt')),
        ('uk', gettext_noop('Ukrainian')),
        ('ur', gettext_noop('Urdu')),
        ('vi', gettext_noop('Vietnamese')),
        ('zh-hans', gettext_noop('Simplified Chinese')),  # 简体中文
        ('zh-hant', gettext_noop('Traditional Chinese')),  # 繁体中文
    ]

      那么问题来了,如何进入到源码中看到这些配置项呢?

      其实很简答,在项目同名文件夹中的settings.py中配置如下代码即可进入:

    from django.conf import global_settings
  • 相关阅读:
    学习也可以有趣,喜欢上pandas,你该这么学!No.4
    Umbral:新型分散式密钥管理系统的代理重加密方案
    同态加密
    解决方案 | MySQL DBA主从复制出错怎么办?
    干货分享 | 史上最全Oracle体系结构整理
    点开,看一段,你就会喜欢上学习pandas,你该这么学!No.3
    mysql集群搭建(PXC)
    Centos7 离线安装mysql 5.6详细步骤
    tomcat别名配置多域名访问配置
    关于打印机状态的获取【转】
  • 原文地址:https://www.cnblogs.com/ZN-225/p/9995699.html
Copyright © 2011-2022 走看看