List of usage examples for java.util Locale UK
Locale UK
To view the source code for java.util Locale UK.
Click Source Link
From source file:org.pdfsam.context.DefaultI18nContext.java
private Locale getBestLocale() { String localeString = DefaultUserContext.getInstance().getLocale(); if (StringUtils.isNotBlank(localeString)) { LOG.trace("Found locale string {}", localeString); return Locale.forLanguageTag(localeString); }/*from ww w . jav a2 s .c om*/ if (SUPPORTED_LOCALES.contains(Locale.getDefault())) { LOG.trace("Using default locale {}", Locale.getDefault()); return Locale.getDefault(); } Locale onlyLanguage = new Locale(Locale.getDefault().getLanguage()); if (SUPPORTED_LOCALES.contains(onlyLanguage)) { LOG.trace("Using supported locale closest to default {}", onlyLanguage); return onlyLanguage; } LOG.trace("Using fallback locale"); return Locale.UK; }
From source file:org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9.EncounterProviderResource1_9Test.java
@Test public void testAdd() throws Exception { // If we don't explicitly set a locale, then a Context.getLocale() call nested somewhere below will trigger a // premature hibernate flush because it looks up the global property for default locale Context.setLocale(Locale.UK); EncounterRole newRole = new EncounterRole(); newRole.setName("Another role"); encounterService.saveEncounterRole(newRole); Encounter encounter = encounterService.getEncounter(3); EncounterProviderResource1_9 resource = getResource(); SimpleObject post = new SimpleObject().add("provider", "c2299800-cca9-11e0-9572-0800200c9a66") .add("encounterRole", newRole.getUuid()); Object created = resource.create(encounter.getUuid(), post, new RequestContext()); assertThat((String) getByPath(created, "provider.uuid"), is("c2299800-cca9-11e0-9572-0800200c9a66")); assertThat((String) getByPath(created, "encounterRole.uuid"), is(newRole.getUuid())); assertThat(getEncounterProviderCountWithoutFlushing(), is(2)); assertThat(getEncounterProviderCountWithoutFlushingByUuid(getByPath(created, "uuid").toString()), is(1)); }
From source file:org.atomserver.core.EntryURIHelperTest.java
public void testSuccess() throws Exception { checkUriData(checkEntryIRI("http://whatever/" + baseURI + "/widgets/acme/1234.en.xml", false), "widgets", "acme", "1234", Locale.ENGLISH); checkUriData(checkEntryIRI("http://whatever/" + baseURI + "/widgets/acme/1234?locale=en_GB", false), "widgets", "acme", "1234", Locale.UK); assertEquals(42,/*from w w w. jav a 2 s . c om*/ checkEntryIRI("http://whatever/" + baseURI + "/widgets/acme/1234.en.xml?start-index=42", false) .getStartIndexParam()); assertEquals(8675309, checkEntryIRI("http://whatever/" + baseURI + "/widgets/acme/1234.en.xml?max-results=8675309", false) .getMaxResultsParam()); assertEquals(0, checkEntryIRI("http://whatever/" + baseURI + "/widgets/acme/1234.en.xml", false).getRevision()); assertEquals(4, checkEntryIRI("http://whatever/" + baseURI + "/widgets/acme/1234.en.xml/4?max-results=8675309", false).getRevision()); assertEquals(URIHandler.REVISION_OVERRIDE, checkEntryIRI("http://whatever/" + baseURI + "/widgets/acme/1234.en.xml/*", false).getRevision()); assertEquals(URIHandler.REVISION_OVERRIDE, checkEntryIRI("http://whatever/" + baseURI + "/widgets/acme/1234.en.xml/*?start-index=15", false) .getRevision()); Date now = new Date(); assertEquals(now, checkEntryIRI( "http://whatever/" + baseURI + "/widgets/acme/1234.en.xml?updated-min=" + AtomDate.format(now), false).getUpdatedMinParam()); assertEquals(Locale.US, checkEntryIRI("http://whatever/" + baseURI + "/widgets/acme/1234?locale=en_US", false) .getLocaleParam()); assertEquals(EntryType.full, checkEntryIRI("http://whatever/" + baseURI + "/widgets/acme/1234.en.xml?entry-type=full", false) .getEntryTypeParam()); assertEquals(EntryType.link, checkEntryIRI("http://whatever/" + baseURI + "/widgets/acme/1234.en.xml?entry-type=link", false) .getEntryTypeParam()); }
From source file:me.hammarstrom.imagerecognition.activities.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); bindViews();//from ww w . j a va 2 s . co m mToolbar.setTitle(""); setSupportActionBar(mToolbar); mCameraPreviewLayout.setOnClickListener(this); mButtonReset.setOnClickListener(this); // mGestureDetector = new GestureDetectorCompat(this, new CameraPreviewGestureListener()); // mCameraPreviewLayout.setOnTouchListener(new View.OnTouchListener() { // @Override // public boolean onTouch(View v, MotionEvent event) { // return mGestureDetector.onTouchEvent(event); // } // }); mTts = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() { @Override public void onInit(int status) { if (status != TextToSpeech.ERROR) { mTts.setLanguage(Locale.UK); } } }); }
From source file:Utils.GenericUtils.java
public static HashMap<String, String> ProcessScanResult(String sScanInfo, Boolean bFlag) { HashMap<String, String> hList = new HashMap<String, String>(); String sTemp = sScanInfo.replace((char) 13, ':'); sTemp = sTemp.replaceAll("\\s+", ""); String sList[] = sTemp.split(":"); for (int i = 0; i < sList.length; i++) { if (sList[i].compareToIgnoreCase(SCAN_FIRSTNAME) == 0) { i++;//w w w .j a va 2s .com hList.put(SCAN_FIRSTNAME, sList[i]); } if (sList[i].compareToIgnoreCase(SCAN_SURNAME) == 0) { i++; hList.put(SCAN_SURNAME, sList[i]); } if (sList[i].compareToIgnoreCase(SCAN_EMPID) == 0) { i++; hList.put(SCAN_EMPID, sList[i]); } if (sList[i].compareToIgnoreCase(SCAN_DESIGN) == 0) { i++; hList.put(SCAN_DESIGN, sList[i]); } } SimpleDateFormat sdfI = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss", Locale.UK); String inTime = sdfI.format(new Date()); hList.put(SCAN_INTIME, inTime); hList.put(SCAN_OUTTIME, inTime); return hList; }
From source file:org.pdfsam.i18n.DefaultI18nContext.java
Locale getBestLocale() { if (SUPPORTED_LOCALES.contains(Locale.getDefault())) { return Locale.getDefault(); }/*from ww w .j a v a 2 s .c o m*/ Locale onlyLanguage = new Locale(Locale.getDefault().getLanguage()); if (SUPPORTED_LOCALES.contains(onlyLanguage)) { LOG.trace("Using supported locale closest to default {}", onlyLanguage); return onlyLanguage; } LOG.trace("Using fallback locale"); return Locale.UK; }
From source file:org.jfree.data.time.junit.MonthTest.java
/** * In Auckland, the end of Feb 2000 is java.util.Date(951,821,999,999L). * Use this to check the Month constructor. *///from www . j a v a 2 s. c om public void testDateConstructor2() { TimeZone zone = TimeZone.getTimeZone("Pacific/Auckland"); Calendar c = new GregorianCalendar(zone); Month m1 = new Month(new Date(951821999999L), zone, Locale.UK); Month m2 = new Month(new Date(951822000000L), zone, Locale.UK); assertEquals(MonthConstants.FEBRUARY, m1.getMonth()); assertEquals(951821999999L, m1.getLastMillisecond(c)); assertEquals(MonthConstants.MARCH, m2.getMonth()); assertEquals(951822000000L, m2.getFirstMillisecond(c)); }
From source file:net.pms.configuration.PmsConfigurationTest.java
/** * Test Logging Configuration defaults/*from w ww. java 2s.co m*/ */ @Test public void testLoggingConfigurationDefaults() { // Test defaults and valid values where applicable assertFalse("LogSearchCaseSensitiveDefault", configuration.getGUILogSearchCaseSensitive()); assertFalse("LogSearchMultiLineDefault", configuration.getGUILogSearchMultiLine()); assertFalse("LogSearchRegEx", configuration.getGUILogSearchRegEx()); assertTrue("LogFileNameValid", FileUtil.isValidFileName(configuration.getDefaultLogFileName())); assertEquals("LogFileNameDefault", configuration.getDefaultLogFileName(), "debug.log"); File file = new File(configuration.getDefaultLogFileFolder()); assertTrue("DefaultLogFileFolder", file.isDirectory()); file = new File(configuration.getDefaultLogFilePath()); assertTrue("DefaultLogFilePath", configuration.getDefaultLogFilePath().endsWith("debug.log")); assertFalse("LoggingBufferedDefault", configuration.getLoggingBuffered()); assertEquals("LoggingFilterConsoleDefault", configuration.getLoggingFilterConsole(), Level.INFO); assertEquals("LoggingFilterLogsTabDefault", configuration.getLoggingFilterLogsTab(), Level.INFO); assertEquals("LoggingLogsTabLinebufferDefault", configuration.getLoggingLogsTabLinebuffer(), 1000); assertTrue("LoggingLogsTabLinebufferLegal", configuration.getLoggingLogsTabLinebuffer() >= PmsConfiguration.LOGGING_LOGS_TAB_LINEBUFFER_MIN && configuration .getLoggingLogsTabLinebuffer() <= PmsConfiguration.LOGGING_LOGS_TAB_LINEBUFFER_MAX); assertEquals("LoggingSyslogFacilityDefault", configuration.getLoggingSyslogFacility(), "USER"); assertEquals("LoggingSyslogHostDefault", configuration.getLoggingSyslogHost(), ""); assertEquals("LoggingSyslogPortDefault", configuration.getLoggingSyslogPort(), 514); assertFalse("LoggingUseSyslogDefault", configuration.getLoggingUseSyslog()); assertEquals("getLanguageLocaleDefault", configuration.getLanguageLocale(), Languages.toLocale(Locale.getDefault())); assertEquals("getLanguageTagDefault", configuration.getLanguageTag(), Languages.toLanguageTag(Locale.getDefault())); configuration.getConfiguration().setProperty("language", ""); assertEquals("getLanguageLocaleDefault", configuration.getLanguageLocale(), Languages.toLocale(Locale.getDefault())); assertEquals("getLanguageTagDefault", configuration.getLanguageTag(), Languages.toLanguageTag(Locale.getDefault())); configuration.getConfiguration().setProperty("language", "en-GB"); assertEquals("getLanguageLocaleBritishEnglish", configuration.getLanguageLocale(), Locale.forLanguageTag("en-GB")); assertEquals("getLanguageTagBritishEnglish", configuration.getLanguageTag(), "en-GB"); configuration.getConfiguration().setProperty("language", "en"); assertEquals("getLanguageLocaleEnglish", configuration.getLanguageLocale(), Locale.forLanguageTag("en-US")); assertEquals("getLanguageTagEnglish", configuration.getLanguageTag(), "en-US"); configuration.getConfiguration().setProperty("language", "zh"); assertEquals("getLanguageLocaleChinese", configuration.getLanguageLocale(), Locale.forLanguageTag("zh-Hant")); assertEquals("getLanguageTagChinese", configuration.getLanguageTag(), "zh-Hant"); configuration.setLanguage(Locale.UK); assertEquals("setLanguageUK", configuration.getLanguageLocale(), Locale.forLanguageTag("en-GB")); configuration.setLanguage(Locale.SIMPLIFIED_CHINESE); assertEquals("setLanguageSimplifiedChinese", configuration.getLanguageLocale(), Locale.forLanguageTag("zh-Hans")); configuration.setLanguage(Locale.TRADITIONAL_CHINESE); assertEquals("setLanguageTraditionalChinese", configuration.getLanguageLocale(), Locale.forLanguageTag("zh-Hant")); Locale locale = null; configuration.setLanguage(locale); assertEquals("setLanguageNull", configuration.getLanguageLocale(), Locale.forLanguageTag("zh-Hant")); String code = null; configuration.setLanguage(code); assertEquals("setLanguageNull", configuration.getLanguageLocale(), Locale.forLanguageTag("zh-Hant")); configuration.setLanguage(""); assertEquals("setLanguageEmpty", configuration.getLanguageLocale(), Locale.forLanguageTag("zh-Hant")); configuration.setLanguage("en"); assertEquals("setLanguageEnglish", configuration.getLanguageLocale(), Locale.forLanguageTag("en-US")); }
From source file:com.st.maven.debian.DebianPackageMojo.java
@Override public void execute() throws MojoExecutionException { validate();// w w w . j ava 2 s . c o m fillDefaults(); freemarkerConfig.setDefaultEncoding("UTF-8"); freemarkerConfig.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); freemarkerConfig.setClassForTemplateLoading(DebianPackageMojo.class, "/"); freemarkerConfig.setTimeZone(TimeZone.getTimeZone("GMT")); Config config = new Config(); config.setArtifactId(project.getArtifactId()); config.setDescription(project.getDescription()); config.setGroup(unixGroupId); config.setUser(unixUserId); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); config.setVersion(sdf.format(new Date())); Developer dev = project.getDevelopers().get(0); String maintainer = dev.getName() + " <" + dev.getEmail() + ">"; config.setMaintainer(maintainer); config.setName(project.getName()); config.setDescription(project.getDescription()); config.setDepends(formatDependencies(osDependencies)); config.setInstallDir("/home/" + unixUserId + "/" + project.getArtifactId()); if (section == null || section.trim().length() == 0) { config.setSection("java"); } else { config.setSection(section); } if (arch == null || arch.trim().length() == 0) { config.setArch("all"); } else { config.setArch(arch); } if (priority == null || priority.trim().length() == 0) { config.setPriority(Priority.STANDARD); } else { config.setPriority(Priority.valueOf(priority.toUpperCase(Locale.UK))); } ArFileOutputStream aros = null; try { File debFile = new File(project.getBuild().getDirectory() + File.separator + project.getArtifactId() + "-" + config.getVersion() + ".deb"); getLog().info("Building deb: " + debFile.getAbsolutePath()); aros = new ArFileOutputStream(debFile.getAbsolutePath()); aros.putNextEntry(createEntry("debian-binary")); aros.write("2.0\n".getBytes(StandardCharsets.US_ASCII)); aros.closeEntry(); aros.putNextEntry(createEntry("control.tar.gz")); fillControlTar(config, aros); aros.closeEntry(); aros.putNextEntry(createEntry("data.tar.gz")); fillDataTar(config, aros); aros.closeEntry(); if (attachArtifact) { VersionableAttachedArtifact artifact = new VersionableAttachedArtifact(project.getArtifact(), "deb", config.getVersion()); artifact.setFile(debFile); artifact.setResolved(true); project.addAttachedArtifact(artifact); } } catch (Exception e) { throw new MojoExecutionException("unable to create .deb file", e); } finally { if (aros != null) { try { aros.close(); } catch (IOException e) { throw new MojoExecutionException("unable to close .deb file", e); } } } }
From source file:it.polimi.diceH2020.SPACE4CloudWS.solvers.solversImpl.MINLPSolver.MINLPDataFileBuilder.java
MINLPDataFileBuilder addScalarParameter(String name, int value) { String currentLine = String.format(Locale.UK, "param %s := %d;", name, value); if (lines == null) throw new RuntimeException("lines should not be null"); lines.add(currentLine);//from ww w .java2s .c o m return this; }