Skip to content

Commit

Permalink
i18n: escape quotes and backslashes in the strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramblurr committed May 10, 2024
1 parent d469360 commit 723a38b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions resources/lang/app.pot
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Probematic\n"
"POT-Creation-Date: 2024-05-10 14:44+0200\n"
"POT-Creation-Date: 2024-05-10 15:03+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down Expand Up @@ -2744,7 +2744,7 @@ msgstr ""
#: :stats/active-members-count-tooltip
#, ycp-format
msgctxt ":stats/active-members-count-tooltip"
msgid "The number of members that were marked as "active" in SNOrga during the timeframe"
msgid "The number of members that were marked as \"active\" in SNOrga during the timeframe"
msgstr ""

#: :stats/probe-attendance
Expand Down
5 changes: 4 additions & 1 deletion src/clj/app/i18n.clj
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,15 @@
[s]
(parse (str/split-lines s)))

(defn escape-quotes [s]
(clojure.string/escape s {\\ "\\\\" \" "\\\""}))

(defn ->po-entry [[key untranslated-str]]
(format "#: %s
#, ycp-format
msgctxt \"%s\"
msgid \"%s\"
msgstr \"\"" (str key) (str key) untranslated-str))
msgstr \"\"" (str key) (escape-quotes (str key)) (escape-quotes untranslated-str)))

(defn pot-header []
(format "msgid \"\"
Expand Down

0 comments on commit 723a38b

Please sign in to comment.