Source Code : Resource Bundle by Locale
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Resource Bundle by Locale
import java.util.Enumeration;
import java.util.Locale;
import java.util.ResourceBundle;
class ResourceBundleApp {
public static void main(String args[]) {
if (args.length != 1) {
System.out.println("Usage: java ResourceBundleApp country_code");
System.exit(0);
}
Locale mexico = new Locale("es", "MX");
Locale spain = new Locale("es", "ES");
Locale locales[] = { mexico, spain, Locale.US, Locale.CANADA, Locale.UK };
Locale newLocale = null;
for (int i = 0; i < locales.length; ++i) {
if (args[0].equals(locales[i].getCountry())) {
newLocale = locales[i];
break;
}
}
if (newLocale == null) {
System.out.println("Country not found.");
System.exit(0);
}
ResourceBundle resources = ResourceBundle.getBundle("TextBundle", newLocale);
Enumeration e = resources.getKeys();
while (e.hasMoreElements()) {
String key = (String) e.nextElement();
System.out.println(resources.getString(key));
}
}
}
Thank with us