01: package org.sakaiproject.tool.assessment.audio;
02:
03: import java.util.Locale;
04: import java.util.ResourceBundle;
05:
06: public class AudioUtil {
07:
08: private static final String RESOURCE_PACKAGE = "org.sakaiproject.tool.assessment.audio";
09:
10: private static final String RESOURCE_NAME = "AudioResources";
11:
12: private static AudioUtil INSTANCE;
13:
14: private String localeLanguage;
15:
16: private String localeCountry;
17:
18: public static AudioUtil getInstance() {
19: if (INSTANCE == null) {
20: INSTANCE = new AudioUtil();
21: }
22: return INSTANCE;
23: }
24:
25: public void setLocaleLanguage(String localeLanguage) {
26: this .localeLanguage = localeLanguage;
27: }
28:
29: public String getLocaleLanguage() {
30: return localeLanguage;
31: }
32:
33: public void setLocaleCountry(String localeCountry) {
34: this .localeCountry = localeCountry;
35: }
36:
37: public String getLocaleCountry() {
38: return localeCountry;
39: }
40:
41: public ResourceBundle getResourceBundle() {
42: Locale locale = Locale.getDefault();
43: if (localeLanguage != null && !"".equals(localeLanguage)) {
44: if (this .localeCountry != null
45: && !"".equals(this .localeCountry)) {
46: locale = new Locale(localeLanguage, localeCountry);
47: } else {
48: locale = new Locale(localeLanguage);
49: }
50: }
51: ResourceBundle res = ResourceBundle.getBundle(RESOURCE_PACKAGE
52: + "." + RESOURCE_NAME, locale);
53: return res;
54: }
55:
56: }
|