As of July 7 2013, grr supports localization. String localization in grr is twofold:
- Client-side, via js/locales/reader-<ietf-tag>.js, and
- Server-side, via include/locales/<ietf-tag>.php
grr uses the preferred localization based on the Accept-Language
HTTP header. It selects the best match based on availability, and the order of tags in the header.
To add a new localization:
- Determine the IETF language tag for the locale - e.g. pt-br, fr-ca, en-gb. For more information, see http://www.i18nguy.com/unicode/language-identifiers.html
- Copy js/locales/reader-example.js by replacing "example" in the filename with the IETF language tag. For instance, the French translation would be named "reader-fr.js"
- Update function
dateTimeFormatter
to return a properly formatted date/time string -- seedateTimeFormatter
in js/locales/reader-en-us.js for an example - For lines following
$.extend(grrStrings,
, replace thenull
placeholder on each line with the translated string, in quotes - Copy include/locales/example.php by replacing "example" in the filename with the IETF language tag. Again, the French translation would be named "fr.php"
- On each line, replace
null
with the translated string, in quotes - Add the IETF language tag to the
$GRR_SUPPORTED_LOCALES
array in include/common.php:$GRR_SUPPORTED_LOCALES = array("en", "fr");
When translating, please be mindful of string placeholders such as %s
and %1$s
.