Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
There are several places where localization can be performed:
- Error messages returned from the server in API responses (server side).
- OpenStreetMap tags describing road types (when building a graph).
Things to know about multiple languages in OTP:
The languages currently available are in /opentripplanner-webapp/src/main/webapp/js/otp/locale.
To switch between languages, one needs to change the variable 'otp.config.locale' in file config.js (line 11)
Many of the translations are a bit out of date with recent work to localize the webapp (and thus contain 'default' English translations where a translation string is missing). As of May 2011, Italian.js, followed by Spanish.js (missing a few new strings) are the most complete.
If you can help translate any of the language files, or want to add a new language, contributions are warmly welcomed by the user mailing list.
If you're looking to contribute new translations, a discussion on getting Italian translations into OTP might be interesting reading.
There was talk a year ago (April 2010) of changing the translation scheme in OTP to GNU get text Portable Object (PO) files. A good idea, which might get revisited (as having our translation strings in .js is limiting for anything other than a browser based UI; plus there are constructs in different languages that don't follow those of English...something which PO files are more sophisticated at handling).
Server Side Translations
The OTP server translates strings based on the JVM's default locale, using translation properties files placed in
opentripplanner-api-webapp/src/defaults/resources/ in the old module layout). These files are named Message_XY.properties for server messages and WayProperties_XY.properties for the OpenStreetMap tag translations.
In order to see the language of your choice, you may need to modify the JVM's default locale (if you do not want the value derived from your system settings). This can be accomplished with JVM arguments:
$java -Duser.country=DE -Duser.language=de ...