blob: 6bca1f70bd4b348533eebc844002a7c0ea78b908 [file] [log] [blame]
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.base;
import java.util.Locale;
/**
* This class provides the locale related methods for the native library.
*/
class LocaleUtils {
private LocaleUtils() { /* cannot be instantiated */ }
/**
* @return the default locale.
*/
@CalledByNative
public static String getDefaultLocale() {
Locale locale = Locale.getDefault();
String language = locale.getLanguage();
String country = locale.getCountry();
return country.isEmpty() ? language : language + "-" + country;
}
}