blob: b9f7d0b972529b82050e987592dfc3fced259a4a (
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
|
/* Listing1714.java */
import java.util.*;
public class Listing1714
{
public static void sayHello(Locale locale)
{
System.out.print(locale + ": ");
ResourceBundle textbundle = ResourceBundle.getBundle(
"MyTextResource",
locale
);
if (textbundle != null) {
System.out.print(textbundle.getString("Hi") + ", ");
System.out.println(textbundle.getString("To"));
}
}
public static void main(String[] args)
{
sayHello(Locale.getDefault());
sayHello(new Locale("de", "CH"));
sayHello(Locale.US);
sayHello(Locale.FRANCE);
}
}
|