-
-
Notifications
You must be signed in to change notification settings - Fork 214
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
JavaScript Translations #9576
JavaScript Translations #9576
Conversation
@dimagi/team-commcare-hq when this is merged, you'll need to run |
@@ -159,7 +161,7 @@ function CommcareSettings(options) { | |||
uniqueNames = names.filter(function(elem, pos) { | |||
return names.indexOf(elem) == pos; | |||
}) | |||
return 'Auto-set by ' + uniqueNames.join(', ') | |||
return gettext('Auto-set by ') + uniqueNames.join(', ') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon.
cool! does this work the same way that |
amazing!! 😍 much needed. is there a way we can smartly pull down just the translations that we need? or will we have to pull down the entire file each time? i imagine that those files could be pretty hefty over time |
awesome!! 🇫🇷 🇪🇸 🇮🇹 |
Awesome, @biyeun!! This is a huge piece in giving us the freedom to decouple our templates and JS however we want, instead of being forced to put some things in django templates just to be able to use translations! 🌟 |
this is great! also, looks good to merge. |
Was there a reason you chose to use this lib vs django's builtin support: https://docs.djangoproject.com/en/1.7/topics/i18n/translation/#internationalization-in-javascript-code |
@snopoke this library has a management command which generates the js translation file and places it in the staticfiles directory. Django's built in support is still there for the translation part, but the way it serves the file it's generated on a per request basis, unless you cache the request. |
@proteusvacuum it does work the same as ugettext https://docs.djangoproject.com/en/1.7/topics/i18n/translation/#internationalization-in-javascript-code |
sweetness! |
I think there is a way to, but we'd have to spin off a separate thing from |
gotcha makes sense. thanks On Tue, Dec 15, 2015 at 7:53 PM, Biyeun notifications@github.com wrote:
|
🌏 🌍 🌎 |
|
|
@dimagi/js-team Added ability to translate javascript files. In order for django to pick up on changes,
./manage.py makemessages -d djangojs --all
will need to be run in addition to the standardmakemessages
command.compilemessages
should be run as normal.In addition to this, you'll need to run
./manage.py compilejsi18n
to make the translation utilities available in all js files.