當前位置: 首頁>>代碼示例>>Java>>正文


Java Locale.setDefault方法代碼示例

本文整理匯總了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);
    }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:24,代碼來源:NetigsoDuplicatedClassForNameTest.java

示例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);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:21,代碼來源:Regression.java

示例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);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:12,代碼來源:YearTests.java

示例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();
        }
    });
}
 
開發者ID:bamartinezd,項目名稱:traccar-service,代碼行數:35,代碼來源:Main.java

示例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);        
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:14,代碼來源:SecondTests.java

示例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);
}
 
開發者ID:ThirtyDegreesRay,項目名稱:OpenHub,代碼行數:8,代碼來源:AppUtils.java

示例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);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:11,代碼來源:MonthTests.java

示例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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:NetigsoMetaInfServicesTest.java

示例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();
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:12,代碼來源:bug8020708.java

示例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");
}
 
開發者ID:rakutentech,項目名稱:android-perftracking,代碼行數:10,代碼來源:EnvironmentInfoSpec.java

示例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();
            }
        }

    }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:33,代碼來源:NetigsoLayerTest.java

示例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());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:SetupHid.java

示例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);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:17,代碼來源:DocLocale.java

示例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);                
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:14,代碼來源:QuarterTests.java

示例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");
}
 
開發者ID:square,項目名稱:catalog-api-demo,代碼行數:9,代碼來源:MoneysTest.java


注:本文中的java.util.Locale.setDefault方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。