List of usage examples for java.util Locale CANADA_FRENCH
Locale CANADA_FRENCH
To view the source code for java.util Locale CANADA_FRENCH.
Click Source Link
From source file:org.obiba.onyx.print.impl.DefaultPrintableReportsRegistryTest.java
@Before public void setUp() throws Exception { printableReportsRegistry = new DefaultPrintableReportsRegistry(); ApplicationContextMock mockCtx = new ApplicationContextMock(); mockCtx.putBean("consentReport", getPrintableReport(Collections.<Locale>emptySet(), "ConsentReport", notLocalisble, ready)); Set<Locale> locales = new HashSet<Locale>(); locales.add(Locale.CANADA_FRENCH); mockCtx.putBean("participantReport", getPrintableReport(locales, "ParticipantReport", localisable, ready)); printableReportsRegistry.setApplicationContext(mockCtx); }
From source file:uk.q3c.krail.i18n.DefaultPatternUtilityTest.java
@Test public void writeOut_locales_provided_all_keys() throws IOException { // given File testOutDir = new File(ResourceUtils.userTempDirectory(), "testOut"); if (testOutDir.exists()) { FileUtils.deleteQuietly(testOutDir); }//from w w w .j av a 2s . c o m File targetDir = new File(ResourceUtils.userTempDirectory(), "testOut/codeModel"); writer.setOptionWritePath(targetDir); Set<Locale> locales = new HashSet<>(); locales.add(Locale.GERMAN); locales.add(Locale.ITALIAN); locales.add(Locale.UK); locales.add(Locale.forLanguageTag("")); File referenceFile = new File(TestResource.testResourceRootDir("krail"), "Labels.ref"); File targetFile = new File(targetDir, "Labels.java"); File referenceFile_de = new File(TestResource.testResourceRootDir("krail"), "Labels_de.ref"); File targetFile_de = new File(targetDir, "Labels_de.java"); File referenceFile_it = new File(TestResource.testResourceRootDir("krail"), "Labels_it.ref"); File targetFile_it = new File(targetDir, "Labels_it.java"); File referenceFile_en_GB = new File(TestResource.testResourceRootDir("krail"), "Labels_en_GB.ref"); File targetFile_en_GB = new File(targetDir, "Labels_en_GB.java"); // this is to make sure that setting the default does not mess things up Locale.setDefault(Locale.CANADA_FRENCH); //when utility.writeOut(writer, LabelKey.class, locales, Optional.empty()); //then line 4 is the timestamp assertThat(FileTestUtil.compare(referenceFile, targetFile, 4)).isEqualTo(Optional.empty()); assertThat(FileTestUtil.compare(referenceFile_de, targetFile_de, 4)).isEqualTo(Optional.empty()); assertThat(FileTestUtil.compare(referenceFile_it, targetFile_it, 4)).isEqualTo(Optional.empty()); assertThat(FileTestUtil.compare(referenceFile_en_GB, targetFile_en_GB, 4)).isEqualTo(Optional.empty()); }
From source file:org.opendatakit.common.android.utilities.ODKDataUtilsTest.java
@Test public void testNormalizeDisplayName() throws JsonProcessingException { Map<String, Object> langMap = new TreeMap<String, Object>(); langMap.put("en_US", "This is a test"); langMap.put("en_GB", "Test is This"); langMap.put("en", "Huh Test"); langMap.put("fr", "Je suis"); langMap.put("default", "No way!"); String value = ODKFileUtils.mapper.writeValueAsString(langMap); String match;//from ww w . ja v a 2s . c o m Locale.setDefault(Locale.US); match = ODKDataUtils.getLocalizedDisplayName(value); assertEquals("This is a test", match); Locale.setDefault(Locale.UK); match = ODKDataUtils.getLocalizedDisplayName(value); assertEquals("Test is This", match); Locale.setDefault(Locale.CANADA); match = ODKDataUtils.getLocalizedDisplayName(value); assertEquals("Huh Test", match); Locale.setDefault(Locale.CANADA_FRENCH); match = ODKDataUtils.getLocalizedDisplayName(value); assertEquals("Je suis", match); Locale.setDefault(Locale.GERMANY); match = ODKDataUtils.getLocalizedDisplayName(value); assertEquals("No way!", match); Locale.setDefault(Locale.US); }
From source file:com.netflix.imfutility.itunes.asset.SubtitlesAssetProcessorTest.java
@Test public void testCorrectSubtitles() throws Exception { SubtitlesAssetProcessor processor = new SubtitlesAssetProcessor(metadataXmlProvider, destDir); processor.setLocale(Locale.CANADA_FRENCH).process(inputAsset); // input asset must be moved to dest dir assertFalse(inputAsset.exists());//from w ww. ja v a 2 s .co m File outputAsset = new File(destDir, "subtitles_FR_CA.itt"); assertTrue(outputAsset.exists()); assertTrue(outputAsset.isFile()); Asset subtitlesAsset = metadataXmlProvider.getRootElement().getAssets().get(0); assertEquals(AssetType.FULL, subtitlesAsset.getType()); assertEquals(AssetRole.SUBTITLES, subtitlesAsset.getRole()); assertEquals(Locale.CANADA_FRENCH, subtitlesAsset.getLocale()); assertEquals("subtitles_FR_CA.itt", subtitlesAsset.getFileName()); }
From source file:org.opendatakit.utilities.LocalizationUtilsTest.java
@Test public void testNormalizeDisplayName() throws JsonProcessingException { Map<String, Object> langMap = new TreeMap<String, Object>(); langMap.put("en_US", "This is a test"); langMap.put("en_GB", "Test is This"); langMap.put("en", "Huh Test"); langMap.put("fr", "Je suis"); langMap.put("default", "No way!"); Map<String, Object> topMap = new TreeMap<String, Object>(); topMap.put("text", langMap); String value = ODKFileUtils.mapper.writeValueAsString(topMap); Locale defaultLocale;/*w w w . ja va 2 s .c o m*/ String full_locale; String match; Locale.setDefault(Locale.US); defaultLocale = Locale.getDefault(); full_locale = defaultLocale.getLanguage() + "_" + defaultLocale.getCountry(); match = LocalizationUtils.getLocalizedDisplayName(appName, tableId, full_locale, value); assertEquals("This is a test", match); Locale.setDefault(Locale.UK); defaultLocale = Locale.getDefault(); full_locale = defaultLocale.getLanguage() + "_" + defaultLocale.getCountry(); match = LocalizationUtils.getLocalizedDisplayName(appName, tableId, full_locale, value); assertEquals("Test is This", match); Locale.setDefault(Locale.CANADA); defaultLocale = Locale.getDefault(); full_locale = defaultLocale.getLanguage() + "_" + defaultLocale.getCountry(); match = LocalizationUtils.getLocalizedDisplayName(appName, tableId, full_locale, value); assertEquals("Huh Test", match); Locale.setDefault(Locale.CANADA_FRENCH); defaultLocale = Locale.getDefault(); full_locale = defaultLocale.getLanguage() + "_" + defaultLocale.getCountry(); match = LocalizationUtils.getLocalizedDisplayName(appName, tableId, full_locale, value); assertEquals("Je suis", match); Locale.setDefault(Locale.GERMANY); defaultLocale = Locale.getDefault(); full_locale = defaultLocale.getLanguage() + "_" + defaultLocale.getCountry(); match = LocalizationUtils.getLocalizedDisplayName(appName, tableId, full_locale, value); assertEquals("No way!", match); Locale.setDefault(Locale.US); }
From source file:org.codekaizen.vtj.text.BpDateFormatTest.java
/** * DOCUMENT ME!/* ww w.j av a 2 s . c o m*/ */ public void testFormatting() { DateFormat fmt1 = null; DateFormat fmt2 = null; Date date = null; String s1 = null; String s2 = null; date = new Date(); fmt1 = new BpDateFormat(BpDateFormat.JVM_DATE_TIME, null); fmt2 = DateFormat.getDateTimeInstance(); s1 = fmt1.format(date); s2 = fmt2.format(date); assertEquals(s2, s1); fmt1 = new BpDateFormat(BpDateFormat.JVM_DATE_ONLY, null); fmt2 = DateFormat.getDateInstance(DateFormat.SHORT); s1 = fmt1.format(date); s2 = fmt2.format(date); assertEquals(s2, s1); fmt1 = new BpDateFormat(BpDateFormat.JVM_TIME_ONLY, null); fmt2 = DateFormat.getTimeInstance(DateFormat.SHORT); s1 = fmt1.format(date); s2 = fmt2.format(date); assertEquals(s2, s1); fmt1 = new BpDateFormat(BpDateFormat.JVM_FULL_DATE, null); fmt2 = DateFormat.getDateInstance(DateFormat.FULL); s1 = fmt1.format(date); s2 = fmt2.format(date); assertEquals(s2, s1); fmt1 = new BpDateFormat(BpDateFormat.JVM_DATE_TIME, Locale.CANADA_FRENCH); fmt2 = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.CANADA_FRENCH); s1 = fmt1.format(date); s2 = fmt2.format(date); assertEquals(s2, s1); }
From source file:org.opendatakit.common.android.utilities.ODKDataUtilsTest.java
@Test public void testNormalizeDisplayName2() { Map<String, Object> langMap = new TreeMap<String, Object>(); langMap.put("en_US", "This is a test"); langMap.put("en_GB", "Test is This"); langMap.put("en", "Huh Test"); langMap.put("fr", "Je suis"); langMap.put("default", "No way!"); String match;/*w w w . j av a 2 s . co m*/ Locale.setDefault(Locale.US); match = ODKDataUtils.getLocalizedDisplayName(langMap); assertEquals("This is a test", match); Locale.setDefault(Locale.UK); match = ODKDataUtils.getLocalizedDisplayName(langMap); assertEquals("Test is This", match); Locale.setDefault(Locale.CANADA); match = ODKDataUtils.getLocalizedDisplayName(langMap); assertEquals("Huh Test", match); Locale.setDefault(Locale.CANADA_FRENCH); match = ODKDataUtils.getLocalizedDisplayName(langMap); assertEquals("Je suis", match); Locale.setDefault(Locale.GERMANY); match = ODKDataUtils.getLocalizedDisplayName(langMap); assertEquals("No way!", match); Locale.setDefault(Locale.US); }
From source file:org.apache.tiles.definition.TestUrlDefinitionsFactory.java
/** * Tests the getDefinition method./*from w ww. ja v a 2 s. c o m*/ * * @throws Exception If something goes wrong. */ @SuppressWarnings("unchecked") public void testGetDefinition() throws Exception { DefinitionsFactory factory = new UrlDefinitionsFactory(); // Set up multiple data sources. URL url1 = this.getClass().getClassLoader().getResource("org/apache/tiles/config/defs1.xml"); assertNotNull("Could not load defs1 file.", url1); URL url2 = this.getClass().getClassLoader().getResource("org/apache/tiles/config/defs2.xml"); assertNotNull("Could not load defs2 file.", url2); URL url3 = this.getClass().getClassLoader().getResource("org/apache/tiles/config/defs3.xml"); assertNotNull("Could not load defs3 file.", url3); factory.addSource(url1); factory.addSource(url2); factory.addSource(url3); factory.init(Collections.EMPTY_MAP); TilesRequestContext emptyContext = new MockOnlyLocaleTilesContext(null); TilesRequestContext usContext = new MockOnlyLocaleTilesContext(Locale.US); TilesRequestContext frenchContext = new MockOnlyLocaleTilesContext(Locale.FRENCH); TilesRequestContext chinaContext = new MockOnlyLocaleTilesContext(Locale.CHINA); TilesRequestContext canadaFrenchContext = new MockOnlyLocaleTilesContext(Locale.CANADA_FRENCH); assertNotNull("test.def1 definition not found.", factory.getDefinition("test.def1", emptyContext)); assertNotNull("test.def2 definition not found.", factory.getDefinition("test.def2", emptyContext)); assertNotNull("test.def3 definition not found.", factory.getDefinition("test.def3", emptyContext)); assertNotNull("test.common definition not found.", factory.getDefinition("test.common", emptyContext)); assertNotNull("test.common definition in US locale not found.", factory.getDefinition("test.common", usContext)); assertNotNull("test.common definition in FRENCH locale not found.", factory.getDefinition("test.common", frenchContext)); assertNotNull("test.common definition in CHINA locale not found.", factory.getDefinition("test.common", chinaContext)); assertNotNull("test.common.french definition in FRENCH locale not found.", factory.getDefinition("test.common.french", frenchContext)); assertNotNull("test.common.french definition in CANADA_FRENCH locale not found.", factory.getDefinition("test.common.french", canadaFrenchContext)); assertNotNull("test.def.toextend definition not found.", factory.getDefinition("test.def.toextend", emptyContext)); assertNotNull("test.def.overridden definition not found.", factory.getDefinition("test.def.overridden", emptyContext)); assertNotNull("test.def.overridden definition in FRENCH locale not found.", factory.getDefinition("test.def.overridden", frenchContext)); assertEquals("Incorrect default country value", "default", factory.getDefinition("test.def1", emptyContext).getAttribute("country").getValue()); assertEquals("Incorrect US country value", "US", factory.getDefinition("test.def1", usContext).getAttribute("country").getValue()); assertEquals("Incorrect France country value", "France", factory.getDefinition("test.def1", frenchContext).getAttribute("country").getValue()); assertEquals("Incorrect Chinese country value (should be default)", "default", factory.getDefinition("test.def1", chinaContext).getAttribute("country").getValue()); assertEquals("Incorrect default country value", "default", factory.getDefinition("test.def.overridden", emptyContext).getAttribute("country").getValue()); assertEquals("Incorrect default title value", "Definition to be overridden", factory.getDefinition("test.def.overridden", emptyContext).getAttribute("title").getValue()); assertEquals("Incorrect France country value", "France", factory.getDefinition("test.def.overridden", frenchContext).getAttribute("country").getValue()); assertEquals("Incorrect France title value", "Definition to be extended", factory.getDefinition("test.def.overridden", frenchContext).getAttribute("title").getValue()); }
From source file:org.alfresco.repo.domain.locale.LocaleDAOTest.java
public void testDefaultLocale() throws Exception { RetryingTransactionCallback<Pair<Long, Locale>> callback = new RetryingTransactionCallback<Pair<Long, Locale>>() { public Pair<Long, Locale> execute() throws Throwable { // What is the thread's default locale? Locale defaultLocale = I18NUtil.getLocale(); // Now make it Pair<Long, Locale> localePair = localeDAO.getOrCreateDefaultLocalePair(); assertNotNull("Default locale should now exist", localePair); assertEquals("The default locale returned must match the current thread's default locale", defaultLocale, localePair.getSecond()); // Done return localePair; }//w w w . j a v a 2s . co m }; // Check that the default locale is handled properly txnHelper.doInTransaction(callback); // Now change the default locale I18NUtil.setLocale(Locale.CANADA_FRENCH); // Repeat txnHelper.doInTransaction(callback); }
From source file:org.alfresco.repo.search.impl.solr.SolrQueryHTTPClientTest.java
@Test public void testBuildStatsUrl() throws UnsupportedEncodingException { StatsParameters params = getParameters(); String url = client.buildStatsUrl(params, "http://localhost:8080/solr/alfresco/select", Locale.CANADA_FRENCH, null); assertNotNull(url);/*from w w w .j a va 2 s .c o m*/ assertTrue(url.contains("locale=fr_CA")); assertTrue(url.contains("sort=contentsize")); assertTrue(url.contains("fq=ANCESTOR")); }