-
Notifications
You must be signed in to change notification settings - Fork 29
kerrishotts edited this page Nov 12, 2012
·
1 revision
(part of PKLOC)
Return Type: any
Parameters: key [, parms, [locale]]
Returns the value appropriate for the key, given the current user's locale or specified locale. If no value exists for the language and country, the language alone is used to attempt to find a value. If no value can be found still, the locale is defaulted to "en-US" and the search is attempted again. If no value is found again, the locale is changed to "en", and the search attempted again. At this point if no value is found, the key itself is returned.
Once a value is found at a locale hierarchy, no further searches are made. Therefore, the hierarchy looks like this:
en
-US
en
-US
es
-MX
-ES
For example:
PKLOC.addTranslation ( "en", "THE_SKY_IS_BLUE", "The sky is blue" );
__T ( "THE_SKY_IS_BLUE" );
// returns "The sky is blue"
PKLOC.addTranslation ( "en", "THE_SKY_IS_%1", "The sky is %1" );
PKLOC.addTranslation ( "en", "BLUE", "blue" );
__T ( "THE_SKY_IS_%1", [__T("BLUE")] );
// returns "The sky is blue"
__T ( "THE_SKY_IS_%1", [__T("BLUE")], "en-US" );
// returns "The sky is blue", regardless of the current locale.
__T ( "THE_SKY_IS_BLUE", [], "en-US" );
// returns "The sky is blue", regardless of the current locale.
0.1 Introduced
0.2 Docs Valid