xtuple-mobile showing unstranslated labels when user is set to Australian Locale

 

jmcd1973's picture

I am currently trialling the vagrant virtualbox vm based xtuple install locally.

When I have my user logging in to xtuple-mobile (v 4.5.0) using the default en_US locale. I get the  labels in the html5 app displaying nicely.

When I change my user account locale to be en_AU I then get the raw underscore prefixed labels with no translated strings.

Following are snippets of what I see when I access the xtuple-mobile https://localhost:8443/test/locale url with the different locale settings active.

United States:

"culture":"en_US","strings":[{"_about":"About","_accountParent":"Account Parent","_actions":"Actions","_advancedSearch":"Advanced Search"

Australian: 

"culture":"en_AU","strings":[{"_abbreviation":"","_abbreviationLong":"","_abbreviationShort":"","_above":"","

As you can see with en_AU active the translated strings are missing.

I know that strings.js have 'var lang = XT.stringsFor("en_US", {' etc. but I don't know where and what to change and how to get the node.js application to update to get my labels displaying properly.

Google hasn't enlightened me enough to allow me to fix it myself. Can anyone point me in the right direction? Thanks.

 

 

 

 
 
 
shackbarth
shackbarth's picture
Offline
Joined: 06/28/2012
I can help you out with this.

I can help you out with this. Internationalization of our webapp is in what I'd consider to be alpha until 4.7, and is not yet adequately documented, but it's certainly possible.

 

./scripts/export_dictionary.js -d dev -l en_AU

 

Will export the language dictionary to file. Unfortunately, the script isn't smart enough to understand that it already knows the translations to all of the words, because English is English. This is where you come in! (how's your javascript?) 

I'd add something like this:

          else if (destinationLang.indexOf('en') === 0) {
            // english is english
            stringCallback(null, {
              key: stringObj.key,
              source: stringObj.value,
              target: stringObj.value
            });
          }
 
here:

https://github.com/xtuple/xtuple/blob/c5a1554615d32e7b72800ba05d74974ac9...

 

And if you run the export_dictionary command again, it will copy the source translations straight into the target translation.

*Then* (how's your git?) we'd be very grateful if you submitted the code back to our repo github.com/xtuple/xtuple. This will be useful for a lot of people.

Once you have your language file (you can tweak it as you like with a text editor if you want to add some local flair) you then re-import it back using

./scripts/import_dictionary.js -f scripts/output/en_AU_dictionary.js -d dev
 

And when you refresh the browser you'll be back in business.

 
jmcd1973
jmcd1973's picture
Offline
Joined: 01/13/2011
Resolved

Hi,

Hi thanks that worked well

I have forked xtuple to my github account (jmcd73), made the change and submitted a pull request, so hopefully it will go into the newer versions.

I'm not sure if I have done it correctly but there is a first time for everything.

James McD.

 

 

 
shackbarth
shackbarth's picture
Offline
Joined: 06/28/2012
Yes, this looks great! Thanks

Yes, this looks great! Thanks for contributing back. One thing I failed to mention is that `master` represents our latest stable build. We submit pull requests against the active branch, which, in today's case, is `4_7_x`.

Steve

 
anderson
anderson's picture
Offline
Joined: 01/28/2009
Thanks for the tip Steve.  I

Thanks for the tip Steve.  I was wondering how to change my locale myself without losing all the labels.  Other than date and currency formats associated with a locale, there are subtle differences in spellings as well.

Unfortunately US English is not always the same English used elsewhere - Internationalization <> Internationalisation / Labor <> Labour

Mind you having spent time in England I sometimes wonder what language some of them speak...

 
shackbarth
shackbarth's picture
Offline
Joined: 06/28/2012
Yes, that's where you'll want

Yes, that's where you'll want to update the files by hand and have a proper Australian-English file, etc. You'll probably want to start with American English pasted in there, in the same way that the Google-Translate-first-pass on Spanish is probably a good starting point for Mexican Spanish. To my knowledge, Google doesn't translate American English into British English, although they probably will one day.

We welcome our community to keep language files (even British English, say) updated here:

https://github.com/xtuple/xtuple-linguist