-
Notifications
You must be signed in to change notification settings - Fork 6
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
Translations do not load properly when launching the minified version #16
Comments
There are 2 bugs causing this issue. One is that the path is loaded incorrectly for the i18n plugin. The other bug is that not all translations are being bundled into the minified file. The former problem has already been fixed in master of our fork: https://github.com/phetsims/i18n but needs to be moved here. |
We haven't yet decided how to deliver translated sims to customers--we would eventually like a download to not have to contain all translations (to decrease bandwidth requirements) but our short term solution is to provide all of the i18n files and select from amongst them using a query parameter. The problem is that only the i18n file corresponding to the locale specified in the config.js is being combined into the minified file. There is an outstanding request on the i18n plugin site asking for that feature: requirejs/i18n#2 and @jrburke said he may add support for that feature after requirejs 2.0 is delivered: https://groups.google.com/forum/?fromgroups=#!topic/requirejs/0N8S7TJheLU As a short term solution, I am planning to write a utility that will generate a list of the languages to be included in the minified file. This will increase maintenance costs, since there will now be 3 steps to adding a language:
|
…ll appear in the minified file, see #16
I think I have addressed all of the problems causing the failure in this ticket. Reassigning to @jbphet for review, and to discuss applying this solution to https://github.com/phetsims/resistance-in-a-wire and https://github.com/phetsims/example-sim |
By the way, my script for generating the require statements is available in our svn repo at this location: |
I tested this on a number of platforms - Windows + Chome, Windows + IE9, iPad2, and Nexus 7. I tested roughly three languages on each. It all worked fine. I looked briefly at the code, and am okay with the approach. Assigning to @pixelzoom for review and potential closure. |
This ticket doesn't contain enough info for me to evaluate. |
I used the new Gruntfile provided by @pixelzoom which includes almond and tested i18n on the following systems:
Worked great on all of them! In an upcoming ticket comment, I'll summarize what was done, how to add i18n support and the process for converting java strings. |
Comments 1-4 describe the new work that was done for this ticket to get i18n working in the minified code. To summarize, we have reverted back to the unforked i18n and instead run 'update-locale.js' after our requirejs code is loaded but before it is run. To convert Strings from Java, run: To convert Strings from Flash, run: To populate the Strings loader javascript file, use and copy/paste the output to the javascript sim. For an example, please see Ohm's Law or Forces and Motion Basics. |
We have written our own string plugin, and translations can load during development or production. We still need to build translated files for other languages, but that will be another ticket. Closing this one. |
After minification with grunt, the translation files can no longer be loaded. The error is:
Uncaught Error: undefined missing ../nls/fr/ohms-law-strings ohms-law-debug.js:296
main ohms-law-debug.js:296
req ohms-law-debug.js:358
(anonymous function) ohms-law-debug.js:145
(anonymous function) ohms-law-debug.js:534
main ohms-law-debug.js:300
...
I've assigned this to myself and will work on it shortly.
The text was updated successfully, but these errors were encountered: