List of usage examples for java.util Locale ENGLISH
Locale ENGLISH
To view the source code for java.util Locale ENGLISH.
Click Source Link
From source file:Main.java
public static void updateConfiguration(Context context) { Resources resources = context.getResources(); Configuration conf = resources.getConfiguration(); Locale current = Locale.getDefault(); String currentLanguage = current.getDisplayLanguage(); if (Locale.CHINESE.getDisplayLanguage().equals(currentLanguage) || Locale.ENGLISH.getDisplayLanguage().equals(currentLanguage)) { return;//www . j ava 2 s . c o m } conf.locale = Locale.ENGLISH; resources.updateConfiguration(conf, resources.getDisplayMetrics()); }
From source file:Main.java
/** * Create a File for saving an image in the * "/Android/data/package.name/Files" directory * * @param context application context//from w w w. j av a 2s . co m * @return a new File for saving an image */ private static File getOutputMediaFile(Context context) { // To be safe, you should check that the SDCard is mounted // using Environment.getExternalStorageState() before doing this. File mediaStorageDir = new File( Environment.getExternalStorageDirectory() + "/Android/data/" + context.getPackageName() + "/Files"); // This location works best if you want the created images to be shared // between applications and persist after your app has been uninstalled. // Create the storage directory if it does not exist if (!mediaStorageDir.exists()) { if (!mediaStorageDir.mkdirs()) { return null; } } // Create a media file name String timeStamp = new SimpleDateFormat("ddMMyyyy_HHmmssSS", Locale.ENGLISH).format(new Date()); File mediaFile; String mImageName = "FRIDGE_" + timeStamp + ".jpg"; mediaFile = new File(mediaStorageDir.getPath() + File.separator + mImageName); return mediaFile; }
From source file:edu.ku.brc.specify.config.init.secwiz.SpecifyDBSecurityWizardFrame.java
/** * @param args//from ww w .java 2s .c o m */ public static void main(String[] args) { // Set App Name, MUST be done very first thing! UIRegistry.setAppName("Specify"); //$NON-NLS-1$ try { ResourceBundle.getBundle("resources", Locale.getDefault()); //$NON-NLS-1$ } catch (MissingResourceException ex) { Locale.setDefault(Locale.ENGLISH); UIRegistry.setResourceLocale(Locale.ENGLISH); } try { if (!System.getProperty("os.name").equals("Mac OS X")) { UIManager.setLookAndFeel(new Plastic3DLookAndFeel()); PlasticLookAndFeel.setPlasticTheme(new DesertBlue()); } } catch (Exception e) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(SpecifyDBSecurityWizard.class, e); e.printStackTrace(); } AppBase.processArgs(args); AppBase.setupTeeForStdErrStdOut(true, false); System.setProperty("appdatadir", ".."); SwingUtilities.invokeLater(new Runnable() { public void run() { // Then set this IconManager.setApplicationClass(Specify.class); IconManager.loadIcons(XMLHelper.getConfigDir("icons_datamodel.xml")); //$NON-NLS-1$ IconManager.loadIcons(XMLHelper.getConfigDir("icons_plugins.xml")); //$NON-NLS-1$ IconManager.loadIcons(XMLHelper.getConfigDir("icons_disciplines.xml")); //$NON-NLS-1$ // Load Local Prefs AppPreferences localPrefs = AppPreferences.getLocalPrefs(); //try { //System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> "+(new File(UIRegistry.getAppDataDir()).getCanonicalPath())+"]"); //} catch (IOException ex) {} localPrefs.setDirPath(UIRegistry.getAppDataDir()); // Check to see if we should check for a new version String VERSION_CHECK = "version_check.auto"; if (localPrefs.getBoolean(VERSION_CHECK, null) == null) { localPrefs.putBoolean(VERSION_CHECK, true); } String EXTRA_CHECK = "extra.check"; if (localPrefs.getBoolean(EXTRA_CHECK, null) == null) { localPrefs.putBoolean(EXTRA_CHECK, true); } if (UIHelper.isLinux()) { Specify.checkForSpecifyAppsRunning(); } if (UIRegistry.isEmbedded()) { checkForMySQLProcesses(); } Specify.setUpSystemProperties(); final SpecifyDBSecurityWizardFrame wizardFrame = new SpecifyDBSecurityWizardFrame(); if (localPrefs.getBoolean(VERSION_CHECK, true) && localPrefs.getBoolean(EXTRA_CHECK, true)) { try { com.install4j.api.launcher.SplashScreen.hide(); ApplicationLauncher.Callback callback = new ApplicationLauncher.Callback() { public void exited(int exitValue) { UIHelper.centerAndShow(wizardFrame); } public void prepareShutdown() { } }; ApplicationLauncher.launchApplication("100", null, true, callback); } catch (Exception ex) { UIHelper.centerAndShow(wizardFrame); } } else { UIHelper.centerAndShow(wizardFrame); } } }); }
From source file:com.xyxy.platform.modules.core.beanvalidator.BeanValidatorsTest.java
@BeforeClass public static void beforeClass() { // To avoid the non-English environment test failure on message asserts. Locale.setDefault(Locale.ENGLISH); }
From source file:Main.java
public static String getDate(final long time) { final Calendar cal = Calendar.getInstance(Locale.ENGLISH); cal.setTimeInMillis(time);//w w w . j a v a 2 s . c o m return DateFormat.format("dd-MM-yyyy", cal).toString(); }
From source file:Main.java
/** * Take the input string and un-camel-case it. * <p/>/*from w w w .j a va 2s .com*/ * 'ThisIsIt' will become 'this-is-it'. * * @param input * @return deHumped string */ public static String addAndDeHump(String input) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < input.length(); i++) { if ((i != 0) && Character.isUpperCase(input.charAt(i))) { sb.append('-'); } sb.append(input.charAt(i)); } return sb.toString().trim().toLowerCase(Locale.ENGLISH); }
From source file:it_minds.dk.eindberetningmobil_android.models.Purpose.java
/** * parseFromJson description here//from w ww .jav a 2 s.c o m * * @return Purpose */ public static Purpose parseFromJson(JSONObject obj) throws JSONException, MalformedURLException, ParseException { String description = obj.optString("Description"); Date date = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy", Locale.ENGLISH).parse(obj.optString("Date")); return new Purpose(description, date); }
From source file:Main.java
/** Convert string to uppercase * Always use the java.util.ENGLISH locale * @param s string to uppercase/*from w w w. j a v a2s .co m*/ * @return uppercased string */ public static String SQLToUpperCase(String s) { return s.toUpperCase(Locale.ENGLISH); }
From source file:com.hangum.tadpole.commons.util.RequestInfoUtils.java
/** * Return request locale//from ww w .j a v a2s .c o m * * @return */ public static String getDisplayLocale() { HttpServletRequest request = RWT.getRequest(); Locale locale = request.getLocale(); return locale.getDisplayLanguage(Locale.ENGLISH); }
From source file:org.traccar.WebDataHandler.java
private static String formatSentence(Position position) { StringBuilder s = new StringBuilder("$GPRMC,"); try (Formatter f = new Formatter(s, Locale.ENGLISH)) { Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"), Locale.ENGLISH); calendar.setTimeInMillis(position.getFixTime().getTime()); f.format("%1$tH%1$tM%1$tS.%1$tL,A,", calendar); double lat = position.getLatitude(); double lon = position.getLongitude(); f.format("%02d%07.4f,%c,", (int) Math.abs(lat), Math.abs(lat) % 1 * 60, lat < 0 ? 'S' : 'N'); f.format("%03d%07.4f,%c,", (int) Math.abs(lon), Math.abs(lon) % 1 * 60, lon < 0 ? 'W' : 'E'); f.format("%.2f,%.2f,", position.getSpeed(), position.getCourse()); f.format("%1$td%1$tm%1$ty,,", calendar); }//w ww . ja v a 2 s. c o m s.append(Checksum.nmea(s.toString())); return s.toString(); }