Created
April 23, 2016 15:36
-
-
Save bendikro/cfe8168829ce54ea8f69269b328f0d6a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 def escape(text): | |
26 """ | |
27 Used by the gettext.js template to escape translated strings | |
28 so they don't break the script. | |
29 """ | |
30 t = text | |
31 text = text.replace("'", "\\'") | |
32 text = text.replace('\r\n', '\\n') | |
33 text = text.replace('\r', '\\n') | |
34 text = text.replace('\n', '\\n') | |
35 if t != text: | |
36 print "web.common.escape('%s') -> '%s'" % (t, text) | |
37 return text | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment