public static String getTranslation ( Locale locale , String key , String defaultText ) { initializePropertiesIfNeeded ( ) ; String language = locale . getLanguage ( ) ; if ( language == null || language . isEmpty ( ) ) { return defaultText ; } String propertyKey = language + ".text." + key ; String result = translationResources . getProperty ( propertyKey , defaultText ) ; return result ; }
getTranslation This returns a local language translation for the text that is represented by the specified key . The supplied locale is used to indicate the desired language . If a translation cannot be found then the default text will be returned instead .