Java Code Examples for java.util.Locale.GERMAN

The following are Jave code examples for showing how to use GERMAN of the java.util.Locale class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: oscm   File: BigDecimalConverterTest.java   View Source Code Vote up 6 votes
/**
 * Test for getting value for German local.
 */
@Test
public void getAsObject_GermanLocale() throws ConverterException {
    context = new FacesContextStub(Locale.GERMAN);

    String str = "1,23";
    UIComponent component = ConverterTestHelper.getComponent(false, null,
            null, "discount");
    BigDecimal expected = new BigDecimal("1.23");

    BigDecimal actual = (BigDecimal) converter.getAsObject(context,
            component, str);

    assertEquals(expected, actual);
    context = new FacesContextStub(Locale.ENGLISH);
}
 
Example 2
Project: myfaces-trinidad   File: TrinidadDateTimeConverterTest.java   View Source Code Vote up 6 votes
private Object[][] _getDataForPatterns()
{
  // pattern, inputvalue,locale,timezone
  Object[][] data =
  {
    {"yyyy.MM.dd G 'at' HH:mm:ss z", "2001.07.04 AD at 12:08:56 PDT", Locale.US, null },

    {"EEE, MMM d, ''yy","Wed, Jul 4, '01", Locale.ENGLISH, getTzone("GMT")},

    {"h:mm a","12:08 PM", Locale.GERMAN, getTzone("GMT+1")},

    {"hh 'o''clock' a, zzzz","12 o'clock PM, Pacific Standard Time", Locale.CANADA, getTzone("GMT-8")},

    {"K:mm a, z","0:08 PM, PST", Locale.US, getTzone("PST")},

    {"yyyyy.MMMMM.dd GGG hh:mm aaa","02001.July.04 AD 12:08 PM", Locale.US, null},
    {"EEE, d MMM yyyy HH:mm:ss Z","Wed, 4 Jul 2001 12:08:56 GMT",Locale.US, getTzone("GMT")},
    {"yyMMddHHmmss", "010704120856", Locale.ENGLISH, null, null},

  };
  return data;
}
 
Example 3
Project: oscm   File: PriceConverterTest.java   View Source Code Vote up 5 votes
@Test
public void testParse_GermanLocaleOwnOutput() throws Exception {
    PriceConverter converter = new PriceConverter(Locale.GERMAN);
    Assert.assertEquals(Locale.GERMAN, converter.getActiveLocale());
    long price = 50L;
    String valueToDisplay = converter.getValueToDisplay(new BigDecimal(
            price), true);
    BigDecimal valueToStore = converter.parse(valueToDisplay);
    checkEquals("50.00", valueToStore);
}
 
Example 4
Project: open-rmbt   File: RMBTMainActivity.java   View Source Code Vote up 5 votes
/**
 * 
 * @param toFile
 */
public void redirectSystemOutput(boolean toFile) {
    try {
    	if (toFile) {
    		Log.i(DEBUG_TAG,"redirecting sysout to file");
    		//Redirecting console output and runtime exceptions to file (System.out.println)
    		File f = new File(Environment.getExternalStorageDirectory(), "qosdebug");
    		if (!f.exists()) {
    			f.mkdir();
    		}
        
    		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd", Locale.GERMAN);
    		//PrintStream fileStream = new PrintStream(new File(f, sdf.format(new Date()) + ".txt"));
    		PrintStream fileStream = new DebugPrintStream(new File(f, sdf.format(new Date()) + ".txt"));
         
    		//System.setOut(fileStream);
            System.setErr(fileStream);
    	}
    	else {        		
    		//Redirecting console output and runtime exceptions to default output stream
            //System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
            //System.setErr(new PrintStream(new FileOutputStream(FileDescriptor.err)));
            //Log.i(DEBUG_TAG,"redirecting sysout to default");
    	}
    }
    catch (Exception e) {
    	e.printStackTrace();
    }
}
 
Example 5
Project: oscm   File: ParameterValueValidatorTest.java   View Source Code Vote up 5 votes
@Test(expected = ValidatorException.class)
public void testValidate_DurationFloatInputGerman() throws Exception {
    context = new FacesContextStub(Locale.GERMAN);
    UIComponentStub stub = getComponent(DATATYPE_DURATION, false, null,
            null);
    validator.validate(context, stub, "1,1");
}
 
Example 6
Project: openjdk-jdk10   File: Bug8154797.java   View Source Code Vote up 5 votes
public static void main(String args[]) {
    Bug8154797.generateExpectedValues();
    Locale[] locArr = {new Locale("hi", "IN"), Locale.UK, new Locale("fi", "FI"),
                       Locale.ROOT, Locale.GERMAN, Locale.JAPANESE,
                       Locale.ENGLISH, Locale.FRANCE};
    for (Locale loc : locArr) {
        Bug8154797.compareResources(loc);
    }
}
 
Example 7
Project: leoapp-sources   File: QRWriteTask.java   View Source Code Vote up 5 votes
@Override
@SuppressLint("DefaultLocale")
protected Bitmap doInBackground(Void... params) {

    if (!EssensbonUtils.isLoggedIn())
        return null;

    if (hasActiveInternetConnection()) {
        if (onAppStart) {
            if (EssensbonUtils.isAutoSyncEnabled())
                saveNewestEntries();
        } else
            saveNewestEntries();
    }

    Order act = getRecentEntry();
    if (act == null)
        return null;

    menu = act.getMenu();
    description = act.getDescr();
    short id = act.getId();

    DateFormat dateFormat = new SimpleDateFormat("ddMMyyy", Locale.GERMAN);
    Date       date       = new Date();
    String     dateS      = dateFormat.format(date);
    dateS = dateS.substring(0, 4) + dateS.substring(5);

    int cur = Integer.parseInt(dateS)+id;
    int mod = cur%97;
    int fin = 98-mod;

    String formattedChecksum = String.format("%02d", fin);

    String code = id+"-"+"M"+menu+"-"+dateS+"-"+formattedChecksum;

    return createNewQR(code);
}
 
Example 8
Project: openjdk-jdk10   File: TestChronoField.java   View Source Code Vote up 5 votes
@DataProvider(name = "localeList")
Locale[] data_localeList() {
    return new Locale[] {
            Locale.US,
            Locale.GERMAN,
            Locale.JAPAN,
            Locale.ROOT,
    };
}
 
Example 9
Project: oscm   File: PriceConverterTest.java   View Source Code Vote up 5 votes
@Test
public void testParse_GermanLocaleWithSeparators() throws Exception {
    PriceConverter converter = new PriceConverter(Locale.GERMAN);
    Assert.assertEquals(Locale.GERMAN, converter.getActiveLocale());
    BigDecimal valueToStore = converter.parse("...,3");
    checkEquals("0.3", valueToStore);
    String valueToDisplay = converter.getValueToDisplay(valueToStore, true);
    Assert.assertEquals("0,30", valueToDisplay);
}
 
Example 10
Project: oscm   File: PriceConverterTest.java   View Source Code Vote up 5 votes
@Test
public void testParse_GermanLocaleWithSeparator() throws Exception {
    PriceConverter converter = new PriceConverter(Locale.GERMAN);
    Assert.assertEquals(Locale.GERMAN, converter.getActiveLocale());
    BigDecimal valueToStore = converter.parse("50.000,14");
    checkEquals("50000.14", valueToStore);
}
 
Example 11
Project: oscm   File: PriceConverterTest.java   View Source Code Vote up 5 votes
@Test
public void testParse_MaximumIntegerDigitsDE_WithGroupingSeparators()
        throws Exception {
    PriceConverter converter = new PriceConverter(Locale.GERMAN);
    Assert.assertEquals(Locale.GERMAN, converter.getActiveLocale());
    BigDecimal d = converter
            .parse("111111111111111111111.1.1111111111111111111111.111.111,001");
    assertEquals(new BigDecimal(
            "11111111111111111111111111111111111111111111111111.001"), d);
}
 
Example 12
Project: OpenJSharp   File: MessageCatalog.java   View Source Code Vote up 5 votes
private Locale getLocale(String localeName) {
    String language, country;
    int index;

    index = localeName.indexOf('_');
    if (index == -1) {
        //
        // Special case the builtin JDK languages
        //
        if (localeName.equals("de"))
            return Locale.GERMAN;
        if (localeName.equals("en"))
            return Locale.ENGLISH;
        if (localeName.equals("fr"))
            return Locale.FRENCH;
        if (localeName.equals("it"))
            return Locale.ITALIAN;
        if (localeName.equals("ja"))
            return Locale.JAPANESE;
        if (localeName.equals("ko"))
            return Locale.KOREAN;
        if (localeName.equals("zh"))
            return Locale.CHINESE;

        language = localeName;
        country = "";
    } else {
        if (localeName.equals("zh_CN"))
            return Locale.SIMPLIFIED_CHINESE;
        if (localeName.equals("zh_TW"))
            return Locale.TRADITIONAL_CHINESE;

        //
        // JDK also has constants for countries:  en_GB, en_US, en_CA,
        // fr_FR, fr_CA, de_DE, ja_JP, ko_KR.  We don't use those.
        //
        language = localeName.substring(0, index);
        country = localeName.substring(index + 1);
    }

    return new Locale(language, country);
}
 
Example 13
Project: oscm   File: DbMessages_de.java   View Source Code Vote up 4 votes
public DbMessages_de() throws IOException {
    super(Locale.GERMAN);
}
 
Example 14
Project: oscm   File: DefaultMessages_de.java   View Source Code Vote up 4 votes
public DefaultMessages_de() throws IOException {
    super(Locale.GERMAN);
}
 
Example 15
Project: waterrower-workout   File: TestDateTimeFormatter.java   View Source Code Vote up 4 votes
@Test
public void asTime_withLocaleGERMAN_returns_19_28() throws Exception {
    dateTimeFormatter = new DateTimeFormatter(Locale.GERMAN);
    assertEquals("19:28", dateTimeFormatter.asTime(of(19, 28, 15)));
}
 
Example 16
Project: smarti   File: DateUtils.java   View Source Code Vote up 4 votes
@Override
protected DateFormat initialValue() {
    return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXX", Locale.GERMAN);

}
 
Example 17
Project: oscm   File: PriceConverterTest.java   View Source Code Vote up 4 votes
@Test
public void testParse_GermanLocaleZero() throws Exception {
    PriceConverter converter = new PriceConverter(Locale.GERMAN);
    Assert.assertEquals(Locale.GERMAN, converter.getActiveLocale());
    checkEquals("0.00", converter.parse("0,00"));
}
 
Example 18
Project: waterrower-workout   File: TestDateTimeFormatter.java   View Source Code Vote up 4 votes
@Test
public void asPrettyTime_withLocaleGERMANAnd1DayAgo_returns_1_day_ago() throws Exception {
    dateTimeFormatter = new DateTimeFormatter(Locale.GERMAN);
    assertEquals("vor 1 Tag", dateTimeFormatter.asPrettyTime(now().minusDays(1)));
}
 
Example 19
Project: smarti   File: DbKonzernSynonymVocab.java   View Source Code Vote up 4 votes
public DbKonzernSynonymVocab(@Value("${smarti.extractor.synonyms.db}") Resource dataFile) {
    super("DB-Konzern Synonyme", new NerTag("db-entity",Token.Type.Term.name()), Locale.GERMAN, CaseSensitivity.smart, CSVFormat.DEFAULT.withDelimiter(';'));
    this.dataFile = dataFile;
}
 
Example 20
Project: openjdk-jdk10   File: MessageCatalog.java   View Source Code Vote up 4 votes
private Locale getLocale(String localeName) {
    String language, country;
    int index;

    index = localeName.indexOf('_');
    if (index == -1) {
        //
        // Special case the builtin JDK languages
        //
        if (localeName.equals("de"))
            return Locale.GERMAN;
        if (localeName.equals("en"))
            return Locale.ENGLISH;
        if (localeName.equals("fr"))
            return Locale.FRENCH;
        if (localeName.equals("it"))
            return Locale.ITALIAN;
        if (localeName.equals("ja"))
            return Locale.JAPANESE;
        if (localeName.equals("ko"))
            return Locale.KOREAN;
        if (localeName.equals("zh"))
            return Locale.CHINESE;

        language = localeName;
        country = "";
    } else {
        if (localeName.equals("zh_CN"))
            return Locale.SIMPLIFIED_CHINESE;
        if (localeName.equals("zh_TW"))
            return Locale.TRADITIONAL_CHINESE;

        //
        // JDK also has constants for countries:  en_GB, en_US, en_CA,
        // fr_FR, fr_CA, de_DE, ja_JP, ko_KR.  We don't use those.
        //
        language = localeName.substring(0, index);
        country = localeName.substring(index + 1);
    }

    return new Locale(language, country);
}