Browse Source

wxGUI: enable i18n for modeler menu

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@41860 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 15 years ago
parent
commit
05356cf2be
3 changed files with 19 additions and 15 deletions
  1. 3 1
      gui/wxpython/Makefile
  2. 15 13
      gui/wxpython/gui_modules/menudata.py
  3. 1 1
      gui/wxpython/xml/menudata_modeler.xml

+ 3 - 1
gui/wxpython/Makefile

@@ -21,9 +21,11 @@ default: $(DSTFILES) menustrings.py
 $(ETCDIR)/%: % | $(DSTDIRS)
 	$(INSTALL_DATA) $< $@
 
-menustrings.py: gui_modules/menudata.py $(ETCDIR)/xml/menudata.xml
+menustrings.py: gui_modules/menudata.py $(ETCDIR)/xml/menudata.xml $(ETCDIR)/xml/menudata_modeler.xml 
 	GISBASE="$(GISBASE)" \
 	$(PYTHON) $< > $@
+	GISBASE="$(GISBASE)" \
+	$(PYTHON) $< "modeler" >> $@
 
 $(DSTDIRS): %: | $(ETCDIR)
 	$(MKDIR) $@

+ 15 - 13
gui/wxpython/gui_modules/menudata.py

@@ -10,7 +10,7 @@ Classes:
 
 Usage:
 @code
-python menudata.py action [file]
+python menudata.py [action] [manager|modeler]
 @endcode
 
 where <i>action</i>:
@@ -116,7 +116,8 @@ class MenuData:
         """!Print menu strings to file (used for localization)
 
         @param fh file descriptor"""
-	fh.write('menustrings = [\n')
+        className = str(self.__class__).split('.', 1)[1]
+	fh.write('menustrings_%s = [\n' % className)
 	for node in self.tree.getiterator():
 	    if node.tag in ['label', 'help']:
 		fh.write('     _(%r),\n' % node.text)
@@ -236,18 +237,19 @@ if __name__ == "__main__":
     import gettext
     gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode=True)
 
-    file = None
-    if len(sys.argv) == 1:
-        action = 'strings'
-    elif len(sys.argv) > 1:
-        action = sys.argv[1]
-    if len(sys.argv) > 2:
-        file = sys.argv[2]
-
-    if file:
-        data = ManagerData(file)
-    else:
+    action = 'strings'
+    menu   = 'manager'
+    
+    for arg in sys.argv:
+        if arg in ('strings', 'tree', 'commands', 'dump'):
+            action =  arg
+        elif arg in ('manager', 'modeler'):
+            menu = arg
+    
+    if menu == 'manager':
         data = ManagerData()
+    else:
+        data = ModelerData()
     
     if action == 'strings':
         data.PrintStrings(sys.stdout)

+ 1 - 1
gui/wxpython/xml/menudata_modeler.xml

@@ -39,7 +39,7 @@
 	</menuitem>
 	<separator />
 	<menuitem>
-	  <label>Close modeler</label>
+	  <label>Quit modeler</label>
 	  <help>Close modeler window</help>
 	  <handler>OnCloseWindow</handler>
 	  <shortcut>Ctrl+W</shortcut>