1
0
Fork 0

Add Thai language support (#629)

* added Thai language

* the SoftKeyNumber now displays abbreviated letter list when there are too many letters on a single key

* updated the language validation rules to detect single letters in Asian languages

* added a 'no space between words' language YAML option

---------

Co-authored-by: sspanak <doftor.livain@gmail.com>
This commit is contained in:
Theppitak M. 2024-09-17 15:21:59 +07:00 committed by GitHub
parent e5b9beb84e
commit d5fc1fe4b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 19709 additions and 97 deletions

View file

@ -12,7 +12,7 @@ static def validateDictionaryWord(String word, int lineNumber, String validChara
errors += "${errorMsgPrefix}. Found a garbage word: '${word}' on line ${lineNumber}.\n"
}
if (word.matches("^.\$")) {
if (word.matches("^(.|\\p{L}\\p{M}?)\$")) {
errorCount++
errors += "${errorMsgPrefix}. Found a single letter: '${word}' on line ${lineNumber}. Only uppercase single letters are allowed. The rest of the alphabet will be added automatically.\n"
}
@ -65,6 +65,7 @@ static def parseLanguageFile(File languageFile, String dictionariesDir) {
line.matches("^[a-zA-Z].*")
&& !line.startsWith("abcString")
&& !line.startsWith("dictionaryFile")
&& !line.startsWith("hasSpaceBetweenWords")
&& !line.startsWith("hasUpperCase")
&& !line.startsWith("layout")
&& !line.startsWith("locale")
@ -77,10 +78,14 @@ static def parseLanguageFile(File languageFile, String dictionariesDir) {
errorMsg += "Language '${languageFile.name}' is invalid. Found unknown property: '${property}'.\n"
}
if (line.startsWith("hasUpperCase") && !line.endsWith("yes") && !line.endsWith("no")) {
if (
(line.startsWith("hasUpperCase") || line.startsWith("hasSpaceBetweenWords"))
&& !line.endsWith("yes") && !line.endsWith("no")
) {
def property = line.replaceAll(":.*\$", "")
def invalidVal = line.replace("hasUpperCase:", "").trim()
errorCount++
errorMsg += "Language '${languageFile.name}' is invalid. Unrecognized 'hasUpperCase' value: '${invalidVal}'. Only 'yes' and 'no' are allowed.\n"
errorMsg += "Language '${languageFile.name}' is invalid. Unrecognized '${property}' value: '${invalidVal}'. Only 'yes' and 'no' are allowed.\n"
}
if (line.startsWith("layout")) {