use of java.util.Locale in project hadoop by apache.
the class TestFSDownload method testDownloadArchiveZipWithTurkishLocale.
/*
* To test fix for YARN-3029
*/
@Test(timeout = 10000)
public void testDownloadArchiveZipWithTurkishLocale() throws IOException, URISyntaxException, InterruptedException {
Locale defaultLocale = Locale.getDefault();
// Set to Turkish
Locale turkishLocale = new Locale("tr", "TR");
Locale.setDefault(turkishLocale);
downloadWithFileType(TEST_FILE_TYPE.ZIP);
// Set the locale back to original default locale
Locale.setDefault(defaultLocale);
}
use of java.util.Locale in project SeriesGuide by UweTrottmann.
the class MovieLocalizationDialogFragment method updateButtonText.
private void updateButtonText() {
// example: "en-US"
String languageCode = DisplaySettings.getMoviesLanguage(getContext());
String languageDisplayName = new Locale(languageCode.substring(0, 2), languageCode.substring(3)).getDisplayName();
buttonLanguage.setText(languageDisplayName);
String regionCode = DisplaySettings.getMoviesRegion(getContext());
buttonRegion.setText(new Locale("", regionCode).getDisplayCountry());
}
use of java.util.Locale in project SeriesGuide by UweTrottmann.
the class LanguageTools method getMovieLanguageData.
/**
* Returns the string representation and index of the given two letter ISO 639-1 language code
* plus an extra ISO-3166-1 region tag used by TMDB currently set by {@link
* DisplaySettings#getMoviesLanguage(Context)}.
*/
@Nullable
public static LanguageData getMovieLanguageData(Context context) {
String languageCodeCurrent = DisplaySettings.getMoviesLanguage(context);
String[] languageCodes = context.getResources().getStringArray(R.array.languageCodesMovies);
for (int i = 0; i < languageCodes.length; i++) {
String languageCode = languageCodes[i];
if (languageCode.equals(languageCodeCurrent)) {
String languageDisplayName = new Locale(languageCode.substring(0, 2), languageCode.substring(3)).getDisplayName();
return new LanguageData(i, languageCode, languageDisplayName);
}
}
return null;
}
use of java.util.Locale in project NewPipe by TeamNewPipe.
the class Localization method formatDate.
private static String formatDate(String date, Context context) {
Locale locale = getPreferredLocale(context);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date datum = null;
try {
datum = formatter.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
return df.format(datum);
}
use of java.util.Locale in project NewPipe by TeamNewPipe.
the class Localization method localizeViewCount.
public static String localizeViewCount(long viewCount, Context context) {
Locale locale = getPreferredLocale(context);
Resources res = context.getResources();
String viewsString = res.getString(R.string.view_count_text);
NumberFormat nf = NumberFormat.getInstance(locale);
String formattedViewCount = nf.format(viewCount);
return String.format(viewsString, formattedViewCount);
}
Aggregations