Here you can find the source of getResourceBundleForLoc(String language, String fileName)
Parameter | Description |
---|---|
key | key for which the value needs to be fetched |
fileType | specifies from which property file object value has to return based on provided key |
language | language for which the value come form the user language |
Parameter | Description |
---|---|
IOException | if any exception occurs while fetching value |
public static Object getResourceBundleForLoc(String language, String fileName) throws IOException
//package com.java2s; import java.io.IOException; import java.util.Locale; import java.util.ResourceBundle; public class Main { /**/* ww w. j a v a 2 s . c om*/ * Gets the Resource bundle object given the language * * @param key key for which the value needs to be fetched * @param fileType specifies from which property file object * value has to return based on provided key * @param language language for which the value come form the user language * * @return value value of the key * @throws IOException if any exception occurs while fetching value */ public static Object getResourceBundleForLoc(String language, String fileName) throws IOException { if ((language == null) || ("".equals(language))) { language = "en"; } Locale locale = new Locale(language); ResourceBundle rb = ResourceBundle.getBundle(fileName, locale); return rb; } }