EDUCATOR-2584

This commit is contained in:
Eric Fischer
2018-03-27 12:00:33 -04:00
parent e30e12e83d
commit 022001e53d
3 changed files with 27 additions and 20 deletions

View File

@@ -2,9 +2,13 @@
Contains code that gets run inside our mako template
Debugging python-in-mako is terrible, so we've moved the actual code out to its own file
"""
import logging
from django.conf import settings
from django.utils.translation import to_locale
log = logging.getLogger(__name__)
def load_sfe_i18n_messages(language):
"""
@@ -12,13 +16,16 @@ def load_sfe_i18n_messages(language):
"""
messages = "{}"
if language != 'en':
# because en is the default, studio-frontend will have it loaded by default
messages_path = "{base}/studio-frontend/dist/i18n/messages/{locale}.json".format(
base=settings.STATIC_ROOT_BASE,
locale=to_locale(language)
)
with open(messages_path) as inputfile:
messages = inputfile.read()
try:
if language != 'en':
# because en is the default, studio-frontend will have it loaded by default
messages_path = "{base}/studio-frontend/dist/i18n/messages/{locale}.json".format(
base=settings.STATIC_ROOT_BASE,
locale=to_locale(language)
)
with open(messages_path) as inputfile:
messages = inputfile.read()
except: # pylint: disable=bare-except
log.error("Error loading studiofrontend language files", exc_info=True)
return messages

22
package-lock.json generated
View File

@@ -38,9 +38,9 @@
}
},
"@edx/studio-frontend": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/@edx/studio-frontend/-/studio-frontend-1.6.1.tgz",
"integrity": "sha512-wKGviL50hnTmPIZIaXdkzVTdNdFFVtiwpv2NpoR968NzZDuL/1Nbh/GY13QlEQqSSzieTVTIIAgBBXyTUDJ6zQ==",
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/@edx/studio-frontend/-/studio-frontend-1.6.2.tgz",
"integrity": "sha512-y/QHYyO8QMyUlORFnBU1f+ppI8XitGsgXiwuvORxJrCcwiMwp3x3qXSs2Jp2DAPCOnFZuMZssasdBTtvbK5XJA==",
"requires": {
"@edx/edx-bootstrap": "0.4.3",
"@edx/paragon": "2.4.1",
@@ -84,14 +84,6 @@
"react-proptype-conditional-require": "1.0.4"
}
},
"email-prop-type": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/email-prop-type/-/email-prop-type-1.1.5.tgz",
"integrity": "sha512-I7RYQE3EGDh3GXdBICtx/zKn21720xxW2UGD4y5Pg8zAFoNjtFdh5fHDrHL/xmICiuobMdpXywfV8/FN1rCdQA==",
"requires": {
"email-validator": "1.1.1"
}
},
"react": {
"version": "16.2.0",
"resolved": "https://registry.npmjs.org/react/-/react-16.2.0.tgz",
@@ -2786,6 +2778,14 @@
"minimalistic-crypto-utils": "1.0.1"
}
},
"email-prop-type": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/email-prop-type/-/email-prop-type-1.1.5.tgz",
"integrity": "sha512-I7RYQE3EGDh3GXdBICtx/zKn21720xxW2UGD4y5Pg8zAFoNjtFdh5fHDrHL/xmICiuobMdpXywfV8/FN1rCdQA==",
"requires": {
"email-validator": "1.1.1"
}
},
"email-validator": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/email-validator/-/email-validator-1.1.1.tgz",

View File

@@ -4,7 +4,7 @@
"dependencies": {
"@edx/edx-bootstrap": "0.4.3",
"@edx/paragon": "1.7.1",
"@edx/studio-frontend": "1.6.1",
"@edx/studio-frontend": "1.6.2",
"babel-core": "6.26.0",
"babel-loader": "6.4.1",
"babel-plugin-transform-class-properties": "6.24.1",