java.util.Locale#CANADA_FRENCH源码实例Demo

下面列出了java.util.Locale#CANADA_FRENCH 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: alfresco-remote-api   文件: SerializeTests.java
@Test
public void testSerializeBinaryProperty() throws IOException
{
    BinaryProperty prop = new BinaryProperty(Format.JSON.mimetype(),"UTF-8");      
    String out = writeResponse(prop);
    assertTrue("Only show the mimeType",  out.equals("{\"mimeType\":\"application/json\"}"));
    prop = new BinaryProperty(Format.XML.mimetype(),"UTF-8", 45, null);      
    out = writeResponse(prop);
    assertTrue("Type is xml.",  StringUtils.contains(out, "\"mimeType\":\"text/xml\""));
    assertTrue("Size must be serialized.",  StringUtils.contains(out, "\"sizeInBytes\":45"));
    
    prop = new BinaryProperty(Format.XML.mimetype(),"UTF-8", 99, Locale.CANADA_FRENCH);      
    out = writeResponse(prop);
    assertFalse("Locale should not be serialized",  StringUtils.contains(out, "\"locale\""));
    
    //Check binary properties serialize ok as part of a bean.
    Flock flock = new Flock("myflock", 50, null, prop);
    out = writeResponse(flock);
    assertFalse("Locale should not be serialized",  StringUtils.contains(out, "\"locale\""));
    assertTrue("Type is xml.",  StringUtils.contains(out, "\"mimeType\":\"text/xml\""));
    assertTrue("Size must be serialized.",  StringUtils.contains(out, "\"sizeInBytes\":99"));
}
 
public MyCourseDetailAdapter(final Context context, final ListeDesElementsEvaluation courseEvaluation, String cote) {
	super();
	this.courseEvaluation = courseEvaluation;
	this.cote = cote;
	nf_frCA = new DecimalFormat("##,#", new DecimalFormatSymbols(Locale.CANADA_FRENCH));
	nf_enUS = new DecimalFormat("##.#");
	// parse exams results
	for ( ElementEvaluation evaluationElement : courseEvaluation.liste) {
		if(evaluationElement.note !=null){
			if(evaluationElement.ignoreDuCalcul.equals("Non")){
				try {
					final String pond = evaluationElement.ponderation;
					final double value = nf_frCA.parse(pond).doubleValue();
					total += value;
					if(total>100){
						total = 100;
					}
				} catch (final ParseException e) {
				}
			}
		}
	}
	
	ctx = context;
	li = (LayoutInflater) ctx.getSystemService(inflater);
}
 
源代码3 项目: ETSMobile-Android2   文件: TodayWidgetProvider.java
private void setAllWidgetsLocale(Context context, String language) {
    Configuration configuration = new Configuration();
    DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
    Locale locale;

    if (language.equalsIgnoreCase("en")) {
        locale = Locale.ENGLISH;
    } else if (language.equalsIgnoreCase("fr"))
        locale = Locale.CANADA_FRENCH;
    else
        locale = Locale.getDefault();

    Locale.setDefault(locale);
    configuration.locale = locale;
    context.getResources().updateConfiguration(configuration, displayMetrics);
}
 
源代码4 项目: calcite   文件: UtilTest.java
/**
 * Unit test for {@link Util#parseLocale(String)} method.
 */
@Test void testParseLocale() {
  Locale[] locales = {
      Locale.CANADA,
      Locale.CANADA_FRENCH,
      Locale.getDefault(),
      Locale.US,
      Locale.TRADITIONAL_CHINESE,
      Locale.ROOT,
  };
  for (Locale locale : locales) {
    assertEquals(locale, Util.parseLocale(locale.toString()));
  }
  // Example locale names in Locale.toString() javadoc.
  String[] localeNames = {
      "en", "de_DE", "_GB", "en_US_WIN", "de__POSIX", "fr__MAC"
  };
  for (String localeName : localeNames) {
    assertEquals(localeName, Util.parseLocale(localeName).toString());
  }
}
 
源代码5 项目: morphia   文件: LocaleMappingTest.java
@Test
public void testLocaleMapping() {
    E e = new E();
    e.l1 = Locale.CANADA_FRENCH;
    e.l2 = Arrays.asList(Locale.GERMANY, Locale.TRADITIONAL_CHINESE);
    e.l3 = new Locale[]{Locale.TRADITIONAL_CHINESE, Locale.FRENCH};

    getDs().save(e);
    final Datastore datastore = getDs();
    e = datastore.find(E.class)
                 .filter(eq("_id", e.id))
                 .first();

    Assert.assertEquals(Locale.CANADA_FRENCH, e.l1);

    Assert.assertEquals(2, e.l2.size());
    Assert.assertEquals(Locale.GERMANY, e.l2.get(0));
    Assert.assertEquals(Locale.TRADITIONAL_CHINESE, e.l2.get(1));

    Assert.assertEquals(2, e.l3.length);
    Assert.assertEquals(Locale.TRADITIONAL_CHINESE, e.l3[0]);
    Assert.assertEquals(Locale.FRENCH, e.l3[1]);

}
 
源代码6 项目: alfresco-data-model   文件: MLTextTest.java
@Override
protected void setUp()
{
    mlText = new MLText(Locale.CANADA_FRENCH, Locale.CANADA_FRENCH.toString());
    mlText.addValue(Locale.US, Locale.US.toString());
    mlText.addValue(Locale.UK, Locale.UK.toString());
    mlText.addValue(Locale.FRENCH, Locale.FRENCH.toString());
    mlText.addValue(Locale.CHINESE, Locale.CHINESE.toString());
}
 
源代码7 项目: android   文件: ExampleUnitTest.java
@Test
public void testStringLocale() throws Exception {
    Locale[] locales = new Locale[]{
            Locale.CANADA,
            Locale.CANADA_FRENCH,
            Locale.CHINESE,
            Locale.ENGLISH,
            Locale.FRANCE,
            Locale.GERMAN,
            Locale.GERMANY,
            Locale.ITALIAN,
            Locale.ITALY,
            Locale.JAPAN,
            Locale.JAPANESE,
            Locale.KOREA,
            Locale.KOREAN,
            Locale.PRC,
            Locale.ROOT,
            Locale.SIMPLIFIED_CHINESE,
            Locale.TAIWAN,
            Locale.TRADITIONAL_CHINESE,
            Locale.UK,
            Locale.US
    };

    String weightString = null;
    for (Locale locale : locales) {
        try {
            weightString = formatFloatWithOneDot(locale, 55.4f);
            float weight = Float.parseFloat(weightString);
        } catch (NumberFormatException e) {
            System.out.println(locale + ">>>>>" + weightString + ">>>>>>>>>> error");
            continue;
        }
        System.out.println(locale + ">>>>>" + weightString);
    }
}
 
源代码8 项目: cucumber   文件: ParameterTypeRegistryTest.java
@Test
public void parse_decimal_numbers_in_canadian_french() {
    ExpressionFactory factory = new ExpressionFactory(new ParameterTypeRegistry(Locale.CANADA_FRENCH));
    Expression expression = factory.createExpression("{bigdecimal}");

    assertThat(expression.match("1\u00A0000,1").get(0).getValue(), is(new BigDecimal("1000.1")));
    assertThat(expression.match("1\u00A0000\u00A0000,1").get(0).getValue(), is(new BigDecimal("1000000.1")));
    assertThat(expression.match("-1,1").get(0).getValue(), is(new BigDecimal("-1.1")));
    assertThat(expression.match("-,1E1").get(0).getValue(), is(new BigDecimal("-1")));
}
 
源代码9 项目: j2objc   文件: G7CollationTest.java
@Test
public void TestG7Data() {
    Locale locales[] = {
            Locale.US,
            Locale.UK,
            Locale.CANADA,
            Locale.FRANCE,
            Locale.CANADA_FRENCH,
            Locale.GERMANY,
            Locale.JAPAN,
            Locale.ITALY
        };
    int i = 0, j = 0;
    for (i = 0; i < locales.length; i++) {
        Collator myCollation= null;
        RuleBasedCollator tblColl1 = null;
        try {
            myCollation = Collator.getInstance(locales[i]);
            tblColl1 = new RuleBasedCollator(((RuleBasedCollator)myCollation).getRules());
        } catch (Exception foo) {
            warnln("Exception: " + foo.getMessage() +
                  "; Locale : " + locales[i].getDisplayName() + " getRules failed");
            continue;
        }
        for (j = 0; j < FIXEDTESTSET; j++) {
            for (int n = j+1; n < FIXEDTESTSET; n++) {
                doTest(tblColl1, testCases[results[i][j]], testCases[results[i][n]], -1);
            }
        }
        myCollation = null;
    }
}
 
源代码10 项目: ETSMobile-Android2   文件: HoraireManager.java
/**
 * Creates/Updates a new calendar on the user's device
 *
 * @param joursRemplacesSelected true if the "Jours remplacés" calendar was selected
 * @param seancesSelected true if the "Séances" calendar was selected
 * @param calPublicSelected true if the "Calendrier public ÉTS" was selected
 * @throws Exception if there is an SQL when checking the replaced days (Jours remplacés)
 */
public void updateCalendar(boolean joursRemplacesSelected, boolean seancesSelected, boolean calPublicSelected) throws Exception {

    DatabaseHelper dbHelper = new DatabaseHelper(context);
    AndroidCalendarManager androidCalendarManager = new AndroidCalendarManager(context);

    androidCalendarManager.deleteCalendar(calendarName);
    androidCalendarManager.createCalendar(calendarName);

    SimpleDateFormat joursRemplacesFormatter = new SimpleDateFormat("yyyy-MM-dd", Locale.CANADA_FRENCH);

    if (joursRemplacesSelected) {
        //Inserting JoursRemplaces in local calendar
        ArrayList<JoursRemplaces> listeJoursRemplaces = (ArrayList<JoursRemplaces>) dbHelper.getDao(JoursRemplaces.class).queryForAll();


        for (JoursRemplaces joursRemplaces : listeJoursRemplaces) {
            androidCalendarManager.insertEventInCalendar(calendarName,
                    joursRemplaces.description,
                    joursRemplaces.description,
                    "",
                    joursRemplacesFormatter.parse(joursRemplaces.dateOrigine),
                    joursRemplacesFormatter.parse(joursRemplaces.dateOrigine));
        }
    }

    if (seancesSelected) {
        //Inserting Seances in local calendar
        SimpleDateFormat seancesFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.CANADA_FRENCH);
        ArrayList<Seances> seances = (ArrayList<Seances>) dbHelper.getDao(Seances.class).queryForAll();


        for (Seances seance : seances) {

            androidCalendarManager.insertEventInCalendar(calendarName,
                    seance.descriptionActivite.equals("Examen final") ? "Examen final " + seance.coursGroupe : seance.coursGroupe,
                    seance.libelleCours + " - " + seance.descriptionActivite,
                    seance.local,
                    seancesFormatter.parse(seance.dateDebut),
                    seancesFormatter.parse(seance.dateFin));
        }
    }

    if (calPublicSelected) {
        //Inserting public calendar ETS
        ArrayList<Event> events = (ArrayList<Event>) dbHelper.getDao(Event.class).queryForAll();
        for (Event event : events) {
            androidCalendarManager.insertEventInCalendar(calendarName,
                    event.getTitle(),
                    "",
                    ""
                    ,
                    joursRemplacesFormatter.parse(event.getDateDebut()),
                    joursRemplacesFormatter.parse(event.getDateFin()));
        }
    }
}
 
源代码11 项目: gson   文件: DefaultTypeAdaptersTest.java
public void testLocaleSerializationWithLanguageCountry() {
  Locale target = Locale.CANADA_FRENCH;
  assertEquals("\"fr_CA\"", gson.toJson(target));
}
 
源代码12 项目: jphp   文件: WrapLocale.java
@Signature
public static Memory CANADA_FRENCH(Environment env, Memory... args) {
    return new ObjectMemory(new WrapLocale(env, Locale.CANADA_FRENCH));
}