diff options
author | agrajaghh <agrajaghh@gmail.com> | 2016-09-30 11:07:03 +0300 |
---|---|---|
committer | agrajaghh <agrajaghh@gmail.com> | 2016-09-30 11:07:03 +0300 |
commit | 3ce9c58301054a1cb4918086b956f6e50de77a36 (patch) | |
tree | 0f557be10fa85e46b860e9ac93036f5802e6e796 /BuildTools | |
parent | 23f7cd25d13c240367f7ed802893f933805b8bbc (diff) |
fix escaping of strings in .po
replace:
\' with '
\ with \\ (if not \r or \n)
" with \"
Diffstat (limited to 'BuildTools')
-rw-r--r-- | BuildTools/LocalizationTool2/Program.cs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/BuildTools/LocalizationTool2/Program.cs b/BuildTools/LocalizationTool2/Program.cs index 2e664f694..506a2127a 100644 --- a/BuildTools/LocalizationTool2/Program.cs +++ b/BuildTools/LocalizationTool2/Program.cs @@ -50,7 +50,8 @@ namespace LocalizationTool2 foreach (Match match in re.Matches(txt))
{
var linepos = txt.Substring(0, match.Index).Count(x => x == '\n') + 1;
- var str = match.Groups["sourcestring"].Value.Replace("\n", "\\n").Replace("\r", "\\r");
+ var str = match.Groups["sourcestring"].Value.Replace("\\'", "'");
+ str = Regex.Replace(str, "(\\\\+)([^rn])", "$1$1$2").Replace("\"", "\\\"").Replace("\n", "\\n").Replace("\r", "\\r");
LocalizationEntry le;
if (!map.TryGetValue(str, out le))
map[str] = new LocalizationEntry(str, f.Substring(sourcefolder.Length), linepos);
|