Технологии Java
Интернационализация и локализация
choose a folder, containing colour information
choose a directory, containing colour information
choose a folder, containing color information
Выберите каталог, содержащий цветовую информацию
new Locale.Builder() .setLanguage(...).setRegion(...).setVariant(...) .build();
void printUsage() { System.out.println( "Usage: Test [<options>] <commands>\n" + "Options:\n" + " -o write output\n" + "... " ); }
void printUsage(ResourceBundle bundle) { System.out.println(String.format( "%s Test [%s] %s\n" + "%s\n" + " -o %s\n"+ "...", bundle.getString("usage"), // Usage: bundle.getString("options"), // <options> bundle.getString("commands"), // <commands> bundle.getString("Options"), // Options: bundle.getString("-o") // Write output )); }
ResourceBundle bundle = ResourceBundle.getBundle( "UsageResourceBundle", Locale.US ); printUsage(bundle);
public class UsageResourceBundle_en_US extends ListResourceBundle { private static final Object[][] CONTENTS = { {"usage", "Usage:"}, {"options", "<options>"}, {"commands", "<commands>"}, {"Options", "Options:"}, {"-o", "Write output"}, }; protected Object[][] getContents() { return CONTENTS; } }
key1 = value1 key2 : value2 key3 = very long value \ continues on next line # Comment …
usage = Usage: options = <options> Commands = <commands> Options = Options: -o = Write output
yyyy.MM.dd G 'at' HH:mm:ss z
// May 17, 2024: $11.40 available MessageFormat.format( "{0,date}: {1,number,currency} available“, new Date(), 11.40 )
Английский | Французский |
---|---|
peach peaches péché pêche | peach peaches pêche péché |
new RuleBasedCollator("c < e, E; é, É; ê = ě, Ê = Ě < F");
usage=Применение options=<Опции> Commands=<команды> Options=Опции: -o=Запись выходного файла
usage=\u040f\u0430\u0401\u00ac\u0490\u00ad\u0490\u00ad\u0401\u0490 options=<\u040b\u0407\u0436\u0401\u0401> Commands=<\u0404\u00ae\u00ac\u00a0\u00ad\u00a4\u043b> Options=\u040b\u0407\u0436\u0401\u0401: -o=\u2021\u00a0\u0407\u0401\u0431\u043c \u045e\u043b\u0435\u00ae\u00a4\u00ad\u00ae\u0408\u00ae \u0434\u00a0\u00a9\u00ab\u00a0