Commits

Anonymous committed 0e28d56

Move i18n part of the MessageCatalogBuilder in a seperate one

Comments (0)

Files changed (1)

sphinx/builders/intl.py

     :license: BSD, see LICENSE for details.
 """
 
-import collections
+from collections import defaultdict
 from datetime import datetime
 from os import path
 
 
 """[1:]
 
-class MessageCatalogBuilder(Builder):
-    """
-    Builds gettext-style message catalogs (.pot files).
-    """
-    name = 'gettext'
+class I18NBuilder(Builder):
+    name = 'i18n'
 
     def init(self):
-        self.catalogs = collections.defaultdict(list)
+        Builder.init(self)
+        self.catalogs = defaultdict(list)
 
     def get_target_uri(self, docname, typ=None):
         return ''
         return
 
     def write_doc(self, docname, doctree):
-        """
-        Store a document's translatable strings in the message catalog of its
-        section. For this purpose a document's *top-level directory* -- or
-        otherwise its *name* -- is considered its section.
-        """
         catalog = self.catalogs[docname.split(SEP, 1)[0]]
         for _, msg in extract_messages(doctree):
-            # XXX msgctxt for duplicate messages
             if msg not in catalog:
                 catalog.append(msg)
 
+class MessageCatalogBuilder(I18NBuilder):
+    """
+    Builds gettext-style message catalogs (.pot files).
+    """
+    name = 'gettext'
+
     def finish(self):
         data = dict(
             version = self.config.version,
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.