Util
Class I18N

java.lang.Object
  extended by Util.I18N

public class I18N
extends java.lang.Object

Internationalisation (I18N) helper

Author:
eliott bartley

Method Summary
static java.lang.String get(java.lang.String name, java.lang.Object... params)
          Get a string message from UI.res.locale.messages using the default language to determine which messages file to use where additional languages can be added by adding messages files with _language_country codes e.g. messages_es_EC.properties for Spanish (Ecuador)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

public static java.lang.String get(java.lang.String name,
                                   java.lang.Object... params)
Get a string message from UI.res.locale.messages using the default language to determine which messages file to use where additional languages can be added by adding messages files with _language_country codes e.g. messages_es_EC.properties for Spanish (Ecuador)

Parameters:
name - Name of the string to get
params - If named string contains parameters placeholders, fill them with these values. If params contains names too, that exist in the messages file, these are resolved and use the params that follow the params that would be used for the message, e.g. given the messages.. ma=1:[{0}],[{1}] mb=2:[{0}] mc=3:[{0}{0}] md=4:{1} ..calling get("ma", "mb", "t1", "mc", "md", "t2", "t3"); would output.. 1:[2:[3:[4:t34:t3]]],[t1] ..because.. ma expanded to 1:[{0}],[{1}], its parameters are the next two values "mb" and "t1" so mb expands to 2:[{0}] and it takes the parameter following the parameters used by ma, which is mc, mc expands to 3:[{0}{0}] and it takes the parameters following what mb used, md, which expands to 4:{1} which uses "t2" and "t3", so fill {1} with t3, which files 3:[{0}{0}] with 4:t3 twice, which fills 2:[{0}] with 3:[4:t34:t3], which fills 1:[{0}],[{1}] with 3:[4:t34:t3] and ma's second parameter "t1"
Returns:
Named string with parameters filled (if any) in the current language, or nearest matching language, or default language (English)