blob: 8bbc9aab4576610980a7641f97166557f1f5fc46 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Ic2ExpReactorPlanner;
import java.util.ResourceBundle;
/**
* Utility class to handle handle access to the planner's resource bundle.
* Methods may be static-imported, and hopefully this will make the code more
* concise, but not to the point of obfuscation.
* @author Brian McCloud
*/
public class BundleHelper {
private BundleHelper() {
// private no-op constructor to prevent instantiation.
}
private static final ResourceBundle BUNDLE = ResourceBundle.getBundle("Ic2ExpReactorPlanner/Bundle");
/**
* Looks up a key in the planner's resource bundle.
* @param key the key to look up in the resource bundle.
* @return the value from the resource bundle for the default locale of the system the planner is being run on.
*/
public static String getI18n(String key) {
return BUNDLE.getString(key);
}
/**
* Uses a resource bundle entry as a format specifier.
* @param key the key to look up in the resource bundle.
* @param args the arguments to use in String.format.
* @return the formatted string.
*/
public static String formatI18n(String key, Object... args) {
return String.format(getI18n(key), args);
}
}
|