public static synchronized Locale getLocale() { Locale rtn = threadLocales.get(); if (rtn != null) { return rtn; } setLocale(langChoice.getDefaultLocale()); return langChoice.getDefaultLocale(); }
protected String calculateString( String packageName, String key, Object[] parameters, Class<?> resourceClass) { String string = null; // First try the standard locale, in the local package try { string = findString(packageName, langChoice.getDefaultLocale(), key, parameters, resourceClass); } catch (MissingResourceException e) { } ; if (string != null) return string; // Then try to find it in the i18n package, in the system messages of the preferred language. try { string = findString( SYSTEM_BUNDLE_PACKAGE, langChoice.getDefaultLocale(), key, parameters, resourceClass); } catch (MissingResourceException e) { } ; if (string != null) return string; // Then try the failover locale, in the local package try { string = findString(packageName, langChoice.getFailoverLocale(), key, parameters, resourceClass); } catch (MissingResourceException e) { } ; if (string != null) return string; // Then try to find it in the i18n package, in the system messages of the failover language. try { string = findString( SYSTEM_BUNDLE_PACKAGE, langChoice.getFailoverLocale(), key, parameters, resourceClass); } catch (MissingResourceException e) { } ; if (string != null) return string; string = "!" + key + "!"; String message = "Message not found in the preferred and failover locale: key=[" + key + "], package=" + packageName; log.logDetailed(Const.getStackTracker(new KettleException(message))); return string; }
/** * @deprecated As of build 4512, replaced by {@link #getInstance() and #getString(String, String)} */ @Deprecated public static String getSystemString(String key, String param1) { try { return GlobalMessageUtil.getString( getBundle(langChoice.getDefaultLocale(), buildBundleName(SYSTEM_BUNDLE_PACKAGE)), key, param1); } catch (MissingResourceException e) { try { return GlobalMessageUtil.getString( getBundle(langChoice.getFailoverLocale(), buildBundleName(SYSTEM_BUNDLE_PACKAGE)), key, param1); } catch (MissingResourceException fe) { LogWriter.getInstance() .logError("Internationalisation/Translation error", Const.getStackTracker(e)); return '!' + key + '!'; } } }
/** @deprecated As of build 4512, replaced by {@link #getInstance() and #getString(String)} */ @Deprecated public static String getSystemString(String key) { try { return GlobalMessageUtil.getString( getBundle(langChoice.getDefaultLocale(), buildBundleName(SYSTEM_BUNDLE_PACKAGE)), key); } catch (MissingResourceException e) { try { return GlobalMessageUtil.getString( getBundle(langChoice.getFailoverLocale(), buildBundleName(SYSTEM_BUNDLE_PACKAGE)), key); } catch (MissingResourceException fe) { LogWriter.getInstance() .logError("Internationalisation/Translation error", Const.getStackTracker(e)); return '!' + key + '!'; } } /* try { ResourceBundle bundle = getBundle(langChoice.getDefaultLocale(), buildBundleName(SYSTEM_BUNDLE_PACKAGE)); return bundle.getString(key); } catch (MissingResourceException e) { // OK, try to find the key in the alternate failover locale try { ResourceBundle bundle = getBundle(langChoice.getFailoverLocale(), buildBundleName(SYSTEM_BUNDLE_PACKAGE)); return bundle.getString(key); } catch (MissingResourceException fe) { LogWriter.getInstance().logError("Internationalisation/Translation error", Const.getStackTracker(e)); return '!' + key + '!'; } } */ }