Example usage for java.util Locale JAPANESE

List of usage examples for java.util Locale JAPANESE

Introduction

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

Prototype

Locale JAPANESE

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

Click Source Link

Document

Useful constant for language.

Usage

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;/*from  w ww  .  j  ava  2 s  . com*/
        }
    }
    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:test.unit.be.fedict.eid.applet.MessagesTest.java

@Test
public void testUnsupportedLanguage() throws Exception {
    Locale.setDefault(new Locale("nl"));
    Locale locale = Locale.JAPANESE;
    Messages messages = new Messages(locale);
    String message = messages.getMessage(Messages.MESSAGE_ID.GENERIC_ERROR);
    LOG.debug("message: " + message);
    assertEquals("Algemene fout.", message);
}

From source file:org.terasoluna.gfw.common.codelist.i18n.SimpleI18nCodeListTest.java

@Test
public void testSetRows01() {
    assertThat(testSetRows01.codeListTable.size(), is(14)); // 2 rows x 7
                                                            // columns

    Map<String, String> row1 = testSetRows01.asMap(Locale.ENGLISH);
    assertThat(row1, is(notNullValue()));
    assertThat(row1.keySet().toString(), is("[0, 1, 2, 3, 4, 5, 6]")); // check
                                                                       // order
    assertThat(row1.get("0"), is("Sun."));
    assertThat(row1.get("1"), is("Mon."));
    assertThat(row1.get("2"), is("Tue."));
    assertThat(row1.get("3"), is("Wed."));
    assertThat(row1.get("4"), is("Thu."));
    assertThat(row1.get("5"), is("Fri."));
    assertThat(row1.get("6"), is("Sat."));

    Map<String, String> row2 = testSetRows01.asMap(Locale.JAPANESE);
    assertThat(row2, is(notNullValue()));
    assertThat(row2.keySet().toString(), is("[0, 1, 2, 3, 4, 5, 6]")); // check
                                                                       // order
    assertThat(row2.get("0"), is(""));
    assertThat(row2.get("1"), is(""));
    assertThat(row2.get("2"), is("?"));
    assertThat(row2.get("3"), is(""));
    assertThat(row2.get("4"), is(""));
    assertThat(row2.get("5"), is(""));
    assertThat(row2.get("6"), is(""));
}

From source file:test.unit.be.fedict.eid.applet.MessagesTest.java

@Test
public void testUnsupportedLanguageUnsupportedDefaultLanguage() throws Exception {
    Locale.setDefault(Locale.CHINESE);
    Locale locale = Locale.JAPANESE;
    Messages messages = new Messages(locale);
    String message = messages.getMessage(Messages.MESSAGE_ID.GENERIC_ERROR);
    LOG.debug("message: " + message);
    assertEquals("Generic Error.", message);
}

From source file:org.marketcetera.util.log.I18NMessageProviderTest.java

@Test
public void retrievals() {
    assertEquals("Hello", TestMessages.PROVIDER.getText(TestMessages.HELLO_MSG));
    assertEquals("Hello World!", TestMessages.PROVIDER.getText(TestMessages.HELLO_TITLE, "World"));
    assertEquals("Bonjour", TestMessages.PROVIDER.getText(Locale.FRENCH, TestMessages.HELLO_MSG));
    assertEquals("Bonjour Le Monde!",
            TestMessages.PROVIDER.getText(Locale.FRENCH, TestMessages.HELLO_TITLE, "Le Monde"));

    Locale saved = Locale.getDefault();
    try {/*from ww w  .j av  a 2 s. co  m*/
        Locale.setDefault(Locale.ROOT);
        assertEquals("Hello", TestMessages.PROVIDER.getText(Locale.GERMAN, TestMessages.HELLO_MSG));
        Locale.setDefault(Locale.JAPANESE);
        assertEquals("Hello", TestMessages.PROVIDER.getText(Locale.GERMAN, TestMessages.HELLO_MSG));
        Locale.setDefault(Locale.FRENCH);
        assertEquals("Bonjour", TestMessages.PROVIDER.getText(Locale.GERMAN, TestMessages.HELLO_MSG));
    } finally {
        Locale.setDefault(saved);
    }

    assertEquals("Hello a {0} 'a' \"a\" b!", TestMessages.PROVIDER.getText(TestMessages.HELLO_ECHO, "a", "b"));
    assertEquals("Bonjour a {0} 'a' \"a\" {1}!",
            TestMessages.PROVIDER.getText(Locale.FRENCH, TestMessages.HELLO_ECHO, "a"));
    assertEquals("Bonjour a {0} 'a' \"a\" b!",
            TestMessages.PROVIDER.getText(Locale.FRENCH, TestMessages.HELLO_ECHO, "a", "b", "c"));

    assertEquals("There are no orders ma'am.", TestMessages.PROVIDER.getText(TestMessages.CHOICE_MSG, 0));
    assertEquals("There is just one order ma'am.", TestMessages.PROVIDER.getText(TestMessages.CHOICE_MSG, 1));
    assertEquals("There are 2 orders ma'am.", TestMessages.PROVIDER.getText(TestMessages.CHOICE_MSG, 2));

    assertEquals("Pas des ordres ma'am.",
            TestMessages.PROVIDER.getText(Locale.FRENCH, TestMessages.CHOICE_MSG, 0));
    assertEquals("Seulemont un ordre ma'am.",
            TestMessages.PROVIDER.getText(Locale.FRENCH, TestMessages.CHOICE_MSG, 1));
    assertEquals("Il y a 2 ordres ma'am.",
            TestMessages.PROVIDER.getText(Locale.FRENCH, TestMessages.CHOICE_MSG, 2));

    assertEquals("Hello {0}!", TestMessages.PROVIDER.getText(TestMessages.HELLO_TITLE, (Object[]) null));
    assertEquals("Hello null!", TestMessages.PROVIDER.getText(TestMessages.HELLO_TITLE, (Object) null));

    ActiveLocale.setProcessLocale(Locale.FRENCH);
    assertEquals("Bonjour", TestMessages.PROVIDER.getText(TestMessages.HELLO_MSG));
    assertEquals("Bonjour Le Monde!", TestMessages.PROVIDER.getText(TestMessages.HELLO_TITLE, "Le Monde"));
}

From source file:v7cr.V7CR.java

@Override
public void init() {
    setLocale(Locale.JAPANESE);
    setMainWindow(new TopPageWindow(this));
}

From source file:net.java.sen.StringTagger.java

/**
 * Obtain StringTagger instance for specified locale.
 * /*from   w w  w  .  java2  s.  co m*/
 * @deprecated use instead of StringTagger#getinstance(String senConfig)
 * @param locale
 *            Locale to generate morphological analyzer.
 */
public static StringTagger getInstance(Locale locale) throws IOException, IllegalArgumentException {
    if (locale.equals(Locale.JAPANESE)) {
        return getInstance();
    } else {
        throw new IllegalArgumentException("Locale '" + locale.getDisplayName() + "' isn't supported.");
    }
}

From source file:com.yojiokisoft.yumekanow.fragment.SleepFragment.java

/**
 * ?.//from   ww  w .j a  v  a 2  s. c o  m
 */
private void printCurrentTimer() {
    Calendar calendar = Calendar.getInstance();
    calendar.setTimeInMillis(MyAlarmManager.getWakeUpTime());
    if (calendar.getTimeInMillis() == 0) {
        mCurrentTimer.setText(getString(R.string.timer_not_set));
        mCancelTimerButton.setVisibility(View.GONE);
    } else {
        SimpleDateFormat sdf = new SimpleDateFormat("MM/dd HH:mm", Locale.JAPANESE);
        String time = sdf.format(calendar.getTime()) + getString(R.string.timer_setting_at);
        mCurrentTimer.setText(time);
        mCancelTimerButton.setVisibility(View.VISIBLE);
    }
}

From source file:jp.co.crypton.spinach.activities.LaunchScreen.java

void getDataIsConnectInternet() {
    AsyncHttpClient client = new AsyncHttpClient();
    client.get(Constants.URL_BOOT, new AsyncHttpResponseHandler() {

        @Override// w  ww.jav a2 s .c  om
        public void onStart() {
            // called before request is started
            Log.d(TAG, "AsyncHttpClient onStart");
        }

        @Override
        public void onSuccess(int statusCode, Header[] headers, byte[] response) {
            String data = new String(response);
            Log.d(TAG, data);

            BootModel model = new Gson().fromJson(data, BootModel.class);
            for (Boot item : model.getBoot()) {
                boolean isJp = false;
                if (Locale.getDefault().equals(Locale.JAPAN) || Locale.getDefault().equals(Locale.JAPANESE)) {
                    isJp = true;
                }
                String url = isJp ? item.getMsgJa() : item.getMsgEn();
                if (item.getState() == 0) {
                    Log.d(TAG, "onSuccess: " + item.getState());
                    gotoNextPage();
                } else {
                    //                        new AlertDialog.Builder(LaunchScreen.this)
                    //                                .setMessage(url)
                    //                                .setNegativeButton(R.string.btn_close, new DialogInterface.OnClickListener() {
                    //                                    @Override
                    //                                    public void onClick(DialogInterface dialog, int which) {
                    //                                        finish();
                    //                                    }
                    //                                })
                    //                                .show();
                    showAlertColorLicense(url);
                    //                        finish();
                }
            }
        }

        @Override
        public void onFailure(int statusCode, Header[] headers, byte[] errorResponse, Throwable e) {
            gotoNextPage();
            Log.d(TAG, "AsyncHttpClient onFailure");
        }

        @Override
        public void onRetry(int retryNo) {
            // called when request is retried
            Log.d(TAG, "onRetry: ");
        }
    });
}

From source file:org.terasoluna.gfw.common.codelist.i18n.SimpleI18nCodeListTest.java

@Test
public void testSetRowsByCodeList01() {
    assertThat(testSetRowsByCodeList01.codeListTable.size(), is(14)); // 2
                                                                      // rows
                                                                      // x 7
                                                                      // columns

    Map<String, String> row1 = testSetRowsByCodeList01.asMap(Locale.ENGLISH);
    assertThat(row1, is(notNullValue()));
    assertThat(row1.keySet().toString(), is("[0, 1, 2, 3, 4, 5, 6]")); // check
                                                                       // order
    assertThat(row1.get("0"), is("Sun."));
    assertThat(row1.get("1"), is("Mon."));
    assertThat(row1.get("2"), is("Tue."));
    assertThat(row1.get("3"), is("Wed."));
    assertThat(row1.get("4"), is("Thu."));
    assertThat(row1.get("5"), is("Fri."));
    assertThat(row1.get("6"), is("Sat."));

    Map<String, String> row2 = testSetRowsByCodeList01.asMap(Locale.JAPANESE);
    assertThat(row2, is(notNullValue()));
    assertThat(row2.keySet().toString(), is("[0, 1, 2, 3, 4, 5, 6]")); // check
                                                                       // order
    assertThat(row2.get("0"), is(""));
    assertThat(row2.get("1"), is(""));
    assertThat(row2.get("2"), is("?"));
    assertThat(row2.get("3"), is(""));
    assertThat(row2.get("4"), is(""));
    assertThat(row2.get("5"), is(""));
    assertThat(row2.get("6"), is(""));
}