Example usage for java.util Locale TAIWAN

List of usage examples for java.util Locale TAIWAN

Introduction

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

Prototype

Locale TAIWAN

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

Click Source Link

Document

Useful constant for country.

Usage

From source file:Main.java

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

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

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

}

From source file:Main.java

public static void main(String args[]) {
    Locale currentLocale = Locale.getDefault();
    Locale locales[] = { Locale.TAIWAN, Locale.KOREA, Locale.ITALY, Locale.CANADA, Locale.CANADA_FRENCH };
    System.out.println("CURRENT LOCALE:");
    describeLocale(currentLocale);//from   w  w w .j  a  v  a  2  s. c om
    System.out.println("OTHER LOCALES:");
    for (int i = 0; i < locales.length; ++i)
        describeLocale(locales[i]);
}

From source file:FormatDateLocale.java

public static void main(String[] args) {
    Locale[] locales = new Locale[] { Locale.JAPAN, Locale.CHINA, Locale.KOREA, Locale.TAIWAN, Locale.ITALY,
            Locale.FRANCE, Locale.GERMAN };

    Date today = new Date();

    for (Locale locale : locales) {
        System.out.println("Date format in " + locale.getDisplayName() + " = "
                + SimpleDateFormat.getDateInstance(SimpleDateFormat.LONG, locale).format(today).toUpperCase());
    }/*from  w  w w  .ja  va  2s.c o  m*/
}

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();/* w  w w .j  a  v a 2s.com*/

    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 Calendar getNowTime() {
    return Calendar.getInstance(Locale.TAIWAN);
}

From source file:grandroid.geo.Geocoder.java

public static List<Address> getFromLocation(double lat, double lng, int maxResult) {
    return getFromLocation(Locale.TAIWAN, lat, lng, maxResult);
}

From source file:grandroid.geo.Geocoder.java

public static List<Address> getFromLocation(Locale locale, double lat, double lng, int maxResult) {
    String language = locale.getLanguage();
    if (locale == Locale.TAIWAN) {
        language = "zh-TW";
    }/*from  w  w  w .  ja v  a 2 s.co  m*/
    String address = String.format(locale,
            "http://maps.googleapis.com/maps/api/geocode/json?latlng=%1$f,%2$f&sensor=false&language="
                    + language,
            lat, lng);//locale.getCountry()
    HttpGet httpGet = new HttpGet(address);
    HttpClient client = new DefaultHttpClient();
    client.getParams().setParameter(AllClientPNames.USER_AGENT,
            "Mozilla/5.0 (Java) Gecko/20081007 java-geocoder");
    //client.getParams().setIntParameter(AllClientPNames.CONNECTION_TIMEOUT, 5 * 1000);
    //client.getParams().setIntParameter(AllClientPNames.SO_TIMEOUT, 25 * 1000);
    HttpResponse response;

    List<Address> retList = null;

    try {
        response = client.execute(httpGet);
        HttpEntity entity = response.getEntity();
        String json = EntityUtils.toString(entity, "UTF-8");

        JSONObject jsonObject = new JSONObject(json);

        retList = new ArrayList<Address>();

        if ("OK".equalsIgnoreCase(jsonObject.getString("status"))) {
            JSONArray results = jsonObject.getJSONArray("results");
            if (results.length() > 0) {
                for (int i = 0; i < results.length() && i < maxResult; i++) {
                    JSONObject result = results.getJSONObject(i);
                    //Log.e(MyGeocoder.class.getName(), result.toString());
                    Address addr = new Address(Locale.getDefault());
                    // addr.setAddressLine(0, result.getString("formatted_address"));

                    JSONArray components = result.getJSONArray("address_components");
                    String streetNumber = "";
                    String route = "";
                    for (int a = 0; a < components.length(); a++) {
                        JSONObject component = components.getJSONObject(a);
                        JSONArray types = component.getJSONArray("types");
                        for (int j = 0; j < types.length(); j++) {
                            String type = types.getString(j);
                            if (type.equals("locality") || type.equals("administrative_area_level_3")) {
                                addr.setLocality(component.getString("long_name"));
                            } else if (type.equals("street_number")) {
                                streetNumber = component.getString("long_name");
                            } else if (type.equals("route")) {
                                route = component.getString("long_name");
                            } else if (type.equals("administrative_area_level_1")) {
                                addr.setAdminArea(component.getString("long_name"));
                            } else if (type.equals("country")) {
                                addr.setCountryName(component.getString("long_name"));
                                addr.setCountryCode(component.getString("short_name"));
                            }
                        }
                    }
                    addr.setAddressLine(0, route + " " + streetNumber);
                    if (result.has("formatted_address")) {
                        addr.setFeatureName(result.getString("formatted_address"));
                    }
                    addr.setLatitude(
                            result.getJSONObject("geometry").getJSONObject("location").getDouble("lat"));
                    addr.setLongitude(
                            result.getJSONObject("geometry").getJSONObject("location").getDouble("lng"));
                    if (addr.getAdminArea() == null) {
                        addr.setAdminArea("");
                    }
                    retList.add(addr);
                }
            }
        }
    } catch (ClientProtocolException e) {
        Log.e("grandroid", "Error calling Google geocode webservice.", e);
    } catch (IOException e) {
        Log.e("grandroid", "Error calling Google geocode webservice.", e);
    } catch (JSONException e) {
        Log.e("grandroid", "Error parsing Google geocode webservice response.", e);
    }
    return retList;
}

From source file:rbcp.PropertiesResourceBundleControl.java

@Override
public List<Locale> getCandidateLocales(String baseName, Locale locale) {
    if (baseName == null)
        throw new NullPointerException();
    if (locale.equals(new Locale("zh", "HK"))) {
        return Arrays.asList(locale, Locale.TAIWAN,
                // no Locale.CHINESE here
                Locale.ROOT);/*w w  w .j  a v a2 s. c  om*/
    } else if (locale.equals(Locale.TAIWAN)) {
        return Arrays.asList(locale,
                // no Locale.CHINESE here
                Locale.ROOT);
    }
    return super.getCandidateLocales(baseName, locale);
}

From source file:com.example.robert.bluetoothnew.BluetoothChatFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);//from   w  w w .ja v a  2 s.c om
    // Get local Bluetooth adapter
    mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    initSingleTonTemp();
    // If the adapter is null, then Bluetooth is not supported
    intiCallWeb();
    toWebPosition();
    if (mBluetoothAdapter == null) {
        FragmentActivity activity = getActivity();
        Toast.makeText(activity, "Bluetooth is not available", Toast.LENGTH_LONG).show();
        activity.finish();
    } // No bluetooth service

    tts = new TextToSpeech(getActivity(), new TextToSpeech.OnInitListener() {
        @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
        @Override
        public void onInit(int status) {
            Log.v("abasdasd", "status 123");

            if (status == TextToSpeech.SUCCESS) {

                int result = tts.setLanguage(Locale.TAIWAN);

                if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) {
                    Log.e("TTS", "This Language is not supported");
                } else {

                }

            } else {
                Log.e("TTS", "Initilization Failed!");
            }
        }
    });
}

From source file:org.pluroid.pluroium.PlurkHelper.java

/**
 * Add a plurk/*from   w ww . java  2 s  . c o m*/
 */
public boolean addPlurk(String qualifier, String content, boolean allowComment) {
    boolean result = false;

    try {
        HttpPost post = new HttpPost(getApiUri(ADD_PLURK_URL));
        Resources res = context.getResources();
        Configuration conf = res.getConfiguration();

        String lang = "en";
        if (conf.locale == Locale.TAIWAN) {
            lang = "tr_ch";
        }

        List<NameValuePair> params = new ArrayList<NameValuePair>();
        params.add(new BasicNameValuePair("api_key", API_KEY));
        params.add(new BasicNameValuePair("qualifier", qualifier));
        params.add(new BasicNameValuePair("lang", lang));
        params.add(new BasicNameValuePair("content", content));

        post.setEntity(new UrlEncodedFormEntity(params, "utf-8"));
        HttpResponse resp = httpClient.execute(post);
        int status = resp.getStatusLine().getStatusCode();

        if (status == HttpStatus.SC_OK) {
            result = true;
        }

    } catch (Exception e) {
        Log.e(TAG, "Add plurk error: ", e);
    } finally {
        connMgr.shutdown();
    }

    return result;
}