当前位置: 首页>>代码示例>>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;未经允许,请勿转载。