Пример #1
0
def get_language_info(lang_code):
    from django.conf.locale import LANG_INFO
    # Add custom languages
    LANG_INFO.update(
        {
            'tlh': {
                'bidi': False,
                'code': 'tlh',
                'name': 'Klingon',
                'name_local': u'tlhIngan Hol',# \uf8e4\uf8d7\uf8dc\uf8db \uf8d6\uf8dd\uf8d9',
            },
            'cs-cz': {
                'bidi': False,
                'code': 'cs',
                'name': 'Czech',
                'name_local': u'\u010desky (\u010cesk\xe1 republika)',
            },
        }
    )

    try:
        return LANG_INFO[lang_code]
    except KeyError:
        raise KeyError("Unknown language code %r." % lang_code)
Пример #2
0
# =============================================================================
# Generic Django project settings
# =============================================================================

DEBUG = True

SITE_ID = 1
# Add languages we're missing from Django
LANG_INFO.update({
    'am-et': {
        'bidi': False,
        'name': 'Amharic',
        'code': 'am-et',
        'name_local': 'አማርኛ'
    },
    'zh': {
        'bidi': False,
        'code': 'zh',
        'name': 'Chinese',
        'name_local': '简体中文',
    },
})
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
TIME_ZONE = 'UTC'
USE_TZ = True
USE_I18N = False
USE_L10N = True
LANGUAGE_CODE = 'en'
LANGUAGES = (
    ('am-et', 'Amharic'),
Пример #3
0
LANG_INFO.update({
    'am': {
        'bidi': False,
        'name': 'Amharic',
        'code': 'am',
        'name_local': u'አማርኛ'
    },
    'bm': {
        'bidi': False,
        'name': 'Bambara',
        'code': 'bm',
        'name_local': 'Bambara'
    },
    'ckb': {
        'bidi': True,
        'name': 'Soranî',
        'code': 'ckb',
        'name_local': 'سۆرانی',
    },
    'ku': {
        'bidi': False,
        'name': 'Kurdish',
        'code': 'ku',
        'name_local': 'Kurdî'
    },
    'ln': {
        'bidi': False,
        'name': 'Lingala',
        'code': 'ln',
        'name_local': 'Lingála'
    },
    'ps': {
        'bidi': True,
        'name': 'Pashto',
        'code': 'ps',
        'name_local': 'پښتو'
    },
    'rn': {
        'bidi': False,
        'name': 'Kirundi',
        'code': 'rn',
        'name_local': 'kirundi'
    },
    'so': {
        'bidi': False,
        'name': 'Somali',
        'code': 'so',
        'name_local': u'Af-Soomaali'
    },
    'ti': {
        'bidi': False,
        'name': 'Tigrinya',
        'code': 'bm',
        'name_local': 'ትግርኛ'
    },
    'wo': {
        'bidi': False,
        'name': 'Wolof',
        'code': 'wo',
        'name_local': 'wolof'
    },
})
Пример #4
0
    SETTINGS_MODULE = sub.__name__
    sys.stdout.write('Importing settings from %s\n' % SETTINGS_MODULE)
    ldict = locals()
    for k in sub.__dict__:
        if k.isupper() and not k.startswith('__') or not k.endswith('__'):
            ldict[k] = sub.__dict__[k]
    USER_DATA_FIELDS = []
    for section, fields in USER_FORM_FIELDS:  # noqa
        USER_DATA_FIELDS.extend(fields)

    # Allow server settings to only define STORAGE_ROOT without needing to
    # redefine all ROOTS like settings.
    BACKUPED_ROOT = ldict.get('BACKUPED_ROOT') or os.path.join(STORAGE_ROOT, 'main')  # noqa
    MEDIA_ROOT = ldict.get('MEDIA_ROOT') or os.path.join(BACKUPED_ROOT, 'media')  # noqa
    STATIC_ROOT = ldict.get('STATIC_ROOT') or os.path.join(STORAGE_ROOT, 'static')  # noqa
    if not getattr(ldict, 'DATABASES', None):
        DATABASES = {
            'default': {
                'ENGINE': 'django.db.backends.sqlite3',
                'NAME': os.path.join(BACKUPED_ROOT, 'default.sqlite'),
            },
        }
    LANGUAGES = []
    # Allow to override AVAILABLE_LANGUAGES in box settings, without needing
    # to override also LANGUAGES.
    for code, label in ldict.get('AVAILABLE_LANGUAGES'):
        LANGUAGES.append((code, label))
    # Some languages are missing from Django.
    from django.conf.locale import LANG_INFO
    LANG_INFO.update(EXTRA_LANG_INFO)  # noqa
Пример #5
0
    for k in sub.__dict__:
        if k.isupper() and not k.startswith('__') or not k.endswith('__'):
            ldict[k] = sub.__dict__[k]
    USER_DATA_FIELDS = []
    for section, fields in USER_FORM_FIELDS:  # noqa
        USER_DATA_FIELDS.extend(fields)

    # Allow server settings to only define STORAGE_ROOT without needing to
    # redefine all ROOTS like settings.
    BACKUPED_ROOT = ldict.get('BACKUPED_ROOT') or os.path.join(
        STORAGE_ROOT, 'main')  # noqa
    MEDIA_ROOT = ldict.get('MEDIA_ROOT') or os.path.join(
        BACKUPED_ROOT, 'media')  # noqa
    STATIC_ROOT = ldict.get('STATIC_ROOT') or os.path.join(
        STORAGE_ROOT, 'static')  # noqa
    if not getattr(ldict, 'DATABASES', None):
        DATABASES = {
            'default': {
                'ENGINE': 'django.db.backends.sqlite3',
                'NAME': os.path.join(BACKUPED_ROOT, 'default.sqlite'),
            },
        }
    LANGUAGES = []
    # Allow to override AVAILABLE_LANGUAGES in box settings, without needing
    # to override also LANGUAGES.
    for code, label in ldict.get('AVAILABLE_LANGUAGES'):
        LANGUAGES.append((code, label))
    # Some languages are missing from Django.
    from django.conf.locale import LANG_INFO
    LANG_INFO.update(EXTRA_LANG_INFO)  # noqa
Пример #6
0
LANG_INFO.update({
    '411': {
        'code': '411',
        'name_local': _('Suitable for all languages'),
    },
    'am': {
        'bidi': False,
        'name': 'Amharic',
        'code': 'am',
        'name_local': u'አማርኛ'
    },
    'bm': {
        'bidi': False,
        'name': 'Bambara',
        'code': 'bm',
        'name_local': 'Bambara'
    },
    'ckb': {
        'bidi': True,
        'name': 'Soranî',
        'code': 'ckb',
        'name_local': 'سۆرانی',
    },
    'fa-ir': {
        'bidi': True,
        'name': 'Persian',
        'code': 'fa-ir',
        'name_local': 'فارسی',
    },
    'kg': {
        'bidi': False,
        'name': 'Kongo',
        'code': 'kg',
        'name_local': 'Kikongo',
    },
    'ku': {
        'bidi': False,
        'name': 'Kurdish',
        'code': 'ku',
        'name_local': 'Kurdî'
    },
    'ln': {
        'bidi': False,
        'name': 'Lingala',
        'code': 'ln',
        'name_local': 'Lingála'
    },
    'lua': {
        'bidi': False,
        'name': 'Luba-Lulua',
        'code': 'lua',
        'name_local': 'Tshiluba',
    },
    'ps': {
        'bidi': True,
        'name': 'Pashto',
        'code': 'ps',
        'name_local': 'پښتو'
    },
    'rn': {
        'bidi': False,
        'name': 'Kirundi',
        'code': 'rn',
        'name_local': 'kirundi'
    },
    'so': {
        'bidi': False,
        'name': 'Somali',
        'code': 'so',
        'name_local': u'Af-Soomaali'
    },
    'ti': {
        'bidi': False,
        'name': 'Tigrinya',
        'code': 'bm',
        'name_local': 'ትግርኛ'
    },
    'wo': {
        'bidi': False,
        'name': 'Wolof',
        'code': 'wo',
        'name_local': 'wolof'
    },
    'my-mm': {
        'bidi': True,
        'name': 'Burmese',
        'code': 'my-mm',
        'name_local': 'မြန်မာဘာသာ ',
    },
})