Multi-language support can indeed be handled in Alpha Anywhere.
A quick primer.
There are two ways to handle this - server-side or client-side.
The existing documentation for this feature assumes that you are doing this server-side. The strings in the application are wrapped in "language tags" or "text dictionary" tags and then when the component is served by the Alpha Application Server, the tags are replaced.
For example, you might have a label in a component called "Lastname" - you would change the label to <a5:r>Lastname</a5:r> (this is a Language tag) or to <a5:t>Lastname</a5:t> (this is a text dictionary tag).
If you go to the video finder (help/video finder) and search for 'language tags' you will see several videos on the subject.
However, in a mobile application, especially a phonegap application, using server-side language tags or text dictionary tags might not be appropriate because the app is loaded from the phonegap package stored on the device -- it is NOT typically loaded by making a callback to the server.
Therefore you would need to implement a client-side solution to the problem. this can easily be done using some JavaScript. The approach is as follows:
1. Wrap all of the strings in the app that you need to translate in <span> tags and give each span a unique id. For example
<span id="_language_LASTNAME">LastName</span>
2. Create a .js file that is linked into the UX component that has the translations for each string. For double byte characters your .js file will probably need to use the Javascript Unicode encoding format. The .js file will look something like this:
var _translation = {
"LASTNAME" : {
"english" : "Lastname",
"french" : "LASTNAME in french",
"spanish" : "LASTNAME in spanish"
},
"FIRSTNAME" : {
// DEFINITION FOR FIRSTNAME IN ALL LANGUAGES
}
}
At run-time, when the user want's to change from one language to another, your JavaScript would loop over all of the ids that need to be changed, and set the value to the correct string.
For example to get the value of the 'lastname' field in spanish, you could do the following:
$('_language_LASTNAME').innerHTML = _translation['LASTNAME']['spanish'];
You can handle Chinese or Japanese. all database access in alpha anywhere is UTF8, so any data that comes from a SQL database will just work.
With static data (such as a label that you enter into the UX component builder), you would need to use encoding.
If you go to the Tools menu, when the web control panel has focus, you will see a menu command "Open Text Encoder window" that you can use to encode the strings.
Note - to find out about langauges that operate Right to Left (for example Arabic and Hebrew) vs Left to Right, check out this previous blog post.
Comment