зеркало из https://github.com/mozilla/kitsune.git
[bug 624459] Trim down languages.json and add iso639_1 attribute (used in customercare app).
This commit is contained in:
Родитель
e302c1cfd4
Коммит
af7e88f813
|
@ -63,7 +63,7 @@ class ImageForm(forms.ModelForm):
|
|||
max_length=settings.MAX_FILENAME_LENGTH)
|
||||
locale = forms.ChoiceField(
|
||||
label=_lazy(u'Locale'),
|
||||
choices=[(LOCALES[k].external, LOCALES[k].native) for
|
||||
choices=[(k, LOCALES[k].native) for
|
||||
k in settings.SUMO_LANGUAGES],
|
||||
initial=settings.WIKI_DEFAULT_LANGUAGE)
|
||||
title = StrippedCharField(
|
||||
|
@ -143,7 +143,7 @@ class VideoForm(forms.ModelForm):
|
|||
max_length=settings.MAX_FILENAME_LENGTH)
|
||||
locale = forms.ChoiceField(
|
||||
label=_lazy(u'Locale'),
|
||||
choices=[(LOCALES[k].external, LOCALES[k].native) for
|
||||
choices=[(k, LOCALES[k].native) for
|
||||
k in settings.SUMO_LANGUAGES],
|
||||
initial=settings.WIKI_DEFAULT_LANGUAGE)
|
||||
title = StrippedCharField(
|
||||
|
|
|
@ -13,7 +13,7 @@ from sumo_locales import LOCALES
|
|||
from wiki.models import CATEGORIES, FIREFOX_VERSIONS, OPERATING_SYSTEMS
|
||||
|
||||
|
||||
SEARCH_LANGUAGES = [(LOCALES[k].external, LOCALES[k].native) for
|
||||
SEARCH_LANGUAGES = [(k, LOCALES[k].native) for
|
||||
k in settings.SUMO_LANGUAGES]
|
||||
|
||||
|
||||
|
|
|
@ -59,4 +59,4 @@ def locale_or_default(locale):
|
|||
|
||||
def sphinx_locale(locale):
|
||||
"""Given a locale string like 'en-US', return a Sphinx-ready locale."""
|
||||
return crc32(LOCALES[locale].internal)
|
||||
return crc32(locale)
|
||||
|
|
1246
lib/languages.json
1246
lib/languages.json
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -2,8 +2,7 @@ from collections import namedtuple
|
|||
import json
|
||||
import os
|
||||
|
||||
Language = namedtuple(u'Language',
|
||||
u'external internal english native dictionary')
|
||||
Language = namedtuple(u'Language', u'english native iso639_1')
|
||||
|
||||
file = os.path.join(os.path.dirname(__file__), 'languages.json')
|
||||
locales = json.loads(open(file, 'r').read())
|
||||
|
@ -11,8 +10,5 @@ locales = json.loads(open(file, 'r').read())
|
|||
LOCALES = {}
|
||||
|
||||
for k in locales:
|
||||
LOCALES[k] = Language(locales[k]['external'], locales[k]['internal'],
|
||||
locales[k]['English'], locales[k]['native'],
|
||||
locales[k]['dictionary'])
|
||||
|
||||
INTERNAL_MAP = dict([(LOCALES[k].internal, k) for k in LOCALES])
|
||||
LOCALES[k] = Language(locales[k]['english'], locales[k]['native'],
|
||||
locales[k]['iso639_1'])
|
||||
|
|
Загрузка…
Ссылка в новой задаче