Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[bug 952642] Add django-statici18n to project.

I had to convert settings.LANGUAGES to a tuple as django
expects/wants and created LANGUAGES_DICT to replace it.
  • Loading branch information...
commit bb7ef6ca9a481240ba2cbac4ffae18a35ab80650 1 parent ef23c43
@rlr rlr authored
View
2  kitsune/gallery/templates/gallery/confirm_media_delete.html
@@ -51,7 +51,7 @@
<ul id="media-meta" class="cf">
<li class="creator">{{ _('by {user}')|f(user=media.creator) }}</li>
<li class="created">{{ _('Uploaded {date}')|fe(date=datetimeformat(media.created, format='datetime')) }}</li>
- <li class="locale">{{ settings.LANGUAGES[media.locale.lower()] }}</li>
+ <li class="locale">{{ settings.LANGUAGES_DICT[media.locale.lower()] }}</li>
</ul>
{% if media_type == 'video' %}
<ul class="cf">
View
2  kitsune/gallery/templates/gallery/media.html
@@ -58,7 +58,7 @@
user=media.creator) }}
</li>
<li class="created">{{ _('Uploaded {date}')|fe(date=datetimeformat(media.created, format='datetime')) }}</li>
- <li class="locale">{{ settings.LANGUAGES[media.locale.lower()] }}</li>
+ <li class="locale">{{ settings.LANGUAGES_DICT[media.locale.lower()] }}</li>
</ul>
</div>
<div id="media-view">
View
2  kitsune/offline/utils.py
@@ -98,7 +98,7 @@ def bundle_for_product(product, locale):
bundle['locales'] = {}
bundle['locales'][locale] = {
'key': locale,
- 'name': settings.LANGUAGES[locale.lower()],
+ 'name': settings.LANGUAGES_DICT[locale.lower()],
'products': [{'slug': product.slug, 'name': product.title}]
}
View
2  kitsune/offline/views.py
@@ -22,7 +22,7 @@ def get_bundle(request):
locale = request.GET['locale']
product = request.GET['product']
- if locale.lower() not in settings.LANGUAGES:
+ if locale.lower() not in settings.LANGUAGES_DICT:
return HttpResponseNotFound(INVALID_LOCALE,
mimetype='application/json')
View
4 kitsune/questions/templates/questions/answers.html
@@ -236,10 +236,10 @@ <h2 class="summary">{{ question.title }}</h2>
{% if user and user.has_perm('questions.change_question') %}
<div class="sidebox tight condensed" id="question-locale">
<span class="title">{{ _('Locale') }}</span>
- <span class="detail">{{ settings.LANGUAGES[question.locale.lower()] }}</span>
+ <span class="detail">{{ settings.LANGUAGES_DICT[question.locale.lower()] }}</span>
<select name="locale">
{% for lang in settings.AAQ_LANGUAGES %}
- <option {% if question.locale == lang %}selected="selected"{% endif %} value="{{ lang }}">{{ settings.LANGUAGES[lang.lower()] }}</option>
+ <option {% if question.locale == lang %}selected="selected"{% endif %} value="{{ lang }}">{{ settings.LANGUAGES_DICT[lang.lower()] }}</option>
{% endfor %}
</select>
</div>
View
4 kitsune/questions/views.py
@@ -420,8 +420,8 @@ def aaq(request, product_key=None, category_key=None, showform=False,
locale, path = split_path(request.path)
path = '/' + settings.WIKI_DEFAULT_LANGUAGE + '/' + path
- old_lang = settings.LANGUAGES[request.LANGUAGE_CODE.lower()]
- new_lang = settings.LANGUAGES[settings.WIKI_DEFAULT_LANGUAGE.lower()]
+ old_lang = settings.LANGUAGES_DICT[request.LANGUAGE_CODE.lower()]
+ new_lang = settings.LANGUAGES_DICT[settings.WIKI_DEFAULT_LANGUAGE.lower()]
msg = (_(u"The questions forum isn't available in {old_lang}, we "
u"have redirected you to the {new_lang} questions forum.")
.format(old_lang=old_lang, new_lang=new_lang))
View
4 kitsune/search/views.py
@@ -127,8 +127,8 @@ def search(request, template=None):
offset = (page - 1) * settings.SEARCH_RESULTS_PER_PAGE
lang = language.lower()
- if settings.LANGUAGES.get(lang):
- lang_name = settings.LANGUAGES[lang]
+ if settings.LANGUAGES_DICT.get(lang):
+ lang_name = settings.LANGUAGES_DICT[lang]
else:
lang_name = ''
View
7 kitsune/settings.py
@@ -209,7 +209,8 @@
LANGUAGE_CHOICES = tuple(
[(lang, LOCALES[lang].native) for lang in SUMO_LANGUAGES
if lang != 'xx'])
-LANGUAGES = dict([(i.lower(), LOCALES[i].native) for i in SUMO_LANGUAGES])
+LANGUAGES_DICT = dict([(i.lower(), LOCALES[i].native) for i in SUMO_LANGUAGES])
+LANGUAGES = LANGUAGES_DICT.items()
LANGUAGE_URL_MAP = dict([(i.lower(), i) for i in SUMO_LANGUAGES])
@@ -538,6 +539,7 @@
'kitsune.offline',
'kitsune.products',
'rest_framework',
+ 'statici18n',
# App for Sentry:
'raven.contrib.django',
@@ -624,6 +626,9 @@ def JINJA_CONFIG():
'javascript',
]
+STATICI18N_DOMAIN = 'javascript'
+STATICI18N_PACKAGES = ['kitsune.sumo']
+
# If you have trouble extracting strings with Tower, try setting this
# to True
TOWER_ADD_HEADERS = True
View
2  kitsune/sumo/templates/base.html
@@ -135,7 +135,7 @@
{% set locale_url = locale_url|urlparams(next=localizable_url) %}
{% endif %}
{% if not hide_locale_switcher %}
- <li><a href="{{ locale_url }}" class="locale-picker">{{ settings.LANGUAGES[request.LANGUAGE_CODE.lower()] }}</a></li>
+ <li><a href="{{ locale_url }}" class="locale-picker">{{ settings.LANGUAGES_DICT[request.LANGUAGE_CODE.lower()] }}</a></li>
{% endif %}
</ul>
</nav>
View
4 kitsune/users/templates/users/documents_contributed.html
@@ -20,7 +20,7 @@ <h1 class="user">{{ display_name(profile.user) }}
<h1>{{ _('Documents edited or translated') }}</h1>
{% for group in documents|groupby('locale') %}
{% if loop.first %}<ul>{% endif %}
- <li>[{{ group.grouper }}] {{ settings.LANGUAGES[group.grouper.lower()] }} ({{ group.list|length }})<ul>
+ <li>[{{ group.grouper }}] {{ settings.LANGUAGES_DICT[group.grouper.lower()] }} ({{ group.list|length }})<ul>
{% for d in group.list %}
<li>
<a href="{{ d.get_absolute_url() }}">
@@ -32,7 +32,7 @@ <h1 class="user">{{ display_name(profile.user) }}
{% endfor %}
{% for group in redirects|groupby('locale') %}
{% if loop.first %}<h1>{{ _('Redirects') }}</h1><ul>{% endif %}
- <li>[{{ group.grouper }}] {{ settings.LANGUAGES[group.grouper.lower()] }} ({{ group.list|length }})<ul>
+ <li>[{{ group.grouper }}] {{ settings.LANGUAGES_DICT[group.grouper.lower()] }} ({{ group.list|length }})<ul>
{% for d in group.list %}
<li>
<a href="{{ d.get_absolute_url() }}">
View
2  kitsune/wiki/models.py
@@ -308,7 +308,7 @@ def content_parsed(self):
@property
def language(self):
- return settings.LANGUAGES[self.locale.lower()]
+ return settings.LANGUAGES_DICT[self.locale.lower()]
@property
def is_hidden_from_search_engines(self):
View
2  kitsune/wiki/templates/wiki/locale_list.html
@@ -11,7 +11,7 @@
{% for locale in locales %}
<li>
<a href="{{ url('wiki.locale_details', locale.locale) }}">
- [{{ locale.locale }}] {{ settings.LANGUAGES[locale.locale.lower()] }}
+ [{{ locale.locale }}] {{ settings.LANGUAGES_DICT[locale.locale.lower()] }}
</a>
</li>
{% endfor %}
View
8 kitsune/wiki/templates/wiki/review_translation.html
@@ -10,7 +10,7 @@
<div class="grid_9">
<article id="review-revision">
<h1>{{ _('Review Translation of {title}')|f(title=document.parent.title) }}</h1>
- <p>{{ _('Reviewing Translation {id} in {language} by {user}')|f(id=revision.id, user=revision.creator, language=settings.LANGUAGES[document.locale.lower()]) }}.
+ <p>{{ _('Reviewing Translation {id} in {language} by {user}')|f(id=revision.id, user=revision.creator, language=settings.LANGUAGES_DICT[document.locale.lower()]) }}.
<a href="{{ url('wiki.document_revisions', document.slug) }}">{{ _('Back to History') }}</a></p>
{% if revision.reviewed %}
@@ -36,17 +36,17 @@
<summary>{{ _('Full Article Sources') }}</summary>
{% if not parent_revision %}
<div class="warning-box">
- {{ _('The {default_locale} version has no approved content to show.')|f(default_locale=settings.LANGUAGES[settings.WIKI_DEFAULT_LANGUAGE.lower()]) }}
+ {{ _('The {default_locale} version has no approved content to show.')|f(default_locale=settings.LANGUAGES_DICT[settings.WIKI_DEFAULT_LANGUAGE.lower()]) }}
</div>
{% else %}
{# Default vs. current locale #}
<div id="content-fields" class="revision-diff">
<div class="approved">
- <h3>{{ _('Approved {default_locale} version:')|f(default_locale=settings.LANGUAGES[settings.WIKI_DEFAULT_LANGUAGE.lower()]) }}</h3>
+ <h3>{{ _('Approved {default_locale} version:')|f(default_locale=settings.LANGUAGES_DICT[settings.WIKI_DEFAULT_LANGUAGE.lower()]) }}</h3>
<p>{{ _('Revision {id} by {user} on {date}')|fe(id=parent_revision.id, user=parent_revision.creator, date=datetimeformat(parent_revision.created, format='longdatetime')) }}</p>
</div>
<div class="localized">
- <h3>{{ _('Submitted {locale} translation:')|f(locale=settings.LANGUAGES[document.locale.lower()]) }}</h3>
+ <h3>{{ _('Submitted {locale} translation:')|f(locale=settings.LANGUAGES_DICT[document.locale.lower()]) }}</h3>
<p>{{ _('Revision {id} by {user} on {date}')|fe(id=revision.id, user=revision.creator, date=datetimeformat(revision.created, format='longdatetime')) }}</p>
</div>
<h4>{{ _('Keywords:') }}</h4>
View
4 kitsune/wiki/templates/wiki/translate.html
@@ -12,7 +12,7 @@
{% set scripts = ('wiki', 'wiki.diff', 'wiki.editor', 'libs/jqueryui') %}
{% block content %}
- {% set language = settings.LANGUAGES[locale.lower()] %}
+ {% set language = settings.LANGUAGES_DICT[locale.lower()] %}
<div>
{{ document_tools(document, parent, user, 'edit', settings) }}
@@ -169,7 +169,7 @@
</ul>
<div id="content-fields">
<div class="approved">
- <h3>{{ _('Approved {default_locale} version:')|f(default_locale=settings.LANGUAGES[settings.WIKI_DEFAULT_LANGUAGE.lower()]) }}</h3>
+ <h3>{{ _('Approved {default_locale} version:')|f(default_locale=settings.LANGUAGES_DICT[settings.WIKI_DEFAULT_LANGUAGE.lower()]) }}</h3>
<div id="content-or-diff" class="content">
<textarea readonly="readonly">{{ based_on.content }}</textarea>
</div>
Please sign in to comment.
Something went wrong with that request. Please try again.