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:Main.java

public static void main(String[] args) {
    Locale locale = Locale.JAPANESE;

    System.out.println("Locale1:" + locale);

    // print the country of this locale
    System.out.println("Country:" + locale.getCountry());

}

From source file:Test.java

public static void main(String[] args) {
    Locale locale = Locale.getDefault();
    Calendar calendar = Calendar.getInstance();
    calendar.setWeekDate(2012, 16, 3);//  ww w .j av a2 s. c  o m

    System.out.println(
            DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(calendar.getTime()));
    System.out.println("" + locale.getDisplayLanguage());

    Locale.setDefault(Locale.Category.FORMAT, Locale.JAPANESE);
    Locale.setDefault(Locale.Category.DISPLAY, Locale.GERMAN);

    System.out.println(
            DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(calendar.getTime()));
    System.out.println("" + locale.getDisplayLanguage());

}

From source file:SenBench.java

public static void main(String[] args) {
    try {/*  ww  w.  j a v a  2 s. c  om*/
        if (args.length == 0) {
            System.out.println("usage: java SenBench file [file ..]");
            System.exit(2);
        }

        StringTagger tagger = StringTagger.getInstance(Locale.JAPANESE);

        long processed = 0;
        long nbytes = 0;
        long nchars = 0;

        long start = System.currentTimeMillis();
        for (int a = 0; a < args.length; a++) {
            String text = "";
            try {
                RandomAccessFile raf = new RandomAccessFile(args[a], "r");
                byte[] buf = new byte[(int) raf.length()];
                raf.readFully(buf);
                raf.close();
                text = new String(buf, encoding);
                nbytes += buf.length;
                nchars += text.length();
            } catch (IOException ioe) {
                log.error(ioe);
                continue;
            }

            long s_start = System.currentTimeMillis();
            for (int c = 0; c < repeat; c++)
                doWork(tagger, text);
            long s_end = System.currentTimeMillis();
            processed += (s_end - s_start);
        }
        long end = System.currentTimeMillis();
        System.out.println("number of files: " + args.length);
        System.out.println("number of repeat: " + repeat);
        System.out.println("number of bytes: " + nbytes);
        System.out.println("number of chars: " + nchars);
        System.out.println("total time elapsed: " + (end - start) + " msec.");
        System.out.println("analysis time: " + (processed) + " msec.");
    } catch (Exception e) {
        e.printStackTrace(System.err);
        System.exit(1);
    }
}

From source file:Main.java

public static boolean isLanguageJa() {
    return Locale.JAPANESE.toString().equalsIgnoreCase(Locale.getDefault().getLanguage());
}

From source file:Main.java

public static String getDefaultLocale() {
    switch (Locale.getDefault().getLanguage()) {
    case "zh":
        switch (Locale.getDefault().getCountry()) {
        case "CN":
            return Locale.SIMPLIFIED_CHINESE.toString();
        default:/* ww w  .j a  v  a2 s  . c  o m*/
            return Locale.TRADITIONAL_CHINESE.toString();
        }
    case "ja":
        return Locale.JAPANESE.toString();
    default:
        return Locale.ENGLISH.toString();
    }
}

From source file:JapaneseHelloWorldServlet.java

public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException {

    response.setContentType("text/html");
    response.setLocale(Locale.JAPANESE);
    PrintWriter out = response.getWriter();
    out.println("<FONT SIZE=+2>");
    out.println("\u4eca\u65e5\u306f\u4e16\u754c");
    out.println("</FONT>");
}

From source file:JapaneseCalendar.java

public JapaneseCalendar() {
    setLayout(new BorderLayout());
    final CalendarPane cp = new CalendarPane(Locale.JAPANESE);
    add(cp, BorderLayout.NORTH);/*  w  w w  . j a  v a  2 s .  co  m*/
}

From source file:jp.co.tis.gsp.tools.db.AbstractDbObjectParser.java

public AbstractDbObjectParser() {
    super();/*from  www . j  a va  2  s . c  o  m*/
    fmConfig.setEncoding(Locale.JAPANESE, "UTF-8");
    fmConfig.setNumberFormat(System.getProperty("gsp.freemarker.number_format", "#"));
}

From source file:com.aoindustries.website.clientarea.accounting.AddCreditCardAction.java

/**
 * Parses the first name in a locale-specific manner.
 *///from   ww w .j av  a  2  s.  c om
public static String getFirstName(String name, Locale userLocale) {
    if (name == null)
        return null;
    name = name.trim();
    if (userLocale.getLanguage().equals(Locale.JAPANESE.getLanguage())) {
        // Last then first
        int pos = name.lastIndexOf(' ');
        if (pos == -1)
            return "";
        else
            return name.substring(pos + 1).trim();
    } else {
        // First then last
        int pos = name.indexOf(' ');
        if (pos == -1)
            return "";
        else
            return name.substring(0, pos).trim();
    }
}

From source file:com.aoindustries.website.clientarea.accounting.AddCreditCardAction.java

/**
 * Parses the last name in a locale-specific manner.
 *//*from  ww  w  . jav  a2 s  .  c om*/
public static String getLastName(String name, Locale userLocale) {
    if (name == null)
        return null;
    name = name.trim();
    if (userLocale.getLanguage().equals(Locale.JAPANESE.getLanguage())) {
        // Last then first
        int pos = name.lastIndexOf(' ');
        if (pos == -1)
            return name;
        else
            return name.substring(0, pos).trim();
    } else {
        // First then last
        int pos = name.indexOf(' ');
        if (pos == -1)
            return name;
        else
            return name.substring(pos + 1).trim();
    }
}