Recently we received a question from a customer in support asking if it was possible to change the language of the directions that are returned from a Network Analyst layer. Though their question was specific to Engine, this solution could be applied to both Server and Desktop. The language of the directions that are returned in Network Analyst comes form the "directions.lng" file which is located in the <ArcGIS install directory>NetworkAnalyst\Directions folder. Currently, this file contains directions only in English; however, we can edit the file to include direction strings for other languages.
The first step of the process is to edit your "directions.lng" file appropriately to support the language that you want. Here are the steps to accomplish this task:
- Make a back-up copy of the "directions.lng" file (found in <ArcGIS install directory>NetworkAnalyst\Directions).
- Open "directions.lng" in a text editor (Notepad, for example).
- Copy all the text in the "English" section (from the line that reads";---English--" to the end of the file).
- Paste the text you copied to the end of the file.
- If you want to display directions in Thai for instance, modify the first couple of lines of the new section to indicate it's Thai, as shown below:
; ---------Thai------------
[th_TH]
- Edit (translate) the new section to represent the Thai language settings. Unfortunately, we don't currently have any documentation on how to change these settings, so it might take some experimentation on your part. In general, things in upper case ('STOP_ARRIVAL', for example) are keywords and should not be edited. Text that appears in brackets ('[ at ]', e.g.) and text that is assigned directly to a variable ('ActionGo = go') is the text that should be translated. Remember that information like street names is going to be read from the route dataset.
- When you finished your editing, save the "directions.lng" file.
The next step is to programmatically set which language to used for the directions when solving the route.
- Get the "StreetDirectionsAgents" from INAContext.
- Using the INAStreetDirectionsAgents2 interface, set the Language property using LCID defined your lng file. For instance:
naStreetDirAgent.Language = "th_TH";
- Then you would call the INAStreetDirectionsAgent2.Execute passing the Routes to get the directions for your routes. For more information on how to do this please see the following link here.
A documentation enhancement request has been submitted to include documentation on how to change the language for Network Anaylst driving directions. The tracking number for this enhancement is NIM010336. We should be seeing the documentation in 9.3.
For more information on working with Network Analyst Check out the following links.