From: Badlop <badlop@process-one.net>
Date: Sat, 14 Apr 2012 22:05:03 +0000 (+0200)
Subject: Fix translation script to use ejabberd_regexp (EJAB-921)
X-Git-Tag: v2.1.11~27
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=017ce4e0925f292e90b7d8cb8d50c4e9afbca59c;p=ejabberd

Fix translation script to use ejabberd_regexp (EJAB-921)
---

diff --git a/contrib/extract_translations/extract_translations.erl b/contrib/extract_translations/extract_translations.erl
index 488357ba6..90f4ac519 100644
--- a/contrib/extract_translations/extract_translations.erl
+++ b/contrib/extract_translations/extract_translations.erl
@@ -281,14 +281,14 @@ build_additional_translators(List) ->
       List).
 
 print_translation(File, Line, Str, StrT) ->
-    {ok, StrQ, _} = regexp:gsub(Str, "\"", "\\\""),
-    {ok, StrTQ, _} = regexp:gsub(StrT, "\"", "\\\""),
+    StrQ = ejabberd_regexp:greplace(Str, "\\\"", "\\\\\""),
+    StrTQ = ejabberd_regexp:greplace(StrT, "\\\"", "\\\\\""),
     io:format("#: ~s:~p~nmsgid \"~s\"~nmsgstr \"~s\"~n~n", [File, Line, StrQ, StrTQ]).
 
 print_translation_obsolete(Str, StrT) ->
     File = "unknown.erl",
     Line = 1,
-    {ok, StrQ, _} = regexp:gsub(Str, "\"", "\\\""),
-    {ok, StrTQ, _} = regexp:gsub(StrT, "\"", "\\\""),
+    StrQ = ejabberd_regexp:greplace(Str, "\\\"", "\\\\\""),
+    StrTQ = ejabberd_regexp:greplace(StrT, "\\\"", "\\\\\""),
     io:format("#: ~s:~p~n#~~ msgid \"~s\"~n#~~ msgstr \"~s\"~n~n", [File, Line, StrQ, StrTQ]).