Updated language control files for Fennec, Firefox, SeaMonkey, and Thunderbird
This commit is contained in:
Родитель
86d06cfabc
Коммит
e46eedb07d
|
@ -8,3 +8,4 @@
|
|||
/validator/constants_local.py
|
||||
/src
|
||||
/extras/jslibs
|
||||
/extras/language_controls
|
||||
|
|
22
README.rst
22
README.rst
|
@ -440,9 +440,23 @@ Language Packs
|
|||
==============
|
||||
|
||||
With every version of every app that's released, the language pack references
|
||||
need to be updated. It is usually easiest to extract them from the OS X .app
|
||||
packages, though they can likely be obtained elsewhere.
|
||||
need to be updated.
|
||||
|
||||
These reference files need to be placed in the ``validator/testcases/langpacks``
|
||||
directory.
|
||||
We now have an automated tool to ease this tedious process. It is currently
|
||||
designed to work on OS X with the OS X versions of Mozilla applications, though
|
||||
it could conceivably run on any \*NIX platform against the OS X application
|
||||
packages.
|
||||
|
||||
To run the tool, first create a new directory: ``extras/language_controls/``
|
||||
|
||||
Put the ``.app`` packages for each updated product into this directory. Once
|
||||
this is ready, simply run: ::
|
||||
|
||||
cd extras
|
||||
python update_langpacks.py
|
||||
|
||||
That should be it. Note that this tool will fail horribly if any of the teams
|
||||
change the locations that the various language files are stored in.
|
||||
|
||||
Also note that this tool should only be run against the en-US versions of these
|
||||
applications.
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
import os
|
||||
from fnmatch import fnmatch
|
||||
from tempfile import NamedTemporaryFile
|
||||
from zipfile import ZipFile
|
||||
|
||||
|
||||
PACKAGE_MAPPINGS = {"Fennec.app": "fennec",
|
||||
"Firefox.app": "firefox",
|
||||
"SeaMonkey.app": "seamonkey",
|
||||
"Thunderbird.app": "thunderbird",}
|
||||
|
||||
|
||||
def copy_to_zip(read_zip, write_zip, pattern, prefix=""):
|
||||
for member in read_zip.namelist():
|
||||
if fnmatch(member, pattern):
|
||||
filename = member.split("/")[-1]
|
||||
write_zip.writestr("%s%s" % (prefix, filename),
|
||||
read_zip.read(member))
|
||||
|
||||
|
||||
def copy_to_new_zip(callback, read_zip, pattern, prefix=""):
|
||||
with NamedTemporaryFile("w") as temp:
|
||||
with ZipFile(temp.name, "w") as write_zip:
|
||||
copy_to_zip(read_zip, write_zip, pattern, prefix)
|
||||
|
||||
callback(temp.name)
|
||||
|
||||
|
||||
def main():
|
||||
for package in os.listdir("language_controls/"):
|
||||
if package.startswith(".") or package not in PACKAGE_MAPPINGS:
|
||||
continue
|
||||
|
||||
platform = PACKAGE_MAPPINGS[package]
|
||||
path = "language_controls/%s" % package
|
||||
jar = ZipFile("../validator/testcases/langpacks/%s.xpi" % platform, "w")
|
||||
|
||||
if platform == "firefox":
|
||||
# Firefox puts this stuff in omni.ja.
|
||||
with ZipFile("%s/Contents/MacOS/omni.ja" % path, "r") as omni_ja:
|
||||
#print list(x for x in omni_ja.namelist() if x.startswith("chrome/"))
|
||||
jar.writestr("chrome.manifest",
|
||||
omni_ja.read("chrome/localized.manifest"))
|
||||
|
||||
# Copy the chrome/en-US/ directory to /en-US.jar in the new zip.
|
||||
def callback(name):
|
||||
jar.write(name, "en-US.jar")
|
||||
copy_to_new_zip(callback, omni_ja, "chrome/en-US/*")
|
||||
|
||||
elif platform in ("thunderbird", "seamonkey", ):
|
||||
# Thunderbird puts stuff in omni.ja, too,
|
||||
with ZipFile("%s/Contents/MacOS/omni.ja" % path, "r") as omni_ja:
|
||||
jar.writestr("chrome.manifest",
|
||||
omni_ja.read("chrome/localized.manifest"))
|
||||
|
||||
# Copy the chrome/en-US/ directory to /en-US.jar in the new zip.
|
||||
def callback(name):
|
||||
jar.write(name, "en-US.jar")
|
||||
copy_to_new_zip(callback, omni_ja, "chrome/en-US/*")
|
||||
|
||||
else:
|
||||
jar.write("%s/Contents/MacOS/chrome/localized.manifest" % path,
|
||||
"chrome.manifest")
|
||||
jar.write("%s/Contents/MacOS/chrome/en-US.jar" % path,
|
||||
"en-US.jar")
|
||||
|
||||
jar.close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
Двоичные данные
validator/testcases/langpacks/fennec.xpi
Двоичные данные
validator/testcases/langpacks/fennec.xpi
Двоичный файл не отображается.
Двоичные данные
validator/testcases/langpacks/firefox.xpi
Двоичные данные
validator/testcases/langpacks/firefox.xpi
Двоичный файл не отображается.
Двоичные данные
validator/testcases/langpacks/seamonkey.xpi
Двоичные данные
validator/testcases/langpacks/seamonkey.xpi
Двоичный файл не отображается.
Двоичные данные
validator/testcases/langpacks/thunderbird.xpi
Двоичные данные
validator/testcases/langpacks/thunderbird.xpi
Двоичный файл не отображается.
Загрузка…
Ссылка в новой задаче