Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 863181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:16:09+00:00 2026-05-15T09:16:09+00:00

Currently, I wish to know which properties file is being loaded in my application.

  • 0

Currently, I wish to know which properties file is being loaded in my application.

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package example0;

import java.util.Locale;

/**
 *
 * @author yccheok
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        //Locale.setDefault(Locale.SIMPLIFIED_CHINESE);     // Bundle_zh_CH.properties will be loaded.
        //Locale.setDefault(Locale.CHINA);                  // Bundle_zh_CH.properties will be loaded.
        //Locale.setDefault(Locale.TRADITIONAL_CHINESE);    // Bundle.properties will be loaded.
        //Locale.setDefault(Locale.CHINESE);                // Bundle.properties will be loaded.

        String Hello = java.util.ResourceBundle.getBundle("example0/Bundle").getString("HELLO");
        System.out.println(Hello);

        System.out.println("Locale.SIMPLIFIED_CHINESE's language : " + Locale.SIMPLIFIED_CHINESE.getLanguage());
        System.out.println("Locale.CHINA's language : " + Locale.CHINA.getLanguage());
        System.out.println("Locale.TRADITIONAL_CHINESE's language : " + Locale.TRADITIONAL_CHINESE.getLanguage());
        System.out.println("Locale.CHINESE's language : " + Locale.CHINESE.getLanguage());

        System.out.println("Locale.SIMPLIFIED_CHINESE's country : " + Locale.SIMPLIFIED_CHINESE.getCountry());
        System.out.println("Locale.CHINA's country : " + Locale.CHINA.getCountry());
        System.out.println("Locale.TRADITIONAL_CHINESE's country : " + Locale.TRADITIONAL_CHINESE.getCountry());
        System.out.println("Locale.CHINESE's country : " + Locale.CHINESE.getCountry());
    }

}

The following is the output :

Hello
Locale.SIMPLIFIED_CHINESE's language : zh
Locale.CHINA's language : zh
Locale.TRADITIONAL_CHINESE's language : zh
Locale.CHINESE's language : zh
Locale.SIMPLIFIED_CHINESE's country : CN
Locale.CHINA's country : CN
Locale.TRADITIONAL_CHINESE's country : TW
Locale.CHINESE's country : 

Previously, to determine whether properties file Bundle_zh_CH.properties will be loaded, I am performing the following comparison.

if (Locale.getDefault() == Locale.SIMPLIFIED_CHINESE)

However, some Locale other than SIMPLIFIED_CHINESE will load Bundle_zh_CH.properties as well.

What is the reliable way for me to do so?

Shall I

if (Locale.getDefault() == Locale.SIMPLIFIED_CHINESE || Locale.getDefault() == Locale.China)

or

if (Locale.getDefault().equals("CN"))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T09:16:09+00:00Added an answer on May 15, 2026 at 9:16 am

    Don’t rely on equals operator comparison as you can create new Locale instances with its public constructors. In the following code:

    Locale simpChinese = new Locale("zh","CN","");
    System.out.println(simpChinese == Locale.SIMPLIFIED_CHINESE);
    System.out.println(simpChinese.equals(Locale.SIMPLIFIED_CHINESE));
    

    prints:

    false
    true
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wish to perform device-to-device file transfer over Bluetooth in my Android application. Currently
Currently developing an application using the newest version of symfony, obtained through PEAR. This
I have a localized iOS application in which I wish to include some localized
I wish to create an app, which would change the wallpaper of the Android
This may seem as an almost impossible question, but I wish to know how
I'm currently on a VB.NET project and wish to use a KeyValuePair to facilitate
I wish to create a dynamic RSS feed to represent my site's content. Currently,
I am currently processing text/html data and I wish to store my results in
Currently I have a class that looks like this: public class MyClass : IMyClass
For my VFP application, i have a program to check currently who is accessing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.