Example usage for java.util Locale getDefault

List of usage examples for java.util Locale getDefault

Introduction

In this page you can find the example usage for java.util Locale getDefault.

Prototype

public static Locale getDefault() 

Source Link

Document

Gets the current value of the default locale for this instance of the Java Virtual Machine.

Usage

From source file:fr.free.nrw.commons.Utils.java

/**
 * Capitalizes the first character of a string.
 *
 * @param string String to alter//  ww  w .  j a v  a  2  s .co  m
 * @return string with capitalized first character
 */
public static String capitalize(String string) {
    if (string.length() > 0) {
        return string.substring(0, 1).toUpperCase(Locale.getDefault()) + string.substring(1);
    } else {
        return string;
    }
}

From source file:fitnesse.responders.files.FileResponderTest.java

@Before
public void setUp() throws Exception {
    request = new MockRequest();
    context = new FitNesseContext();
    context.rootPagePath = SampleFileUtility.base;
    SampleFileUtility.makeSampleFiles();
    response = null;/* www. java 2  s  .c o m*/
    saveLocale = Locale.getDefault();
    FitNesseUtil.makeTestContext();
}

From source file:com.cloud.utils.NumbersUtil.java

public static String toReadableSize(long bytes) {
    if (bytes < KB && bytes >= 0) {
        return Long.toString(bytes) + " bytes";
    }//from ww w . ja v  a2  s .c om
    StringBuilder builder = new StringBuilder();
    Formatter format = new Formatter(builder, Locale.getDefault());
    if (bytes < MB) {
        format.format("%.2f KB", (float) bytes / (float) KB);
    } else if (bytes < GB) {
        format.format("%.2f MB", (float) bytes / (float) MB);
    } else if (bytes < TB) {
        format.format("%.2f GB", (float) bytes / (float) GB);
    } else {
        format.format("%.4f TB", (float) bytes / (float) TB);
    }
    format.close();
    return builder.toString();
}

From source file:nz.co.senanque.sandbox.MessageTest.java

@Test
public void test1() throws Exception {
    String message = m_messageSource.getMessage("test.message", new Object[] { "one", "two", "three" },
            "The default message", Locale.getDefault());
    log.debug(message);/*from   www  . jav a 2  s.  co m*/
}

From source file:com.senacor.wbs.web.project.SortableListDataProvider.java

protected Locale getLocale() {
    return Locale.getDefault();
}

From source file:net.sf.jasperreports.charts.util.TimePeriodDatasetLabelGenerator.java

public TimePeriodDatasetLabelGenerator(Map<Comparable<?>, Map<TimePeriod, String>> labelsMap) {
    this(labelsMap, Locale.getDefault());
}

From source file:net.sf.jasperreports.charts.util.TimeSeriesLabelGenerator.java

public TimeSeriesLabelGenerator(Map<Comparable<?>, Map<RegularTimePeriod, String>> labelsMap) {
    this(labelsMap, Locale.getDefault());
}