Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial languages, ready for dark-launch #2388

Merged
merged 7 commits into from
Feb 3, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ codekit-config.json

### Internationalization artifacts
*.mo
*.po
!django.po
!django.mo
!djangojs.po
!djangojs.mo
conf/locale/en/LC_MESSAGES/*.po
!messages.po
### Remove when we have real Esperanto translations. For now, ignore
### dummy Esperanto files.
conf/locale/eo/*
## Remove when we officially support these languages.
conf/locale/fr
conf/locale/ko_KR
conf/locale/en/LC_MESSAGES/*.mo
conf/locale/messages.mo

### Testing artifacts
.testids/
Expand Down
6 changes: 3 additions & 3 deletions .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ source_file = conf/locale/en/LC_MESSAGES/django-studio.po
source_lang = en
type = PO

[edx-platform.djangojs]
file_filter = conf/locale/<lang>/LC_MESSAGES/djangojs.po
source_file = conf/locale/en/LC_MESSAGES/djangojs.po
[edx-platform.djangojs-partial]
file_filter = conf/locale/<lang>/LC_MESSAGES/djangojs-partial.po
source_file = conf/locale/en/LC_MESSAGES/djangojs-partial.po
source_lang = en
type = PO

Expand Down
6 changes: 2 additions & 4 deletions cms/envs/common.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
"""
This is the common settings file, intended to set sane defaults. If you have a
piece of configuration that's dependent on a set of feature flags being set,
Expand Down Expand Up @@ -254,10 +255,7 @@
TIME_ZONE = 'America/New_York' # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
LANGUAGE_CODE = 'en' # http://www.i18nguy.com/unicode/language-identifiers.html

LANGUAGES = (
('eo', 'Esperanto'),
)

LANGUAGES = lms.envs.common.LANGUAGES
USE_I18N = True
USE_L10N = True

Expand Down
2 changes: 1 addition & 1 deletion common/djangoapps/dark_lang/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def _is_released(self, lang_code):
"""
``True`` iff one of the values in ``self.released_langs`` is a prefix of ``lang_code``.
"""
return any(lang_code.startswith(released_lang) for released_lang in self.released_langs)
return any(lang_code.lower().startswith(released_lang.lower()) for released_lang in self.released_langs)

def _format_accept_value(self, lang, priority=1.0):
"""
Expand Down
19 changes: 18 additions & 1 deletion common/djangoapps/dark_lang/tests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""
Tests of DarkLangMiddleware
"""

from django.contrib.auth.models import User
from django.http import HttpRequest

Expand Down Expand Up @@ -122,6 +121,24 @@ def test_accept_released_territory(self):
self.process_request(accept='rel-ter;q=1.0, rel;q=0.5')
)

def test_accept_mixed_case(self):
self.assertAcceptEquals(
'rel-TER;q=1.0, REL;q=0.5',
self.process_request(accept='rel-TER;q=1.0, REL;q=0.5')
)

DarkLangConfig(
released_languages=('REL-TER'),
changed_by=self.user,
enabled=True
).save()

self.assertAcceptEquals(
'rel-ter;q=1.0',
self.process_request(accept='rel-ter;q=1.0, rel;q=0.5')
)


def assertSessionLangEquals(self, value, request):
"""
Assert that the 'django_language' set in request.session is equal to value
Expand Down
Binary file added conf/locale/ach/LC_MESSAGES/django.mo
Binary file not shown.
Loading