Imported Upstream version 2.11~beta2+ds
[debian/jabref.git] / syncLang.py
index ad835403d3f64396a74378d1b4616b7c7f44d83b..5619e293d2f287f8bf700e3c004040a79330661f 100644 (file)
@@ -291,7 +291,7 @@ def lookForDuplicates(file, displayKeys):
 ############# Main part ###################
 
 if len(sys.argv) == 1:
-    print """This program must be run from the "src" directory right below the jabref base directory.
+    print """This program must be run from the jabref base directory.
     
 Usage: syncLang.py option   
 Option can be one of the following:
@@ -329,46 +329,25 @@ elif (len(sys.argv) >= 2) and (sys.argv[1] == "-s"):
         update = 1
     else:
         update = 0
-    findNewKeysInJavaCode("resource/JabRef_en.properties", ".", update)
+    findNewKeysInJavaCode("src/main/resources/resource/JabRef_en.properties", ".", update)
     
 elif (len(sys.argv) >= 2) and (sys.argv[1] == "-t"):
     if (len(sys.argv) >= 3) and (sys.argv[2] == "-u"):
         changeFiles = 1
     else:
         changeFiles = 0
-        
-    handleFileSet("resource/JabRef_en.properties", ("resource/JabRef_de.properties",\
-        "resource/JabRef_fr.properties", "resource/JabRef_it.properties",\
-        "resource/JabRef_ja.properties", "resource/JabRef_pt_BR.properties",\
-        "resource/JabRef_nl.properties", "resource/JabRef_da.properties",\
-        "resource/JabRef_no.properties", "resource/JabRef_tr.properties",\
-        "resource/JabRef_vi.properties", "resource/JabRef_in.properties", \
-        "resource/JabRef_zh.properties"), changeFiles)
-    handleFileSet("resource/Menu_en.properties", ("resource/Menu_de.properties",\
-        "resource/Menu_fr.properties", "resource/Menu_it.properties",\
-        "resource/Menu_ja.properties", "resource/Menu_pt_BR.properties",\
-        "resource/Menu_nl.properties", "resource/Menu_da.properties",\
-        "resource/Menu_es.properties",\
-        "resource/Menu_no.properties", "resource/Menu_tr.properties",\
-        "resource/Menu_vi.properties", "resource/Menu_in.properties",\
-        "resource/Menu_zh.properties"), changeFiles)
-        
+
+    filesJabRef = filter(lambda s: (s.startswith('JabRef_') and not (s.startswith('JabRef_en'))), os.listdir("src/main/resources/resource"));
+    filesJabRef = ["src/main/resources/resource/" + i for i in filesJabRef];
+    filesMenu = filter(lambda s: (s.startswith('Menu_') and not (s.startswith('Menu_en'))), os.listdir("src/main/resources/resource"));
+    filesMenu = ["src/main/resources/resource/" + i for i in filesMenu];
+
+    handleFileSet("src/main/resources/resource/JabRef_en.properties", filesJabRef, changeFiles)
+    handleFileSet("src/main/resources/resource/Menu_en.properties", filesMenu, changeFiles)
+
 elif (len(sys.argv) >= 2) and ((sys.argv[1] == "-d") or (sys.argv[1] == "-c")):
-    files = ("resource/JabRef_en.properties", "resource/JabRef_de.properties",\
-        "resource/JabRef_fr.properties", "resource/JabRef_it.properties",\
-        "resource/JabRef_ja.properties", "resource/JabRef_pt_BR.properties",\
-        "resource/JabRef_no.properties", "resource/JabRef_nl.properties",\
-        "resource/JabRef_da.properties",\
-        "resource/JabRef_tr.properties",\
-        "resource/JabRef_vi.properties", "resource/JabRef_in.properties",\
-        "resource/JabRef_zh.properties",\
-        "resource/Menu_en.properties", "resource/Menu_de.properties",\
-        "resource/Menu_fr.properties", "resource/Menu_it.properties",\
-        "resource/Menu_ja.properties", "resource/Menu_pt_BR.properties",\
-        "resource/Menu_no.properties", "resource/Menu_nl.properties",\
-        "resource/Menu_da.properties", "resource/Menu_es.properties", \
-        "resource/Menu_tr.properties",\
-        "resource/Menu_vi.properties", "resource/Menu_in.properties",\
-        "resource/Menu_zh.properties")
+    files = filter(lambda s: (s.startswith('JabRef_') and not (s.startswith('JabRef_en'))), os.listdir("src/main/resources/resource"));
+    files.extend(filter(lambda s: (s.startswith('Menu_') and not (s.startswith('Menu_en'))), os.listdir("src/main/resources/resource")));
+    files = ["src/main/resources/resource/" + i for i in files];
     for file in files:
         lookForDuplicates(file, sys.argv[1] == "-d")