Commits

Simon Meers committed a1136ae

A few fixes

  • Participants
  • Parent commits 63016de

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):