Skip to content

Commit

Permalink
fix: android xml export - name normalization - consistently replace u…
Browse files Browse the repository at this point in the history
…nsupported characters with single underscore (#2779)
  • Loading branch information
Anty0 authored Dec 14, 2024
1 parent fee1abd commit da9bfad
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class AndroidStringsXmlExporter(
units[normalizedName] = NodeWrapper(node, isExactKeyName, keyName)
}

private fun String.normalizedKeyName() = replace(KEY_REPLACE_REGEX, "_").replace("__", "_")
private fun String.normalizedKeyName() = replace(KEY_REPLACE_REGEX, "_")

private class NodeWrapper(
val node: AndroidXmlNode,
Expand Down Expand Up @@ -216,7 +216,7 @@ class AndroidStringsXmlExporter(
Regex("(?<name>.*)\\[(?<index>\\d+)\\]$")
}
val KEY_REPLACE_REGEX by lazy {
Regex("[^a-zA-Z0-9_]")
Regex("[^a-zA-Z0-9_]+")
}
}
}

0 comments on commit da9bfad

Please sign in to comment.