75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
| 75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
-
+
|
def createThunderbirdExtension (sLang, dVars, spLangPack):
"create extension for Thunderbird"
print("Building extension for Thunderbird")
sExtensionName = dVars['tb_identifier'] + "-v" + dVars['version'] + '.xpi'
spfZip = "_build/" + sExtensionName
hZip = zipfile.ZipFile(spfZip, mode='w', compression=zipfile.ZIP_DEFLATED)
_copyGrammalecteJSPackageInZipFile(hZip, spLangPack, dVars['dic_filename']+".json")
_copyGrammalecteJSPackageInZipFile(hZip, spLangPack)
for spf in ["LICENSE.txt", "LICENSE.fr.txt"]:
hZip.write(spf)
dVars = _createOptionsForThunderbird(dVars)
helpers.addFolderToZipAndFileFile(hZip, "gc_lang/"+sLang+"/tb", "", dVars, True)
spDict = "gc_lang/"+sLang+"/xpi/data/dictionaries"
for sp in os.listdir(spDict):
if os.path.isdir(spDict+"/"+sp):
|
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
| 106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
-
+
+
-
+
+
| dVars['sXULTabPanels'] += ' </tabpanel>\n'
# translation data
for sLang in dVars['dOptLabel'].keys():
dVars['gc_options_labels_'+sLang] = "\n".join( [ "<!ENTITY option.label." + sOpt + ' "' + dVars['dOptLabel'][sLang][sOpt][0] + '">' for sOpt in dVars['dOptLabel'][sLang] ] )
return dVars
def _copyGrammalecteJSPackageInZipFile (hZip, spLangPack, sDicName, sAddPath=""):
def _copyGrammalecteJSPackageInZipFile (hZip, spLangPack, sAddPath=""):
for sf in os.listdir("grammalecte-js"):
if not os.path.isdir("grammalecte-js/"+sf):
hZip.write("grammalecte-js/"+sf, sAddPath+"grammalecte-js/"+sf)
for sf in os.listdir("grammalecte-js/graphspell"):
if not os.path.isdir("grammalecte-js/graphspell/"+sf):
hZip.write("grammalecte-js/graphspell/"+sf, sAddPath+"grammalecte-js/graphspell/"+sf)
for sf in os.listdir("grammalecte-js/graphspell/_dictionaries"):
hZip.write("grammalecte-js/graphspell/_dictionaries/"+sDicName, sAddPath+"grammalecte-js/graphspell/_dictionaries/"+sDicName)
if not os.path.isdir("grammalecte-js/graphspell/_dictionaries/"+sf):
hZip.write("grammalecte-js/graphspell/_dictionaries/"+sf, sAddPath+"grammalecte-js/graphspell/_dictionaries/"+sf)
for sf in os.listdir(spLangPack):
if not os.path.isdir(spLangPack+"/"+sf):
hZip.write(spLangPack+"/"+sf, sAddPath+spLangPack+"/"+sf)
|