Example usage for java.util Locale JAPAN

List of usage examples for java.util Locale JAPAN

Introduction

In this page you can find the example usage for java.util Locale JAPAN.

Prototype

Locale JAPAN

To view the source code for java.util Locale JAPAN.

Click Source Link

Document

Useful constant for country.

Usage

From source file:Main.java

public static void main(String[] args) {
    System.out.println(setDate(1, Locale.JAPAN));
}

From source file:RBCPTest.java

public static void main(String[] args) {
    ResourceBundle rb = ResourceBundle.getBundle("resources.XmlRB", Locale.ROOT);
    String type = rb.getString("type");
    System.out.println("Root locale. Key, type: " + type);
    System.out.println();//from  w w w . jav a 2 s. c  om

    rb = ResourceBundle.getBundle("resources.XmlRB", Locale.JAPAN);
    type = rb.getString("type");
    System.out.println("Japan locale. Key, type: " + type);
    System.out.println();

    test(Locale.CHINA);
    test(new Locale("zh", "HK"));
    test(Locale.TAIWAN);
    test(Locale.CANADA);
}

From source file:Main.java

public static String stringWithDate(Date date, String format) {

    SimpleDateFormat fmt = new SimpleDateFormat(format, Locale.JAPAN);
    String sdate = fmt.format(date);
    //        vmappLog(BsmoInternalConstant.BUSHIMO_SDK_DEBUG_TAG, String.format("stringWithDate %s->%s", date.toString(), sdate));
    return sdate;
}

From source file:Main.java

/**
 * <pre>//from  w ww  .  j a v  a  2 s .co  m
 * Get {@link Locale} from device 's configuration.
 * Return {@link Locale#JAPAN} if configuration is not found.
 * </pre>
 */
public static Locale getLocale() {
    if (sCurrentContext != null) {
        return sCurrentContext.getResources().getConfiguration().locale;
    } else {
        return Locale.JAPAN;
    }
}

From source file:Main.java

public static Calendar getCurrentCalendar() {

    Calendar currentCal = new GregorianCalendar(Locale.JAPAN);

    return currentCal;
}

From source file:jp.g_aster.social.action.FacebookAction.java

/**
 * facebook??callback/*from w  w w  .  j ava 2  s.  co  m*/
 * @return
 */
public ActionResult callback() {

    log.debug("code=" + this.code);
    Facebook facebook = (Facebook) sessionScope.get("facebook");
    try {
        facebook.getOAuthAccessToken(this.code);
        log.debug("accessToken()=" + facebook.getOAuthAccessToken());
        log.debug("email=" + facebook.getMe(new Reading().locale(Locale.JAPAN)).getEmail());
        log.debug("redirect=" + (String) sessionScope.get("redirect"));
        sessionScope.put("user", facebook.getMe(new Reading().locale(Locale.JAPAN)));
    } catch (FacebookException e) {
        log.error(e);
        e.printStackTrace();
        return new Forward("error.jsp");
    }
    return new Redirect((String) sessionScope.get("redirect"));
}

From source file:jp.ne.sakura.kkkon.android.exceptionhandler.DefaultUploaderWeb.java

public static AlertDialog.Builder setupAlertDialog(final Context context) {
    final AlertDialog.Builder alertDialog = new AlertDialog.Builder(context);
    final Locale defaultLocale = Locale.getDefault();

    String title = "";
    String message = "";
    String positive = "";
    String negative = "";

    boolean needDefaultLang = true;
    if (null != defaultLocale) {
        if (defaultLocale.equals(Locale.JAPANESE) || defaultLocale.equals(Locale.JAPAN)) {
            title = "";
            message = "???????";
            positive = "?";
            negative = "";
            needDefaultLang = false;/*ww w  . j ava  2s  .c  o m*/
        }
    }
    if (needDefaultLang) {
        title = "INFO";
        message = "Now uploading error information. Cancel upload?";
        positive = "Wait";
        negative = "Cancel";
    }
    alertDialog.setTitle(title);
    alertDialog.setMessage(message);
    alertDialog.setPositiveButton(positive, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface di, int i) {
            if (null != thread) {
                if (thread.isAlive()) {
                    alertDialog.show();
                } else {
                    terminate();
                }
            }
        }
    });

    alertDialog.setNegativeButton(negative, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface di, int i) {
            if (null != thread) {
                if (thread.isAlive()) {
                    Log.d(TAG, "request interrupt");
                    terminate();
                } else {
                    // nothing
                    terminate();
                }
            }
        }
    });

    alertDialog.setCancelable(false);

    return alertDialog;
}

From source file:org.mule.transport.http.functional.HttpEncodingNonAsciiFunctionalTestCase.java

@Test
public void testSendViaGET() throws Exception {
    Latch latch = new Latch();
    setupAssertIncomingMessage(HttpConstants.METHOD_GET, latch, PLAIN_CONTENT_TYPE_HEADER);

    String testMessage = getTestMessage(Locale.JAPAN);
    String encodedPayload = URLEncoder.encode(testMessage, "ISO-2022-JP");
    String url = String.format("http://localhost:%1d/get?%2s=%3s", dynamicPort.getNumber(),
            HttpConnector.DEFAULT_HTTP_GET_BODY_PARAM_PROPERTY, encodedPayload);

    GetMethod method = new GetMethod(url);
    method.addRequestHeader(HttpConstants.HEADER_CONTENT_TYPE, PLAIN_CONTENT_TYPE_HEADER);
    int status = new HttpClient().executeMethod(method);
    assertEquals(HttpConstants.SC_OK, status);

    assertTrue(latch.await(RECEIVE_TIMEOUT, TimeUnit.MILLISECONDS));
    String expected = testMessage + " Received";
    String response = method.getResponseBodyAsString();
    assertEquals(expected, response);/*from w ww. jav  a2s. c  o m*/

    Header responseContentType = method.getResponseHeader(HttpConstants.HEADER_CONTENT_TYPE);
    assertEquals("text/plain;charset=EUC-JP", responseContentType.getValue());
}

From source file:ph.fingra.statisticsweb.controller.CommonController.java

@RequestMapping(method = RequestMethod.POST, value = "/changeLocaleByAjax")
public @ResponseBody String changeLocale(@RequestParam("lang") String lang, HttpServletRequest request,
        HttpServletResponse response) {/*from  w w  w.ja va 2  s  .c om*/
    LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(request);
    Locale locale = null;
    if (lang.equals("ko")) {
        locale = Locale.KOREA;
    } else if (lang.equals("cn")) {
        locale = Locale.CHINA;
    } else if (lang.equals("hk")) {
        locale = Locale.TRADITIONAL_CHINESE;
    } else if (lang.equals("ja")) {
        locale = Locale.JAPAN;
    } else {
        locale = Locale.ENGLISH;
    }

    localeResolver.setLocale(request, response, locale);

    return null;
}

From source file:org.mule.transport.http.functional.HttpEncodingNonAsciiFunctionalTestCase.java

@Test
public void testSendViaPOST() throws Exception {
    Object payload = getTestMessage(Locale.JAPAN);

    Map<String, Object> messageProperties = new HashMap<String, Object>();
    messageProperties.put(MuleProperties.MULE_ENCODING_PROPERTY, "ISO-2022-JP");

    doTestSend(HttpConstants.METHOD_POST, payload, messageProperties, PLAIN_CONTENT_TYPE_HEADER);
}