1
0
Fork 0

added Tamazight

This commit is contained in:
sspanak 2024-12-26 15:33:22 +02:00 committed by Dimo Karaivanov
parent 105749a792
commit 240e5c444a
11 changed files with 477882 additions and 16 deletions

View file

@ -0,0 +1,13 @@
locale: zgh-MA
dictionaryFile: tamazight-utf8.txt
layout:
- [SPECIAL] # 0
- [PUNCTUATION] # 1
- [ⴰ, ⴱ, ⴳ, ⴷ] # 2
- [, ⴻ, ⴼ, ⴽ] # 3
- [ⵀ, ⵃ, ⵄ, ⵅ] # 4
- [ⵇ, ⵉ, ⵊ, ⵍ] # 5
- [ⵎ, , ⵓ, ] # 6
- [, ⵖ, ⵙ, ⵚ] # 7
- [ⵛ, ⵜ, ⵟ, ⵡ] # 8
- [ⵢ, ⵣ, ⵥ, ⵯ] # 9

View file

@ -0,0 +1,14 @@
locale: zgh-DZ # zgh = Morroccan Tamazight, DZ = Algeria. We combine these just to get a unique ID.
name: Tamaziɣt / MA
dictionaryFile: tamazight-latin-utf8.txt
layout:
- [SPECIAL] # 0
- [PUNCTUATION] # 1
- [a, b, c] # 2
- [d, ḍ, e, f] # 3
- [g, h, ḥ, i] # 4
- [j, k, l] # 5
- [m, n, ɛ, o] # 6
- [p, q, r, ṛ, s, ṣ] # 7
- [t, ṭ, u, ɣ, v] # 8
- [w, x, y, z, ẓ, ʷ] # 9

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -25,10 +25,35 @@ class LocaleCompat {
case "yi" -> "ji";
case "he" -> "iw";
case "id" -> "in";
case "zgh" -> "zg";
default -> language;
};
}
public String getUniqueLanguageCode() {
if (locale == null) {
return "";
}
String country = locale.getCountry().toLowerCase();
String language = locale.getLanguage().toLowerCase();
switch (language) {
case "en":
if ("in".equals(country)) { // en-IN = Hinglish
return "hi";
}
// otherwise, fall-through to return "en"
case "ca":
return language;
case "ji":
return "yi";
case "zgh":
return "tmz";
default:
return country;
}
}
@NonNull
@Override

View file

@ -145,6 +145,7 @@ public class NaturalLanguage extends Language implements Comparable<NaturalLangu
return switch (getLocale().getLanguage()) {
case "fi" -> "su";
case "sw" -> "ki";
case "zgh" -> "tam";
default -> getLocale().toString();
};
}
@ -171,22 +172,11 @@ public class NaturalLanguage extends Language implements Comparable<NaturalLangu
@NonNull
@Override
public String getCode() {
if (code != null) {
return code;
if (code == null) {
code = new LocaleCompat(locale).getUniqueLanguageCode();
}
String country = getLocale().getCountry().toLowerCase();
String language = getLocale().getLanguage().toLowerCase();
if ("en".equals(language) && "in".equalsIgnoreCase(country)) {
return code = "hi";
}
if ("ar".equals(language) || "ca".equals(language) || "en".equals(language)) {
return code = language;
}
return code = country.equals("ji") ? "yi" : country;
return code;
}