[IMP] ir.translation,tools.translate._(): cleanup and speedup if translations via _()
[odoo/odoo.git] / bin / tools / misc.py
index 3d7dbd8..b1d7744 100644 (file)
@@ -86,7 +86,7 @@ def init_db(cr):
             c_id = cr.fetchone()
             if not c_id:
                 cr.execute('INSERT INTO ir_module_category \
-                        (id, name, parent_id) \
+                        (name, parent_id) \
                         VALUES (%s, %s) RETURNING id', (categs[0], p_id))
                 c_id = cr.fetchone()[0]
             else:
@@ -141,15 +141,15 @@ def exec_pg_command(name, *args):
     prog = find_pg_tool(name)
     if not prog:
         raise Exception('Couldn\'t find %s' % name)
-    args2 = (os.path.basename(prog),) + args
+    args2 = (prog,) + args
     
-    return subprocess.call(args2, executable=prog)
+    return subprocess.call(args2)
 
 def exec_pg_command_pipe(name, *args):
     prog = find_pg_tool(name)
     if not prog:
         raise Exception('Couldn\'t find %s' % name)
-    pop = subprocess.Popen(args, executable=prog, shell=True, bufsize= -1,
+    pop = subprocess.Popen((prog,) + args, bufsize= -1,
           stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)
     return (pop.stdin, pop.stdout)
 
@@ -157,7 +157,7 @@ def exec_command_pipe(name, *args):
     prog = find_in_path(name)
     if not prog:
         raise Exception('Couldn\'t find %s' % name)
-    pop = subprocess.Popen(args, executable=prog, shell=True, bufsize= -1,
+    pop = subprocess.Popen((prog,) + args, bufsize= -1,
           stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)
     return (pop.stdin, pop.stdout)
 
@@ -912,6 +912,8 @@ def get_iso_codes(lang):
     return lang
 
 def get_languages():
+    # The codes below are those from Launchpad's Rosetta, with the exception
+    # of some trivial codes where the Launchpad code is xx and we have xx_XX.
     languages={
         'ab_RU': u'Abkhazian / аҧсуа',
         'ar_AR': u'Arabic / الْعَرَبيّة',
@@ -952,6 +954,7 @@ def get_languages():
         'fr_FR': u'French / Français',
         'gl_ES': u'Galician / Galego',
         'gu_IN': u'Gujarati / ગુજરાતી',
+        'he_IL': u'Hebrew / עִבְרִי',
         'hi_IN': u'Hindi / हिंदी',
         'hr_HR': u'Croatian / hrvatski jezik',
         'hu_HU': u'Hungarian / Magyar',
@@ -978,7 +981,8 @@ def get_languages():
         'sl_SI': u'Slovenian / slovenščina',
         'sk_SK': u'Slovak / Slovenský jazyk',
         'sq_AL': u'Albanian / Shqip',
-        'sr_RS': u'Serbian / српски језик',
+        'sr_RS': u'Serbian (Cyrillic) / српски',
+        'sr@latin': u'Serbian (Latin) / srpski',
         'sv_SE': u'Swedish / svenska',
         'te_IN': u'Telugu / తెలుగు',
         'tr_TR': u'Turkish / Türkçe',