本文整理了Java中java.util.Locale.toNewString()
方法的一些代码示例,展示了Locale.toNewString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Locale.toNewString()
方法的具体详情如下:
包路径:java.util.Locale
类名称:Locale
方法名:toNewString
暂无
代码示例来源:origin: libgdx/libgdx
/**
* Returns the string representation of this {@code Locale}. It consists of the
* language code, country code and variant separated by underscores.
* If the language is missing the string begins
* with an underscore. If the country is missing there are 2 underscores
* between the language and the variant. The variant cannot stand alone
* without a language and/or country code: in this case this method would
* return the empty string.
*
* <p>Examples: "en", "en_US", "_US", "en__POSIX", "en_US_POSIX"
*/
@Override
public final String toString() {
String result = cachedToStringResult;
if (result == null) {
result = cachedToStringResult = toNewString(languageCode, countryCode, variantCode);
}
return result;
}
代码示例来源:origin: libgdx/libgdx
/**
* Returns the string representation of this {@code Locale}. It consists of the
* language code, country code and variant separated by underscores.
* If the language is missing the string begins
* with an underscore. If the country is missing there are 2 underscores
* between the language and the variant. The variant cannot stand alone
* without a language and/or country code: in this case this method would
* return the empty string.
*
* <p>Examples: "en", "en_US", "_US", "en__POSIX", "en_US_POSIX"
*/
@Override
public final String toString() {
String result = cachedToStringResult;
if (result == null) {
result = cachedToStringResult = toNewString(languageCode, countryCode, variantCode);
}
return result;
}
代码示例来源:origin: robovm/robovm
/**
* Returns the string representation of this {@code Locale}. It consists of the
* language code, country code and variant separated by underscores.
* If the language is missing the string begins
* with an underscore. If the country is missing there are 2 underscores
* between the language and the variant. The variant cannot stand alone
* without a language and/or country code: in this case this method would
* return the empty string.
*
* <p>Examples: "en", "en_US", "_US", "en__POSIX", "en_US_POSIX"
*/
@Override
public final String toString() {
String result = cachedToStringResult;
if (result == null) {
result = cachedToStringResult = toNewString(languageCode, countryCode, variantCode);
}
return result;
}
代码示例来源:origin: robovm/robovm
/**
* Returns the name of this locale's language, localized to {@code locale}.
* If the language name is unknown, the language code is returned.
*/
public String getDisplayLanguage(Locale locale) {
if (languageCode.isEmpty()) {
return "";
}
// http://b/8049507 --- frameworks/base should use fil_PH instead of tl_PH.
// Until then, we're stuck covering their tracks, making it look like they're
// using "fil" when they're not.
String localeString = toString();
if (languageCode.equals("tl")) {
localeString = toNewString("fil", countryCode, variantCode);
}
String result = ICU.getDisplayLanguageNative(localeString, locale.toString());
if (result == null) { // TODO: do we need to do this, or does ICU do it for us?
result = ICU.getDisplayLanguageNative(localeString, Locale.getDefault().toString());
}
return result;
}
代码示例来源:origin: com.jtransc/jtransc-rt
@Override
public final String toString() {
String result = cachedToStringResult;
if (result == null) result = cachedToStringResult = toNewString(languageCode, countryCode, variantCode);
return result;
}
代码示例来源:origin: ibinti/bugvm
/**
* Returns the string representation of this {@code Locale}. It consists of the
* language code, country code and variant separated by underscores.
* If the language is missing the string begins
* with an underscore. If the country is missing there are 2 underscores
* between the language and the variant. The variant cannot stand alone
* without a language and/or country code: in this case this method would
* return the empty string.
*
* <p>Examples: "en", "en_US", "_US", "en__POSIX", "en_US_POSIX"
*/
@Override
public final String toString() {
String result = cachedToStringResult;
if (result == null) {
result = cachedToStringResult = toNewString(languageCode, countryCode, variantCode);
}
return result;
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* Returns the string representation of this {@code Locale}. It consists of the
* language code, country code and variant separated by underscores.
* If the language is missing the string begins
* with an underscore. If the country is missing there are 2 underscores
* between the language and the variant. The variant cannot stand alone
* without a language and/or country code: in this case this method would
* return the empty string.
*
* <p>Examples: "en", "en_US", "_US", "en__POSIX", "en_US_POSIX"
*/
@Override
public final String toString() {
String result = cachedToStringResult;
if (result == null) {
result = cachedToStringResult = toNewString(languageCode, countryCode, variantCode);
}
return result;
}
代码示例来源:origin: MobiVM/robovm
/**
* Returns the string representation of this {@code Locale}. It consists of the
* language code, country code and variant separated by underscores.
* If the language is missing the string begins
* with an underscore. If the country is missing there are 2 underscores
* between the language and the variant. The variant cannot stand alone
* without a language and/or country code: in this case this method would
* return the empty string.
*
* <p>Examples: "en", "en_US", "_US", "en__POSIX", "en_US_POSIX"
*/
@Override
public final String toString() {
String result = cachedToStringResult;
if (result == null) {
result = cachedToStringResult = toNewString(languageCode, countryCode, variantCode);
}
return result;
}
代码示例来源:origin: FlexoVM/flexovm
/**
* Returns the string representation of this {@code Locale}. It consists of the
* language code, country code and variant separated by underscores.
* If the language is missing the string begins
* with an underscore. If the country is missing there are 2 underscores
* between the language and the variant. The variant cannot stand alone
* without a language and/or country code: in this case this method would
* return the empty string.
*
* <p>Examples: "en", "en_US", "_US", "en__POSIX", "en_US_POSIX"
*/
@Override
public final String toString() {
String result = cachedToStringResult;
if (result == null) {
result = cachedToStringResult = toNewString(languageCode, countryCode, variantCode);
}
return result;
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* Returns the string representation of this {@code Locale}. It consists of the
* language code, country code and variant separated by underscores.
* If the language is missing the string begins
* with an underscore. If the country is missing there are 2 underscores
* between the language and the variant. The variant cannot stand alone
* without a language and/or country code: in this case this method would
* return the empty string.
*
* <p>Examples: "en", "en_US", "_US", "en__POSIX", "en_US_POSIX"
*/
@Override
public final String toString() {
String result = cachedToStringResult;
if (result == null) {
result = cachedToStringResult = toNewString(languageCode, countryCode, variantCode);
}
return result;
}
代码示例来源:origin: com.gluonhq/robovm-rt
/**
* Returns the string representation of this {@code Locale}. It consists of the
* language code, country code and variant separated by underscores.
* If the language is missing the string begins
* with an underscore. If the country is missing there are 2 underscores
* between the language and the variant. The variant cannot stand alone
* without a language and/or country code: in this case this method would
* return the empty string.
*
* <p>Examples: "en", "en_US", "_US", "en__POSIX", "en_US_POSIX"
*/
@Override
public final String toString() {
String result = cachedToStringResult;
if (result == null) {
result = cachedToStringResult = toNewString(languageCode, countryCode, variantCode);
}
return result;
}
代码示例来源:origin: dragome/dragome-sdk
/**
* Returns the string representation of this {@code Locale}. It consists of the
* language code, country code and variant separated by underscores.
* If the language is missing the string begins
* with an underscore. If the country is missing there are 2 underscores
* between the language and the variant. The variant cannot stand alone
* without a language and/or country code: in this case this method would
* return the empty string.
*
* <p>Examples: "en", "en_US", "_US", "en__POSIX", "en_US_POSIX"
*/
@Override
public final String toString() {
String result = cachedToStringResult;
if (result == null) {
result = cachedToStringResult = toNewString(languageCode, countryCode, variantCode);
}
return result;
}
代码示例来源:origin: thothbot/parallax
/**
* Returns the string representation of this {@code Locale}. It consists of the
* language code, country code and variant separated by underscores.
* If the language is missing the string begins
* with an underscore. If the country is missing there are 2 underscores
* between the language and the variant. The variant cannot stand alone
* without a language and/or country code: in this case this method would
* return the empty string.
*
* <p>Examples: "en", "en_US", "_US", "en__POSIX", "en_US_POSIX"
*/
@Override
public final String toString() {
String result = cachedToStringResult;
if (result == null) {
result = cachedToStringResult = toNewString(languageCode, countryCode, variantCode);
}
return result;
}
代码示例来源:origin: com.jtransc/jtransc-rt
public String getDisplayLanguage(Locale locale) {
if (languageCode.isEmpty()) return "";
// http://b/8049507 --- frameworks/base should use fil_PH instead of tl_PH.
// Until then, we're stuck covering their tracks, making it look like they're
// using "fil" when they're not.
String localeString = toString();
if (languageCode.equals("tl")) {
localeString = toNewString("fil", countryCode, variantCode);
}
//String result = ICU.getDisplayLanguageNative(localeString, locale.toString());
//if (result == null) { // TODO: do we need to do this, or does ICU do it for us?
// result = ICU.getDisplayLanguageNative(localeString, Locale.getDefault().toString());
//}
//return result;
return languageCode;
}
代码示例来源:origin: MobiVM/robovm
/**
* Returns the name of this locale's language, localized to {@code locale}.
* If the language name is unknown, the language code is returned.
*/
public String getDisplayLanguage(Locale locale) {
if (languageCode.isEmpty()) {
return "";
}
// http://b/8049507 --- frameworks/base should use fil_PH instead of tl_PH.
// Until then, we're stuck covering their tracks, making it look like they're
// using "fil" when they're not.
String localeString = toString();
if (languageCode.equals("tl")) {
localeString = toNewString("fil", countryCode, variantCode);
}
String result = ICU.getDisplayLanguageNative(localeString, locale.toString());
if (result == null) { // TODO: do we need to do this, or does ICU do it for us?
result = ICU.getDisplayLanguageNative(localeString, Locale.getDefault().toString());
}
return result;
}
代码示例来源:origin: ibinti/bugvm
/**
* Returns the name of this locale's language, localized to {@code locale}.
* If the language name is unknown, the language code is returned.
*/
public String getDisplayLanguage(Locale locale) {
if (languageCode.isEmpty()) {
return "";
}
// http://b/8049507 --- frameworks/base should use fil_PH instead of tl_PH.
// Until then, we're stuck covering their tracks, making it look like they're
// using "fil" when they're not.
String localeString = toString();
if (languageCode.equals("tl")) {
localeString = toNewString("fil", countryCode, variantCode);
}
String result = ICU.getDisplayLanguageNative(localeString, locale.toString());
if (result == null) { // TODO: do we need to do this, or does ICU do it for us?
result = ICU.getDisplayLanguageNative(localeString, Locale.getDefault().toString());
}
return result;
}
代码示例来源:origin: com.gluonhq/robovm-rt
/**
* Returns the name of this locale's language, localized to {@code locale}.
* If the language name is unknown, the language code is returned.
*/
public String getDisplayLanguage(Locale locale) {
if (languageCode.isEmpty()) {
return "";
}
// http://b/8049507 --- frameworks/base should use fil_PH instead of tl_PH.
// Until then, we're stuck covering their tracks, making it look like they're
// using "fil" when they're not.
String localeString = toString();
if (languageCode.equals("tl")) {
localeString = toNewString("fil", countryCode, variantCode);
}
String result = ICU.getDisplayLanguageNative(localeString, locale.toString());
if (result == null) { // TODO: do we need to do this, or does ICU do it for us?
result = ICU.getDisplayLanguageNative(localeString, Locale.getDefault().toString());
}
return result;
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* Returns the name of this locale's language, localized to {@code locale}.
* If the language name is unknown, the language code is returned.
*/
public String getDisplayLanguage(Locale locale) {
if (languageCode.isEmpty()) {
return "";
}
// http://b/8049507 --- frameworks/base should use fil_PH instead of tl_PH.
// Until then, we're stuck covering their tracks, making it look like they're
// using "fil" when they're not.
String localeString = toString();
if (languageCode.equals("tl")) {
localeString = toNewString("fil", countryCode, variantCode);
}
String result = ICU.getDisplayLanguageNative(localeString, locale.toString());
if (result == null) { // TODO: do we need to do this, or does ICU do it for us?
result = ICU.getDisplayLanguageNative(localeString, Locale.getDefault().toString());
}
return result;
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* Returns the name of this locale's language, localized to {@code locale}.
* If the language name is unknown, the language code is returned.
*/
public String getDisplayLanguage(Locale locale) {
if (languageCode.isEmpty()) {
return "";
}
// http://b/8049507 --- frameworks/base should use fil_PH instead of tl_PH.
// Until then, we're stuck covering their tracks, making it look like they're
// using "fil" when they're not.
String localeString = toString();
if (languageCode.equals("tl")) {
localeString = toNewString("fil", countryCode, variantCode);
}
String result = ICU.getDisplayLanguageNative(localeString, locale.toString());
if (result == null) { // TODO: do we need to do this, or does ICU do it for us?
result = ICU.getDisplayLanguageNative(localeString, Locale.getDefault().toString());
}
return result;
}
代码示例来源:origin: FlexoVM/flexovm
/**
* Returns the name of this locale's language, localized to {@code locale}.
* If the language name is unknown, the language code is returned.
*/
public String getDisplayLanguage(Locale locale) {
if (languageCode.isEmpty()) {
return "";
}
// http://b/8049507 --- frameworks/base should use fil_PH instead of tl_PH.
// Until then, we're stuck covering their tracks, making it look like they're
// using "fil" when they're not.
String localeString = toString();
if (languageCode.equals("tl")) {
localeString = toNewString("fil", countryCode, variantCode);
}
String result = ICU.getDisplayLanguageNative(localeString, locale.toString());
if (result == null) { // TODO: do we need to do this, or does ICU do it for us?
result = ICU.getDisplayLanguageNative(localeString, Locale.getDefault().toString());
}
return result;
}
内容来源于网络,如有侵权,请联系作者删除!