本文整理汇总了Java中java.util.Locale.setDefault方法的典型用法代码示例。如果您正苦于以下问题:Java Locale.setDefault方法的具体用法?Java Locale.setDefault怎么用?Java Locale.setDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Locale
的用法示例。
在下文中一共展示了Locale.setDefault方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import java.util.Locale; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
Locale.setDefault(new Locale("te", "ST"));
clearWorkDir();
File ud = new File(getWorkDir(), "ud");
ud.mkdirs();
System.setProperty("netbeans.user", ud.getPath());
data = new File(getDataDir(), "jars");
jars = new File(getWorkDir(), "space in path");
jars.mkdirs();
simpleModule = createTestJAR("simple-module", null);
String snd =
"Manifest-Version: 1.0\n" +
"OpenIDE-Module: org.foo2/1\n" +
"OpenIDE-Module-Name: Second Foo test module\n" +
"OpenIDE-Module-Specification-Version: 1.2"
+ "";
simpleModule2 = changeManifest(simpleModule, snd);
dependsModule = createTestJAR("depends-on-simple-module", null, simpleModule);
}
示例2: Test4058613
import java.util.Locale; //导入方法依赖的package包/类
public void Test4058613() {
// Creating a default collator doesn't work when Korean is the default
// locale
Locale oldDefault = Locale.getDefault();
Locale.setDefault( Locale.KOREAN );
try {
Collator c = Collator.getInstance();
// Since the fix to this bug was to turn of decomposition for Korean collators,
// ensure that's what we got
if (c.getDecomposition() != Collator.NO_DECOMPOSITION) {
errln("Decomposition is not set to NO_DECOMPOSITION");
}
}
finally {
Locale.setDefault(oldDefault);
}
}
示例3: testGetLastMillisecond
import java.util.Locale; //导入方法依赖的package包/类
/**
* Some checks for the getLastMillisecond() method.
*/
public void testGetLastMillisecond() {
Locale saved = Locale.getDefault();
Locale.setDefault(Locale.UK);
Year y = new Year(1970);
// TODO: Check this result...
assertEquals(31532399999L, y.getLastMillisecond());
Locale.setDefault(saved);
}
示例4: main
import java.util.Locale; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
Locale.setDefault(Locale.ENGLISH);
Context.init(args);
Log.info("Starting server...");
Context.getServerManager().start();
if (Context.getWebServer() != null) {
Context.getWebServer().start();
}
new Timer().scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
try {
Context.getDataManager().clearHistory();
} catch (SQLException error) {
Log.warning(error);
}
}
}, 0, CLEAN_PERIOD);
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
Log.info("Shutting down server...");
if (Context.getWebServer() != null) {
Context.getWebServer().stop();
}
Context.getServerManager().stop();
}
});
}
示例5: testGetStart
import java.util.Locale; //导入方法依赖的package包/类
/**
* Some checks for the getStart() method.
*/
public void testGetStart() {
Locale saved = Locale.getDefault();
Locale.setDefault(Locale.ITALY);
Calendar cal = Calendar.getInstance(Locale.ITALY);
cal.set(2006, Calendar.JANUARY, 16, 3, 47, 55);
cal.set(Calendar.MILLISECOND, 0);
Second s = new Second(55, 47, 3, 16, 1, 2006);
assertEquals(cal.getTime(), s.getStart());
Locale.setDefault(saved);
}
示例6: updateResources
import java.util.Locale; //导入方法依赖的package包/类
private static void updateResources(Context context, String language) {
Locale locale = getLocale(language);
Locale.setDefault(locale);
Configuration configuration = context.getResources().getConfiguration();
configuration.setLocale(locale);
context.createConfigurationContext(configuration);
}
示例7: testGetFirstMillisecond
import java.util.Locale; //导入方法依赖的package包/类
/**
* Some checks for the getFirstMillisecond() method.
*/
public void testGetFirstMillisecond() {
Locale saved = Locale.getDefault();
Locale.setDefault(Locale.UK);
Month m = new Month(3, 1970);
assertEquals(5094000000L, m.getFirstMillisecond());
Locale.setDefault(saved);
}
示例8: setUp
import java.util.Locale; //导入方法依赖的package包/类
protected @Override void setUp() throws Exception {
Locale.setDefault(Locale.US);
clearWorkDir();
File ud = new File(getWorkDir(), "ud");
ud.mkdirs();
System.setProperty("netbeans.user", ud.getPath());
data = new File(getDataDir(), "jars");
jars = new File(getWorkDir(), "space in path");
jars.mkdirs();
File simpleModule = createTestJAR("activate", null);
}
示例9: main
import java.util.Locale; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
for (Locale locale : SUPPORTED_LOCALES) {
for (String laf : LOOK_AND_FEELS) {
Locale.setDefault(locale);
if (!installLookAndFeel(laf)) {
continue;
}
testInternalFrameMnemonic();
}
}
}
示例10: shouldPointToDefaultCountryAndRegionWhenLocationIsNotUpdated
import java.util.Locale; //导入方法依赖的package包/类
@Test
public void shouldPointToDefaultCountryAndRegionWhenLocationIsNotUpdated() {
tm = null;
Locale.setDefault(new Locale("testLanguage", "Test-Locale-Country", "testVariant"));
EnvironmentInfo info = new EnvironmentInfo(ctx, location, batteryinfo);
assertThat(info.getRegion()).isEqualTo(null);
assertThat(info.getCountry()).isEqualTo("TEST-LOCALE-COUNTRY");
}
示例11: setUp
import java.util.Locale; //导入方法依赖的package包/类
protected @Override void setUp() throws Exception {
Locale.setDefault(Locale.US);
clearWorkDir();
// NetigsoModuleFactory.clear();
data = new File(getDataDir(), "jars");
jars = new File(getWorkDir(), "jars");
jars.mkdirs();
File simpleModule = createTestJAR("simple-module", null);
File dependsOnSimpleModule = createTestJAR("depends-on-simple-module", null, simpleModule);
if (System.getProperty("netbeans.user") == null) {
File ud = new File(getWorkDir(), "ud");
ud.mkdirs();
System.setProperty("netbeans.user", ud.getPath());
ModuleSystem ms = Main.getModuleSystem();
mgr = ms.getManager();
mgr.mutexPrivileged().enterWriteAccess();
try {
File j1 = new File(jars, "simple-module.jar");
m1 = mgr.create(j1, null, false, false, false);
mgr.enable(Collections.<Module>singleton(m1));
} finally {
mgr.mutexPrivileged().exitWriteAccess();
}
}
}
示例12: setUp
import java.util.Locale; //导入方法依赖的package包/类
protected @Override void setUp() throws Exception {
Locale.setDefault(Locale.US);
clearWorkDir();
data = new File(getDataDir(), "jars");
jars = new File(getWorkDir(), "jars");
jars.mkdirs();
createTestJARs();
File ud = new File(getWorkDir(), "ud");
ud.mkdirs();
System.setProperty("netbeans.user", ud.getPath());
}
示例13: DocLocale
import java.util.Locale; //导入方法依赖的package包/类
/**
* Constructor
*/
DocLocale(DocEnv docenv, String localeName, boolean useBreakIterator) {
this.docenv = docenv;
this.localeName = localeName;
this.useBreakIterator = useBreakIterator;
locale = getLocale();
if (locale == null) {
docenv.exit();
} else {
Locale.setDefault(locale); // NOTE: updating global state
}
collator = Collator.getInstance(locale);
sentenceBreaker = BreakIterator.getSentenceInstance(locale);
}
示例14: testGetEnd
import java.util.Locale; //导入方法依赖的package包/类
/**
* Some checks for the getEnd() method.
*/
public void testGetEnd() {
Locale saved = Locale.getDefault();
Locale.setDefault(Locale.ITALY);
Calendar cal = Calendar.getInstance(Locale.ITALY);
cal.set(2006, Calendar.MARCH, 31, 23, 59, 59);
cal.set(Calendar.MILLISECOND, 999);
Quarter q = new Quarter(1, 2006);
assertEquals(cal.getTime(), q.getEnd());
Locale.setDefault(saved);
}
示例15: format_japanese_yen
import java.util.Locale; //导入方法依赖的package包/类
@Test public void format_japanese_yen() {
assertThat(format($(123, JPY))).isEqualTo("JPY123");
assertThat(format($(123456, JPY))).isEqualTo("JPY123,456");
Locale.setDefault(Locale.JAPAN);
assertThat(format($(123, JPY))).isEqualTo("¥123");
assertThat(format($(123456, JPY))).isEqualTo("¥123,456");
}