Simon Meers avatar Simon Meers committed a1136ae

A few fixes

Comments (0)

Files changed (5)

dbgettext/management/commands/dbgettext_export.py

         def write(file, string):
             string = string.replace('"','\\"') # prevent """"
             string = string.encode('utf8')
-            file.write(u'gettext("""%s""")\n' % string)
+            file.write('gettext("""%s""")\n' % string)
 
         root = os.path.join(self.path, self.root)
 

dbgettext/parser.py

                 format += '%%(%s)s' % t.get_key()
                 params[t.get_key()] = t.get_raw()
             else:
-                format += t.get_raw()
+                format += t.get_raw().replace('%', '%%')
             inner_gettext += t.get_gettext()
         return format, params, remainder, inner_gettext
 
+.. _FAQ:
+
+Frequently Asked Questions
+==========================
+
+Q: dbgettext strings are showing up in my ``.po`` files, but are not translated when displayed in my browser
+    A: Make sure you have:
+        - run ``compilemessages``
+	- restarted the server
+	- used ``gettext`` or ``trans`` to translate the strings in when accessed in your code or templates
    settings
    parsing
    nesting
+   FAQ
 
 	    return [self.href, self.content]
 
 	def get_key(self):
-	    return 'link:%s' % self.content
+	    return 'link:%s' % self.content  # should sanitize content first
 
 
     class TextOptions(Options):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.