Information Technology

Languages

Warning: If you configure your system to start with a language other than English, the appropriate language file must define all the strings.  If any are missing, the system will report an error.  If you start with English and switch to another language, however, missing strings will simply remain in English.

One of the interesting features about aMapApp3 is how easy it is to have the interface displayed in different languages.  All that is needed is for a new language files to be created and added to the system.  The application will locate these files and build the language selection panel automatically. A language selection capability is build into the system and will be displayed if the MapApp configuration file has a reference to a langDiv id. 

To alter the labels for the file information or the labels for location types, you will need to set these in the configuration object.

language

 

If you only want to use one language, you can omit the langDiv id and set the default language to the language you need. Even without the interface, an application can reset the language using the API.

aBlog2 and aLogin2 use the same system and have their own files.  A selection made using the interface will be passed to aBlog2 and aLogin2. However, you can create new language files for only those parts of the system you want to, but the language selection panel provided only sees languages that MapApp sees.  If you select a language that is not supported in one of the other applications that application will fall back to English.

At the moment, the only language available is English.  However, as users create the files needed for other languages, we request that they send us a copy so we can include them in future releases.

All the language files are in a folder called “languages”.  To create a new language file make a copy of the lang_English.js file.  The start of this file looks like

// lang_English.js
//                             Created: 10/16/09
//                             Modifed: 12/7/09
//                                                                             All work by Paul Chapin unless otherwise noted

this.languages.push("English");
this.setEnglish=setEnglish;

function setEnglish() {
    LOCATION_NAME = "Location Name";
    LOCATION_TYPE = "Location Type";       
                                                  

Now make the following changes,

  1. Name your copy of the file to reflect the language, such as lang_Japanese.js.
  2. Update in file information at the top.  (Not actually required but a good idea).
  3. Put the name of your language in this.languages.push();  This is what will appear in the language selection interface.  If you want to use non-Western characters use a form such as "Japanese:日本語" or even "Japanese:Japanese - 日本語".  The part before the colon identifies the language to the system and should be limited to non-accented western characters. This is also the value you use to specify the default language or to change the language using a script. The part after the colon is the text that will appear in the selection interface. Change this.setEnglish to reflect your language.  Do the same for the function name.
  4. Now replace all the quoted text strings with equivalent in the new language.  Do NOT change the strings that are in all capitals.  There are quite a few strings in the file.  Try to keep the strings about the same size or shorter, or you may have problems with some displays not showing the entire text.
  5. Put the file into the language folder.  Do not use non-Western characters for the file name.

That’s it.  The next time you load the page, your language will be available.

If this still intimidates you, just email me at pdchapin@amherst.edu and I’ll send you a list of phrases to translate and return.  I’ll then build the file and send it back for you.

The easiest way to change languages is to use the language panel.  Simply provide a <div> tag for it when you configure the mapAppObject. The language panel is strictly optional and is deleted simply by not providing an <div> tag for it to go.  There is also an API call that allows a script to change the language and the initial language can be see at configuration time.

Changing the language will not translate user entries or alter text on the map.  It is strictly optional and may involve some setup, but it is nice for situations where the application is being used by speakers of different languages or when language exposure is important such as for language courses.