/** * Use this method to get the locale specific value for a key * * @param property * @return locale specific value for a key */ public static String get(String property) { Properties p = TranslationProvider.getTranslationProvider().properties; if (p == null) { return property; } String localvalue = p.getProperty(property, ""); if (!localvalue.isEmpty()) { return localvalue; } else { TranslationProvider tp = TranslationProvider.getDefaultTranslationProvider(); Properties p1 = tp.properties; String ret = p1.getProperty(property); /*if(ret==null){ return "<null>"+property; }*/ return ret; } }
/** * Private constructor.. * * @param language */ private TranslationProvider(final String language) { this.language = language; Properties p = new Properties(); try { InputStream prof = null; String urlpth = "translations/NeembuuUploader_" + language + ".properties"; prof = new FileInputStream(new File(appLocationProvider.getPath(), urlpth)); p.load(prof); } catch (Exception a) { Logger.getLogger(TranslationProvider.class.getName()) .log(Level.SEVERE, "Could not set language for language " + language, a); ; TranslationProvider.changeLanguage("en"); } properties = p; }
/** * @param property * @return value for a key in default ENGLISH */ public static String getDefault(String property) { return TranslationProvider.getDefaultTranslationProvider().properties.getProperty(property, ""); }