mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-05 22:53:38 +00:00
Test and fix Java to IANA country code mapping.
This commit is contained in:
@@ -320,7 +320,7 @@ public class SpeechSynthesis {
|
||||
final Configuration config = context.getResources().getConfiguration();
|
||||
|
||||
final String language = getIanaLanguageCode(locale.getLanguage());
|
||||
final String country = getIanaLocaleCode(locale.getCountry(), mJavaToIanaCountryCode);
|
||||
final String country = getIanaCountryCode(locale.getCountry());
|
||||
config.locale = new Locale(language, country, locale.getVariant());
|
||||
|
||||
Resources res = new Resources(context.getAssets(), metrics, config);
|
||||
@@ -371,6 +371,10 @@ public class SpeechSynthesis {
|
||||
return getIanaLocaleCode(code, mJavaToIanaLanguageCode);
|
||||
}
|
||||
|
||||
public static String getIanaCountryCode(String code) {
|
||||
return getIanaLocaleCode(code, mJavaToIanaCountryCode);
|
||||
}
|
||||
|
||||
private static String getIanaLocaleCode(String code, final Map<String, String> javaToIana) {
|
||||
final String iana = javaToIana.get(code);
|
||||
if (iana != null) {
|
||||
@@ -449,12 +453,13 @@ public class SpeechSynthesis {
|
||||
mJavaToIanaLanguageCode.put("vie", "vi");
|
||||
mJavaToIanaLanguageCode.put("zho", "zh");
|
||||
|
||||
mJavaToIanaCountryCode.put("JAM", "JM");
|
||||
mJavaToIanaCountryCode.put("MEX", "MX");
|
||||
mJavaToIanaCountryCode.put("BEL", "BE");
|
||||
mJavaToIanaCountryCode.put("BRA", "BR");
|
||||
mJavaToIanaCountryCode.put("FRA", "FR");
|
||||
mJavaToIanaCountryCode.put("GBR", "GB");
|
||||
mJavaToIanaCountryCode.put("HKG", "HK");
|
||||
mJavaToIanaCountryCode.put("JAM", "JM");
|
||||
mJavaToIanaCountryCode.put("MEX", "MX");
|
||||
mJavaToIanaCountryCode.put("PRT", "PT");
|
||||
mJavaToIanaCountryCode.put("USA", "US");
|
||||
mJavaToIanaCountryCode.put("VNM", "VN");
|
||||
|
||||
Reference in New Issue
Block a user