本文整理匯總了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");
}