fixed comments and 3-letter language codes breaking language definitions
This commit is contained in:
parent
97b3292f61
commit
105749a792
1 changed files with 15 additions and 13 deletions
|
|
@ -58,25 +58,27 @@ ext.parseLanguageDefintion = { File languageFile, String dictionariesDir ->
|
||||||
String localeString = ""
|
String localeString = ""
|
||||||
String dictionaryFileName = ""
|
String dictionaryFileName = ""
|
||||||
|
|
||||||
for (String line : languageFile.readLines()) {
|
for (String rawLine : languageFile.readLines()) {
|
||||||
if (
|
if (
|
||||||
line.matches("^[a-zA-Z].*")
|
rawLine.matches("^[a-zA-Z].*")
|
||||||
&& !line.startsWith("abcString")
|
&& !rawLine.startsWith("abcString")
|
||||||
&& !line.startsWith("dictionaryFile")
|
&& !rawLine.startsWith("dictionaryFile")
|
||||||
&& !line.startsWith("hasSpaceBetweenWords")
|
&& !rawLine.startsWith("hasSpaceBetweenWords")
|
||||||
&& !line.startsWith("hasUpperCase")
|
&& !rawLine.startsWith("hasUpperCase")
|
||||||
&& !line.startsWith("layout")
|
&& !rawLine.startsWith("layout")
|
||||||
&& !line.startsWith("locale")
|
&& !rawLine.startsWith("locale")
|
||||||
&& !line.startsWith("name")
|
&& !rawLine.startsWith("name")
|
||||||
&& !line.startsWith("sounds")
|
&& !rawLine.startsWith("sounds")
|
||||||
) {
|
) {
|
||||||
def parts = line.split(":")
|
def parts = rawLine.split(":")
|
||||||
def property = parts.length > 0 ? parts[0] : line
|
def property = parts.length > 0 ? parts[0] : rawLine
|
||||||
|
|
||||||
errorCount++
|
errorCount++
|
||||||
errorMsg += "Language '${languageFile.name}' is invalid. Found unknown property: '${property}'.\n"
|
errorMsg += "Language '${languageFile.name}' is invalid. Found unknown property: '${property}'.\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String line = rawLine.replaceFirst("#[\\s\\S]+\$", "")
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(line.startsWith("hasUpperCase") || line.startsWith("hasSpaceBetweenWords"))
|
(line.startsWith("hasUpperCase") || line.startsWith("hasSpaceBetweenWords"))
|
||||||
&& !line.endsWith("yes") && !line.endsWith("no")
|
&& !line.endsWith("yes") && !line.endsWith("no")
|
||||||
|
|
@ -97,7 +99,7 @@ ext.parseLanguageDefintion = { File languageFile, String dictionariesDir ->
|
||||||
|
|
||||||
if (line.startsWith("locale")) {
|
if (line.startsWith("locale")) {
|
||||||
localeString = line.replace("locale:", "").trim()
|
localeString = line.replace("locale:", "").trim()
|
||||||
isLocaleValid = line.matches("^locale:\\s*[a-z]{2}(?:-[A-Z]{2})?")
|
isLocaleValid = localeString.matches("^[a-z]{2,3}(?:-[A-Z]{2})?\$")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line.startsWith("dictionaryFile")) {
|
if (line.startsWith("dictionaryFile")) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue