chore: Change localized string log to warning

This commit is contained in:
LisoUseInAIKyrios
2025-01-20 11:52:31 +01:00
parent 5086aabaef
commit e9be637f42

View File

@ -24,31 +24,31 @@ class StringResource(
if (value.startsWith('"') && value.endsWith('"')) { if (value.startsWith('"') && value.endsWith('"')) {
// Raw strings allow unescaped single quote but not double quote. // Raw strings allow unescaped single quote but not double quote.
if (!value.substring(1, value.length - 1).contains(Regex("(?<!\\\\)[\"]"))) { if (!value.substring(1, value.length - 1).contains(Regex("(?<!\\\\)[\"]"))) {
return this; return this
} }
} else { } else {
if (value.contains('\n')) { if (value.contains('\n')) {
// Don't throw an exception, otherwise unnoticed mistakes // Don't throw an exception, otherwise unnoticed mistakes
// in Crowdin can cause patching failures. // in Crowdin can cause patching failures.
// Incorrectly escaped strings still work but do not display as intended. // Incorrectly escaped strings still work but do not display as intended.
Logger.getLogger(StringResource.javaClass.name).severe( Logger.getLogger(StringResource.javaClass.name).warning(
"String $name is not raw but contains encoded new line characters: $value") "String $name is not raw but contains encoded new line characters: $value")
} }
if (!value.contains(Regex("(?<!\\\\)['\"]"))) { if (!value.contains(Regex("(?<!\\\\)['\"]"))) {
return this; return this
} }
} }
Logger.getLogger(StringResource.javaClass.name).severe( Logger.getLogger(StringResource.javaClass.name).warning(
"String $name cannot contain unescaped quotes in value: $value") "String $name cannot contain unescaped quotes in value: $value")
return this; return this
} }
// if the string is un-formatted, explicitly add the formatted attribute // if the string is un-formatted, explicitly add the formatted attribute
if (!formatted) setAttribute("formatted", "false") if (!formatted) setAttribute("formatted", "false")
textContent = value.validateAndroidStringEscaping(); textContent = value.validateAndroidStringEscaping()
} }
companion object { companion object {