35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
| for sOpt in lLineOpt:
sHTML += f' <p><input type="checkbox" id="option_{sOpt}" class="gc_option" data-option="{sOpt}"/><label id="option_label_{sOpt}" for="option_{sOpt}" data-l10n-id="option_{sOpt}">{dVars["dOptLabel"][sLang][sOpt][0]}</label></p>\n'
sHTML += '</div>\n'
return sHTML
def createFirefoxExtension (sLang, dVars):
"create extension for Firefox"
print("Building extension for Firefox")
helpers.createCleanFolder("_build/xpi/"+sLang)
dir_util.copy_tree("gc_lang/"+sLang+"/xpi/", "_build/xpi/"+sLang)
dir_util.copy_tree("grammalecte-js", "_build/xpi/"+sLang+"/grammalecte")
sHTML, dProperties = _createOptionsForFirefox(dVars)
dVars['optionsHTML'] = sHTML
helpers.copyAndFileTemplate("_build/xpi/"+sLang+"/data/about_panel.html", "_build/xpi/"+sLang+"/data/about_panel.html", dVars)
for sLocale in dProperties.keys():
spfLocale = "_build/xpi/"+sLang+"/locale/"+sLocale+".properties"
if os.path.exists(spfLocale):
helpers.copyAndFileTemplate(spfLocale, spfLocale, dProperties)
else:
print("Locale file not found: " + spfLocale)
with helpers.cd("_build/xpi/"+sLang):
os.system("jpm xpi")
def _createOptionsForFirefox (dVars):
sHTML = ""
for sSection, lOpt in dVars['lStructOpt']:
sHTML += '\n<div id="subsection_' + sSection + '" class="opt_subsection">\n <h2 data-l10n-id="option_'+sSection+'"></h2>\n'
for lLineOpt in lOpt:
for sOpt in lLineOpt:
sHTML += ' <p><input type="checkbox" id="option_'+sOpt+'" /><label id="option_label_'+sOpt+'" for="option_'+sOpt+'" data-l10n-id="option_'+sOpt+'"></label></p>\n'
sHTML += '</div>\n'
|
|
>
| 35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
| for sOpt in lLineOpt:
sHTML += f' <p><input type="checkbox" id="option_{sOpt}" class="gc_option" data-option="{sOpt}"/><label id="option_label_{sOpt}" for="option_{sOpt}" data-l10n-id="option_{sOpt}">{dVars["dOptLabel"][sLang][sOpt][0]}</label></p>\n'
sHTML += '</div>\n'
return sHTML
def createFirefoxExtension (sLang, dVars):
"create extension for Firefox (obsolete)"
print("Building extension for Firefox")
helpers.createCleanFolder("_build/xpi/"+sLang)
dir_util.copy_tree("gc_lang/"+sLang+"/xpi/", "_build/xpi/"+sLang)
dir_util.copy_tree("grammalecte-js", "_build/xpi/"+sLang+"/grammalecte")
sHTML, dProperties = _createOptionsForFirefox(dVars)
dVars['optionsHTML'] = sHTML
helpers.copyAndFileTemplate("_build/xpi/"+sLang+"/data/about_panel.html", "_build/xpi/"+sLang+"/data/about_panel.html", dVars)
for sLocale in dProperties.keys():
spfLocale = "_build/xpi/"+sLang+"/locale/"+sLocale+".properties"
if os.path.exists(spfLocale):
helpers.copyAndFileTemplate(spfLocale, spfLocale, dProperties)
else:
print("Locale file not found: " + spfLocale)
with helpers.cd("_build/xpi/"+sLang):
os.system("jpm xpi")
def _createOptionsForFirefox (dVars):
# obsolete
sHTML = ""
for sSection, lOpt in dVars['lStructOpt']:
sHTML += '\n<div id="subsection_' + sSection + '" class="opt_subsection">\n <h2 data-l10n-id="option_'+sSection+'"></h2>\n'
for lLineOpt in lOpt:
for sOpt in lLineOpt:
sHTML += ' <p><input type="checkbox" id="option_'+sOpt+'" /><label id="option_label_'+sOpt+'" for="option_'+sOpt+'" data-l10n-id="option_'+sOpt+'"></label></p>\n'
sHTML += '</div>\n'
|
110
111
112
113
114
115
116
117
118
119
120
| return dVars
def _copyGrammalecteJSPackageInZipFile (hZip, spLangPack, sDicName, 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(spLangPack):
if not os.path.isdir(spLangPack+"/"+sf):
hZip.write(spLangPack+"/"+sf, sAddPath+spLangPack+"/"+sf)
hZip.write("grammalecte-js/_dictionaries/"+sDicName, sAddPath+"grammalecte-js/_dictionaries/"+sDicName)
|
>
>
>
>
<
| 111
112
113
114
115
116
117
118
119
120
121
122
123
124
| return dVars
def _copyGrammalecteJSPackageInZipFile (hZip, spLangPack, sDicName, 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)
hZip.write("grammalecte-js/graphspell/_dictionaries/"+sDicName, sAddPath+"grammalecte-js/graphspell/_dictionaries/"+sDicName)
for sf in os.listdir(spLangPack):
if not os.path.isdir(spLangPack+"/"+sf):
hZip.write(spLangPack+"/"+sf, sAddPath+spLangPack+"/"+sf)
|