added Tamazight
This commit is contained in:
parent
105749a792
commit
240e5c444a
11 changed files with 477882 additions and 16 deletions
13
app/languages/definitions/Tamazight.yml
Normal file
13
app/languages/definitions/Tamazight.yml
Normal 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
|
||||
14
app/languages/definitions/TamazightLatin.yml
Normal file
14
app/languages/definitions/TamazightLatin.yml
Normal 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
|
||||
238910
app/languages/dictionaries/tamazight-latin-utf8.txt
Normal file
238910
app/languages/dictionaries/tamazight-latin-utf8.txt
Normal file
File diff suppressed because it is too large
Load diff
238910
app/languages/dictionaries/tamazight-utf8.txt
Normal file
238910
app/languages/dictionaries/tamazight-utf8.txt
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue