List of usage examples for java.util Locale setDefault
public static synchronized void setDefault(Locale newLocale)
From source file:org.torproject.android.Orbot.java
/** * Class for interacting with the main interface of the service. *///ww w . java 2 s.co m // this is the connection that gets called back when a successfull bind occurs // we should use this to activity monitor unbind so that we don't have to call // bindService() a million times private void setLocale() { Configuration config = getResources().getConfiguration(); String lang = mPrefs.getString(PREF_DEFAULT_LOCALE, ""); if (!"".equals(lang) && !config.locale.getLanguage().equals(lang)) { Locale locale = new Locale(lang); Locale.setDefault(locale); config.locale = locale; getResources().updateConfiguration(config, getResources().getDisplayMetrics()); } }
From source file:fr.afcepf.atod.wine.data.parser.XmlParser.java
private static void translateProductAppellation(List<ProductWine> products, IDaoProductWine daoProduct, WineService esRepository) {/* www . j a va2 s.co m*/ try { Locale.setDefault(Locale.FRANCE); for (ProductWine product : products) { String appelationfr = ""; String appellation = product.getAppellation(); if (appellation.contains("Other")) { appelationfr = "Autre appelation franaise"; } else if (appellation.contains("Burgundy")) { appelationfr = "Bourgogne"; } else { appelationfr = appellation; } product.setAppellation(appelationfr); daoProduct.updateWithEvictObj(product); Wine esWine = esRepository.getById(product.getId()); esWine.setAppellation(appelationfr); esRepository.save(esWine); } Locale.setDefault(Locale.US); } catch (WineException paramE) { // TODO Auto-generated catch block paramE.printStackTrace(); } }
From source file:pl.edu.icm.visnow.system.main.VisNow.java
public static void mainBlocking(final String[] args, final boolean showMainFrame) { for (int i = 0; i < args.length; i++) { if (args[i].equals("-debug")) { debug = true;/*from www .j av a 2 s . c om*/ } if (args[i].equals("-substancedebug")) { substancedebug = true; } if (args[i].equals("-easy")) { libraryLevel = SIMPLE_LIBRARY; VERSION = VERSION_BASE + "-Simple"; allowGUISwitch = false; } if (args[i].equals("-full")) { guiLevel = EXPERT_GUI; libraryLevel = FULL_LIBRARY; VERSION = VERSION_BASE + "-Pro"; } } VNLogger.init(debug); Locale.setDefault(Locale.US); try { visnow = new VisNow(); visnow.init(args, showMainFrame, true); } catch (VNSystemException ex) { Displayer.display(1010101010, ex, null, "Initialization failed."); } visnow.initUserMessages(); }
From source file:org.parosproxy.paros.Constant.java
public static void setLocale(String loc) { String[] langArray = loc.split("_"); Locale locale = new Locale(langArray[0], langArray[1]); Locale.setDefault(locale); if (messages == null) { messages = new I18N(locale); } else {//from w ww .jav a 2 s .com messages.setLocale(locale); } }
From source file:AltiConsole.AltiConsoleMainScreen.java
/** * Initializes the localization system.//from w w w .j a v a2s. c om */ private static void initializeL10n() { Translator t; Locale userLocale = UserPref.getApplicationLocale(); if (userLocale != null) { Locale.setDefault(userLocale); } try { t = new ResourceBundleTranslator("l10n.messages"); } catch (MissingResourceException e) { t = new ResourceBundleTranslator("messages"); } if (Locale.getDefault().getLanguage().equals("xx")) { t = new DebugTranslator(t); } Application.setBaseTranslator(t); }
From source file:de.dmarcini.submatix.pclogger.gui.MainCommGUI.java
/** * Programmsprache wechseln Project: SubmatixBTConfigPC Package: de.dmarcini.submatix.pclogger.gui * //from w w w .j av a 2 s .co m * @author Dirk Marciniak (dirk_marciniak@arcor.de) Stand: 19.12.2011 * @param cmd * Sprachenkrzel */ private void changeProgramLanguage(String cmd) { String[] langs = null; langs = cmd.split("_"); lg.debug("change language to <" + cmd + ">"); if (langs.length > 1 && langs[1] != null) { programLocale = new Locale(langs[0], langs[1]); } else { programLocale = new Locale(langs[0]); } Locale.setDefault(programLocale); LangStrings.setLocale(programLocale); if (currentConfig != null) { // da verndern sich die Einstellungen, daher ungltig setzen currentConfig.setWasInit(false); } setLanguageStrings(); }
From source file:fr.afcepf.atod.wine.data.parser.XmlParser.java
private static void translateProductFeatures(List<ProductFeature> features, IDaoProductFeature daoProductFeature, WineService esRepository) { HashMap<String, String> featuresTrad = new HashMap<String, String>(); try {/*from ww w. ja v a 2 s. co m*/ Locale.setDefault(Locale.FRANCE); featuresTrad.put("Precious Wine", "Vin rare"); featuresTrad.put("Has Large Label", "Large tiquette"); featuresTrad.put("Bordeaux Futures", "Bordeaux en primeurs"); featuresTrad.put("Wine Gift Sets", "Coffrets cadeau de vin"); featuresTrad.put("Earthy & Spicy", "Vin terreux et pic"); featuresTrad.put("Fruity & Smooth", "Vin fruit et rond"); featuresTrad.put("Birthday", "Pour anniversaire"); featuresTrad.put("Corporate Gifts", "Cadeaux d'entreprise"); featuresTrad.put("Sweet Wine", "Vin doux"); featuresTrad.put("Green Wines", "Vins verts"); featuresTrad.put("90+ Rated Wine", "Vin not 90+"); featuresTrad.put("94+ Rated Wine", "Vin not 94+"); featuresTrad.put("Light & Fruity", "Vin lger et fruit"); featuresTrad.put("Congratulations", "Pour clbrations"); featuresTrad.put("Rich & Creamy", "Vin riche et crmeux"); featuresTrad.put("Light & Crisp", "Vin sec lger"); featuresTrad.put("Smooth & Supple", "Vin rond et moelleux"); featuresTrad.put("Older Vintages", "Millsimes plus anciens"); featuresTrad.put("94+ Rated Wine Under $75", "Vin not 94+ sous les 70"); featuresTrad.put("Screw Cap Wines", "Vin avec bouchon viss"); featuresTrad.put("90+ Rated Wine Under $20", "Vin not 90+ sous les 20"); featuresTrad.put("Big & Bold", "Vin ample et audacieux"); featuresTrad.put("Has Video", "Avec Vido"); featuresTrad.put("Wedding", "Idal pour un mariage"); featuresTrad.put("Great Bottles to Give", "Une bouteille parfaite pour offrir"); featuresTrad.put("Boutique Wines", "Vin apprci en boutique"); featuresTrad.put("Champagne Gifts", "Champagne parfait pour offrir"); featuresTrad.put("Collectible Wines", "Vins de collection"); for (ProductFeature pf : features) { String label_fr = featuresTrad.get(pf.getLabel()); pf.setLabel(label_fr); daoProductFeature.updateObj(pf); List<Wine> list = esRepository.findByWineFeatureId(pf.getId()); for (Wine wine : list) { for (WineFeature feat : wine.getFeatures()) { if (feat.getId().equals(pf.getId())) { feat.setLabel(label_fr); } } esRepository.save(wine); } } Locale.setDefault(Locale.US); } catch (WineException paramE) { paramE.printStackTrace(); } }
From source file:org.osm.keypadmapper2.KeypadMapper2Activity.java
private void updateLocale() { String languageToLoad = KeypadMapperApplication.getInstance().getSettings().getCurrentLanguageCode(); Locale locale = new Locale(languageToLoad); Locale.setDefault(locale); Configuration config = new Configuration(); config.locale = locale;/*from w w w . ja v a 2 s . c om*/ getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics()); lang = languageToLoad; }
From source file:org.pentaho.di.ui.spoon.Spoon.java
private static void initLogging(CommandLineOption[] options) throws KettleException { StringBuffer optionLogFile = getCommandLineOption(options, "logfile").getArgument(); StringBuffer optionLogLevel = getCommandLineOption(options, "level").getArgument(); // Set default Locale: Locale.setDefault(Const.DEFAULT_LOCALE); if (!Const.isEmpty(optionLogFile)) { fileLoggingEventListener = new FileLoggingEventListener(optionLogFile.toString(), true); if (log.isBasic()) { String filename = fileLoggingEventListener.getFilename(); log.logBasic(BaseMessages.getString(PKG, "Spoon.Log.LoggingToFile") + filename); }// w w w . ja va2 s . c o m KettleLogStore.getAppender().addLoggingEventListener(fileLoggingEventListener); } else { fileLoggingEventListener = null; } if (!Const.isEmpty(optionLogLevel)) { log.setLogLevel(LogLevel.getLogLevelForCode(optionLogLevel.toString())); if (log.isBasic()) { // "Logging is at level : " log.logBasic(BaseMessages.getString(PKG, "Spoon.Log.LoggingAtLevel") + log.getLogLevel().getDescription()); } } }
From source file:it.cnr.icar.eric.client.ui.swing.RegistryBrowser.java
public void setLocale(Locale locale) { super.setLocale(locale); Locale oldLocale = Locale.getDefault(); Locale.setDefault(locale); resourceBundle = JavaUIResourceBundle.getInstance(locale); firePropertyChange(PROPERTY_LOCALE, oldLocale, locale); applyComponentOrientation(ComponentOrientation.getOrientation(getLocale())); SwingUtilities.updateComponentTreeUI(this); // Setting the look and feel is seemingly the only way to get // the JOptionPane.showConfirmDialog in exitApplication() to // use the correct button text for the new locale. try {/*from ww w . j a v a 2s.c o m*/ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { } }