mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-29 13:53:54 +01:00
* Updated language codes displayed for Hebrew, Indonesian and Yiddish (#2880) * Function 'fixLanguageCode' encapsulated with unit tests (#2880) * Renaming class "StringUtils" as "LangCodeUtils" and small String formatting improvement in "SpinnerLanguagesAdapter"
This commit is contained in:
parent
d22884f86a
commit
ee3f4d4d30
3 changed files with 56 additions and 5 deletions
|
|
@ -0,0 +1,23 @@
|
|||
package fr.free.nrw.commons.utils;
|
||||
|
||||
/**
|
||||
* Utilities class for miscellaneous strings
|
||||
*/
|
||||
public class LangCodeUtils {
|
||||
/**
|
||||
* Replaces the deprecated ISO-639 language codes used by Android with the updated ISO-639-1.
|
||||
* @param code Language code you want to update.
|
||||
* @return Updated language code. If not in the "deprecated list" returns the same code.
|
||||
*/
|
||||
public static String fixLanguageCode(String code) {
|
||||
if (code.equalsIgnoreCase("iw")) {
|
||||
return "he";
|
||||
} else if (code.equalsIgnoreCase("in")) {
|
||||
return "id";
|
||||
} else if (code.equalsIgnoreCase("ji")) {
|
||||
return "yi";
|
||||
} else {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue