MetaLocator provides the capability to change nearly all customer-facing language. These language strings are stored in language files named according to the language code they are associated with. To view language files in your account, click Language on the control panel main menu as shown below:
Since most customers use a single language, the account is not pre-loaded with any specific languages.
To get started, click New to create a new language file. Choose the language code associated with your target language. Language codes are of the form aa-BB, where aa is the 2-letter language code, and BB is the two-letter country code. Choose from the list or enter your own. Once you create a new language file that will be displayed as shown:
Click the language code to modify the strings associated with the language constants. There are constants for each user-facing language element in our various Interfaces. Each file contains a comprehensive list for all static constants. Not all constants shown may be in use for the Interface you are work with. To find the constant for a particular user interface element, you can search for the un-translated text.
Connecting a Language File to an Interface
Once you have created a language file, you can associate it with an Interface as shown below:
Once this change is made, the system will language constants from your file.
Creating a Multilingual Interface
Most Interfaces created in MetaLocator use a single language. When using a single language, you can control the customer-facing words and text by editing the string directly in the Interface Builder as shown below
When creating a multi-language Interface, these settings should instead contain references to a language constant. For example, in my en-US data file, I have changed this constant as shown:
Now I can use that constant in the search form as shown below:
At this point, the language file now controls the language displayed for the Location search label. Each label, placeholder and tooltip and so forth can be managed this way. For some settings, you might not find a corresponding language constant in the language file. For these, simply assign your own constant name and value at the bottom of the language file.
All constants should begin with LOCATOR_
Allowing the user to choose a language
When your users arrive at your locator, you can present them with a language drop-down list as shown below. The drop-down is pre-populated with all language files in your account.
However, many websites have already determined the user's language before they arrive at the locator. In this case, you should dynamically initialize the locator with the special "lang" parameter set based on the value chosen elsewhere on your site. This method prevents the user from specifying their language twice. See this article on dynamic parameters for more information.