diff --git a/.gitignore b/.gitignore index 8fb170c30f..e7b0b16be8 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,13 @@ cover_html/ chromedriver.log /nbproject ghostdriver.log +/cms/doc/en/getting_started/ +/conf/locale/en +/conf/locale/fr +create-dev-env.hack.sh +distribute-0.6.36.tar.gz +i18n/googleTranslate.hack.py +i18n/mitx/conf/locale/fr/LC_MESSAGES/django.po +i18n/split.py +.gitignore + diff --git a/cms/djangoapps/contentstore/tests/test_i18n.py b/cms/djangoapps/contentstore/tests/test_i18n.py new file mode 100644 index 0000000000..e6d68ba004 --- /dev/null +++ b/cms/djangoapps/contentstore/tests/test_i18n.py @@ -0,0 +1,97 @@ +from unittest import skip + +from django.core.urlresolvers import reverse +from django.contrib.auth.models import User +from django.test.client import Client + +from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase + +class InternationalizationTest(ModuleStoreTestCase): + """ + Tests to validate Internationalization. + """ + + def setUp(self): + """ + These tests need a user in the DB so that the django Test Client + can log them in. + They inherit from the ModuleStoreTestCase class so that the mongodb collection + will be cleared out before each test case execution and deleted + afterwards. + """ + self.uname = 'testuser' + self.email = 'test+courses@edx.org' + self.password = 'foo' + + # Create the use so we can log them in. + self.user = User.objects.create_user(self.uname, self.email, self.password) + + # Note that we do not actually need to do anything + # for registration if we directly mark them active. + self.user.is_active = True + # Staff has access to view all courses + self.user.is_staff = True + self.user.save() + + self.course_data = { + 'template': 'i4x://edx/templates/course/Empty', + 'org': 'MITx', + 'number': '999', + 'display_name': 'Robot Super Course', + } + + def test_course_plain_english(self): + """Test viewing the index page with no courses""" + self.client = Client() + self.client.login(username=self.uname, password=self.password) + + resp = self.client.get(reverse('index')) + self.assertContains(resp, + '
tar.gz extension.').show();
+ $('.error-block').html(gettext('File format not supported. Please upload a file with a tar.gz extension.')).show();
}
}
@@ -406,7 +406,7 @@ function showFileSelectionMenu(e) {
}
function startUpload(e) {
- $('.upload-modal h1').html('Uploading…');
+ $('.upload-modal h1').html(gettext('Uploading…'));
$('.upload-modal .file-name').html($('.file-input').val().replace('C:\\fakepath\\', ''));
$('.upload-modal .file-chooser').ajaxSubmit({
beforeSend: resetUploadBar,
@@ -439,7 +439,7 @@ function displayFinishedUpload(xhr) {
$('.upload-modal .embeddable').show();
$('.upload-modal .file-name').hide();
$('.upload-modal .progress-fill').html(resp.msg);
- $('.upload-modal .choose-file-button').html('Load Another File').show();
+ $('.upload-modal .choose-file-button').html(gettext('Load Another File')).show();
$('.upload-modal .progress-fill').width('100%');
// see if this id already exists, if so, then user must have updated an existing piece of content
@@ -500,11 +500,11 @@ function toggleSock(e) {
});
if($sock.hasClass('is-shown')) {
- $btnLabel.text('Hide Studio Help');
+ $btnLabel.text(gettext('Hide Studio Help'));
}
else {
- $btnLabel.text('Looking for Help with Studio?');
+ $btnLabel.text(gettext('Looking for Help with Studio?'));
}
}
@@ -845,7 +845,15 @@ function saveSetSectionScheduleDate(e) {
data: JSON.stringify({ 'id': id, 'metadata': {'start': start}})
}).success(function () {
var $thisSection = $('.courseware-section[data-id="' + id + '"]');
- $thisSection.find('.section-published-date').html('Will Release: ' + input_date + ' at ' + input_time + ' UTCEdit');
+ var format = gettext('Will Release: %(date)s at $(time)s UTC');
+ var willReleaseAt = interpolate(format, [input_date, input_time], true);
+ $thisSection.find('.section-published-date').html(
+ '' + willReleaseAt + '' +
+ '' +
+ gettext('Edit') + '');
$thisSection.find('.section-published-date').animate({
'background-color': 'rgb(182,37,104)'
}, 300).animate({
diff --git a/cms/templates/base.html b/cms/templates/base.html
index 4517790622..65e08b3cc5 100644
--- a/cms/templates/base.html
+++ b/cms/templates/base.html
@@ -30,6 +30,7 @@
<%include file="courseware_vendor_js.html"/>
+
diff --git a/cms/templates/index.html b/cms/templates/index.html
index 916720f4e7..0f6e982b1d 100644
--- a/cms/templates/index.html
+++ b/cms/templates/index.html
@@ -1,6 +1,8 @@
+<%! from django.utils.translation import ugettext as _ %>
+
<%inherit file="base.html" />
-<%block name="title">My Courses%block>
+<%block name="title">${_("My Courses")}%block>
<%block name="bodyclass">is-signedin index dashboard%block>
<%block name="header_extras">
@@ -36,18 +38,18 @@