Java Code Examples for java.util.Locale#KOREAN

The following examples show how to use java.util.Locale#KOREAN . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * 获取选择的语言设置
 *
 * @return
 */
public static Locale getSetLanguageLocale() {
    int language = Arad.preferences.getInteger(Constants.P_SETTING_LANGUAGE, -1);

    switch (language) {
        case 0:
            return Locale.CHINESE;
        case 1:
            return Locale.TAIWAN;
        case 2:
            return Locale.ENGLISH;
        case 3:
            return Locale.JAPANESE;
        case 4:
            return Locale.KOREAN;
        default:
            return getSystemLocale();
    }
}
 
Example 2
@Test
public void testLocale()
{
    Locale locale = Locale.KOREAN;
    Session localeSession = Session.builder(this.session)
            .setTimeZoneKey(TIME_ZONE_KEY)
            .setLocale(locale)
            .build();

    try (FunctionAssertions localeAssertions = new FunctionAssertions(localeSession)) {
        String dateTimeLiteral = "TIMESTAMP '2001-01-09 13:04:05.321'";

        localeAssertions.assertFunction("date_format(" + dateTimeLiteral + ", '%a')", VARCHAR, "화");
        localeAssertions.assertFunction("date_format(" + dateTimeLiteral + ", '%W')", VARCHAR, "화요일");
        localeAssertions.assertFunction("date_format(" + dateTimeLiteral + ", '%p')", VARCHAR, "오후");
        localeAssertions.assertFunction("date_format(" + dateTimeLiteral + ", '%r')", VARCHAR, "01:04:05 오후");
        localeAssertions.assertFunction("date_format(" + dateTimeLiteral + ", '%b')", VARCHAR, "1월");
        localeAssertions.assertFunction("date_format(" + dateTimeLiteral + ", '%M')", VARCHAR, "1월");

        localeAssertions.assertFunction("format_datetime(" + dateTimeLiteral + ", 'EEE')", VARCHAR, "화");
        localeAssertions.assertFunction("format_datetime(" + dateTimeLiteral + ", 'EEEE')", VARCHAR, "화요일");
        localeAssertions.assertFunction("format_datetime(" + dateTimeLiteral + ", 'a')", VARCHAR, "오후");
        localeAssertions.assertFunction("format_datetime(" + dateTimeLiteral + ", 'MMM')", VARCHAR, "1월");
        localeAssertions.assertFunction("format_datetime(" + dateTimeLiteral + ", 'MMMM')", VARCHAR, "1월");

        localeAssertions.assertFunction("date_parse('2013-05-17 12:35:10 오후', '%Y-%m-%d %h:%i:%s %p')",
                TimestampType.TIMESTAMP,
                sqlTimestampOf(3, 2013, 5, 17, 12, 35, 10, 0, localeSession));
        localeAssertions.assertFunction("date_parse('2013-05-17 12:35:10 오전', '%Y-%m-%d %h:%i:%s %p')",
                TimestampType.TIMESTAMP,
                sqlTimestampOf(3, 2013, 5, 17, 0, 35, 10, 0, localeSession));

        localeAssertions.assertFunction("parse_datetime('2013-05-17 12:35:10 오후', 'yyyy-MM-dd hh:mm:ss a')",
                TIMESTAMP_WITH_TIME_ZONE,
                toTimestampWithTimeZone(new DateTime(2013, 5, 17, 12, 35, 10, 0, DATE_TIME_ZONE)));
        localeAssertions.assertFunction("parse_datetime('2013-05-17 12:35:10 오전', 'yyyy-MM-dd hh:mm:ss aaa')",
                TIMESTAMP_WITH_TIME_ZONE,
                toTimestampWithTimeZone(new DateTime(2013, 5, 17, 0, 35, 10, 0, DATE_TIME_ZONE)));
    }
}
 
Example 3
Source Project: android   File: ExampleUnitTest.java    License: MIT License 5 votes vote down vote up
@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);
    }
}
 
Example 4
Source Project: SI   File: DateTimeUtil.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
* 날짜를 파리미터로 넘겨준 형식대로 취득한다。
* @param pattern (YYMMDD날짜형식)
* @return String 취득한형식화된 날짜
*/
  public static String getDateTimeByPattern(String pattern) {
      SimpleDateFormat formatter = new SimpleDateFormat(
              pattern, Locale.KOREAN);
      String dateString = formatter.format(new Date());

      return dateString;
  }
 
Example 5
Source Project: SI   File: DateTimeUtil.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
* 날짜를 파리미터로 넘겨준 형식대로 취득한다。
* @param pattern (YYMMDD날짜형식)
* @return String 취득한형식화된 날짜
*/
  public static String getDateTimeByPattern(String pattern) {
      SimpleDateFormat formatter = new SimpleDateFormat(
              pattern, Locale.KOREAN);
      String dateString = formatter.format(new Date());

      return dateString;
  }
 
Example 6
Source Project: jakduk-api   File: NotificationTest.java    License: MIT License 5 votes vote down vote up
@Ignore
@Test
public void 메일발송() throws MessagingException {

    Locale locale = Locale.KOREAN;

    emailService.sendMailWithInline("Pyohwan", "[email protected]", locale);
}
 
Example 7
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 8
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 9
@Override
public Locale getLocale() {
    return Locale.KOREAN;
}
 
Example 10
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 11
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 12
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
Source Project: gplaymusic   File: LanguageTest.java    License: MIT License 4 votes vote down vote up
@Test
public void testNotExistingLocale() {
  //Change if this locale is added.
  Locale locale = Locale.KOREAN;
  Assert.assertEquals("Test string.", Language.get("test.TestString"));
}
 
Example 14
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 15
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 16
@Override
public String callOsService(ReqSmartHelper req, HttpServletRequest request, TrackingEntity trackingEntity) {

	String resultMsg=null;
       setTracking((TrackingEntity) request.getSession().getAttribute("tracking"));
	
	String locId = req.getLocation();

	String serviceName = req.getServiceName();
	String contextModelId="SmartHelper";
	String contextModelName="스마트헬퍼";
   	String sessionId = trackingEntity.getSessionId();
	
       // grib session
       SessionEntity sessionEntity = new SessionEntity();
       sessionEntity.setId(sessionId);
       sessionEntity.setContextmodelKey(contextModelId);
       sessionEntity.setContextmodelName(contextModelName);
       sessionEntity.setContextmodelResult("NotHappen");
       sessionEntity.setProfileName(serviceName);
       //sessionEntity.setPriorityKey("LOW");
       log.debug("session : {}", sessionEntity);
       dataBaseStore.createSessionData(sessionEntity);

	LocationForDB locForDB = dataBaseStore.getLocationById(locId);
	if (locForDB==null) {
           log.error("Error Invalid LocationId={}", locId);
		return null;
	}
	String locationUri =  locForDB.getUri();
       
       // grib session location
       SessionEntity sessionLocation = new SessionEntity();
       sessionLocation.setId(sessionId);
       sessionLocation.setLocationId(locationUri);
       log.debug("session location : {}", sessionLocation);
       try {
       	dataBaseStore.createSessionDataLocation(sessionLocation);
       }catch(Exception e) {
           log.error("Error createSessionDataLocation : error={},\n sessionLocation={}", e.getMessage(), sessionLocation);
       }
       
	SmartHelperForDB param = new SmartHelperForDB();
	param.setLocationId(locId);
	param.setName(serviceName);
	List <SmartHelperForDB> smartHelperForDbList = smartHelperDao.retrieveByParam(param);
	
	if (smartHelperForDbList==null || smartHelperForDbList.size()==0) { //일치되는 자료 없음
		return null;
	}

	
	//2개이상 OS가 연결되면 무시? 에러?
	
	//첫번째 OS만 유효
	for (SmartHelperForDB item: smartHelperForDbList) {

           getTracking().setProcessId(item.getId());
           getTracking().setProcessName(item.getName());
           TrackingProducer.send(getTracking());

           // grib session profile
           SessionEntity sessionProfile = new SessionEntity();
           sessionProfile.setId(sessionId);
           sessionProfile.setProfileKey(item.getId());
           //sessionProfile.setProfileName(item.getName());
           sessionProfile.setPriorityKey("LOW");
           log.debug("session profile : {}", sessionProfile);
           dataBaseStore.updateSessionData(sessionProfile);
		
		
		String osId = item.getOrchestrationServiceId();

		DefaultOrchestrationService orchestrationService = new DefaultOrchestrationService();
		orchestrationService.setId(osId);
		publishOrchestrationService(orchestrationService, locationUri, contextModelId);

		
		String locName =  locForDB.getName();
		
		Date date = Calendar.getInstance().getTime();
		SimpleDateFormat formatter=new SimpleDateFormat("yyyy년 MM월 dd일 E요일 a hh시",  Locale.KOREAN); 
		String time = formatter.format(date);
		
		resultMsg = item.getSuccessMsg();
		resultMsg = resultMsg.replace("{{loc}}", locName);
		resultMsg = resultMsg.replace("{{time}}", time);
		break;
	}

	return resultMsg;
}
 
Example 17
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 18
@Override
public String callOsService(ReqSmartHelper req, HttpServletRequest request, TrackingEntity trackingEntity) {

	String resultMsg=null;
       setTracking((TrackingEntity) request.getSession().getAttribute("tracking"));
	
	String locId = req.getLocation();

	String serviceName = req.getServiceName();
	String contextModelId="SmartHelper";
	String contextModelName="스마트헬퍼";
   	String sessionId = trackingEntity.getSessionId();
	
       // grib session
       SessionEntity sessionEntity = new SessionEntity();
       sessionEntity.setId(sessionId);
       sessionEntity.setContextmodelKey(contextModelId);
       sessionEntity.setContextmodelName(contextModelName);
       sessionEntity.setContextmodelResult("NotHappen");
       sessionEntity.setProfileName(serviceName);
       //sessionEntity.setPriorityKey("LOW");
       log.debug("session : {}", sessionEntity);
       dataBaseStore.createSessionData(sessionEntity);

	LocationForDB locForDB = dataBaseStore.getLocationById(locId);
	if (locForDB==null) {
           log.error("Error Invalid LocationId={}", locId);
		return null;
	}
	String locationUri =  locForDB.getUri();
       
       // grib session location
       SessionEntity sessionLocation = new SessionEntity();
       sessionLocation.setId(sessionId);
       sessionLocation.setLocationId(locationUri);
       log.debug("session location : {}", sessionLocation);
       try {
       	dataBaseStore.createSessionDataLocation(sessionLocation);
       }catch(Exception e) {
           log.error("Error createSessionDataLocation : error={},\n sessionLocation={}", e.getMessage(), sessionLocation);
       }
       
	SmartHelperForDB param = new SmartHelperForDB();
	param.setLocationId(locId);
	param.setName(serviceName);
	List <SmartHelperForDB> smartHelperForDbList = smartHelperDao.retrieveByParam(param);
	
	if (smartHelperForDbList==null || smartHelperForDbList.size()==0) { //일치되는 자료 없음
		return null;
	}

	
	//2개이상 OS가 연결되면 무시? 에러?
	
	//첫번째 OS만 유효
	for (SmartHelperForDB item: smartHelperForDbList) {

           getTracking().setProcessId(item.getId());
           getTracking().setProcessName(item.getName());
           TrackingProducer.send(getTracking());

           // grib session profile
           SessionEntity sessionProfile = new SessionEntity();
           sessionProfile.setId(sessionId);
           sessionProfile.setProfileKey(item.getId());
           //sessionProfile.setProfileName(item.getName());
           sessionProfile.setPriorityKey("LOW");
           log.debug("session profile : {}", sessionProfile);
           dataBaseStore.updateSessionData(sessionProfile);
		
		
		String osId = item.getOrchestrationServiceId();

		DefaultOrchestrationService orchestrationService = new DefaultOrchestrationService();
		orchestrationService.setId(osId);
		publishOrchestrationService(orchestrationService, locationUri, contextModelId);

		
		String locName =  locForDB.getName();
		
		Date date = Calendar.getInstance().getTime();
		SimpleDateFormat formatter=new SimpleDateFormat("yyyy년 MM월 dd일 E요일 a hh시",  Locale.KOREAN); 
		String time = formatter.format(date);
		
		resultMsg = item.getSuccessMsg();
		resultMsg = resultMsg.replace("{{loc}}", locName);
		resultMsg = resultMsg.replace("{{time}}", time);
		break;
	}

	return resultMsg;
}
 
Example 19
Source Project: jphp   File: WrapLocale.java    License: Apache License 2.0 4 votes vote down vote up
@Signature
public static Memory KOREAN(Environment env, Memory... args) {
    return new ObjectMemory(new WrapLocale(env, Locale.KOREAN));
}