bug 525438, l10n-merge doesn't merge all files, make targets work with PRETTY_NAMES, too. Adding a l10n-checks target for a dummy repack. r=ted
This commit is contained in:
@@ -81,6 +81,9 @@ source-package::
|
||||
upload::
|
||||
@$(MAKE) -C browser/installer upload
|
||||
|
||||
l10n-check::
|
||||
@$(MAKE) -C browser/locales l10n-check
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
# Implemented in testing/testsuite-targets.mk
|
||||
|
||||
|
||||
@@ -77,6 +77,16 @@ DEFINES += \
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
ifdef LOCALE_MERGEDIR
|
||||
PPL_LOCALE_ARGS = \
|
||||
--l10n-dir=$(LOCALE_MERGEDIR)/browser/installer \
|
||||
--l10n-dir=$(call EXPAND_LOCALE_SRCDIR,browser/locales)/installer \
|
||||
--l10n-dir=$(topsrcdir)/browser/locales/en-US/installer \
|
||||
$(NULL)
|
||||
else
|
||||
PPL_LOCALE_ARGS=$(call EXPAND_LOCALE_SRCDIR,browser/locales)/installer
|
||||
endif
|
||||
|
||||
installer::
|
||||
$(MAKE) -C .. installer-stage
|
||||
$(MAKE) $(CONFIG_DIR)/setup.exe
|
||||
@@ -91,7 +101,7 @@ uninstaller::
|
||||
$(srcdir)/nsis/defines.nsi.in > $(CONFIG_DIR)/defines.nsi
|
||||
$(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py \
|
||||
--preprocess-locale $(topsrcdir) \
|
||||
$(call EXPAND_LOCALE_SRCDIR,browser/locales)/installer $(AB_CD) $(CONFIG_DIR)
|
||||
$(PPL_LOCALE_ARGS) $(AB_CD) $(CONFIG_DIR)
|
||||
|
||||
$(CONFIG_DIR)/setup.exe::
|
||||
$(RM) -rf $(CONFIG_DIR) && mkdir $(CONFIG_DIR)
|
||||
@@ -101,7 +111,7 @@ $(CONFIG_DIR)/setup.exe::
|
||||
$(srcdir)/nsis/defines.nsi.in > $(CONFIG_DIR)/defines.nsi
|
||||
$(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py \
|
||||
--preprocess-locale $(topsrcdir) \
|
||||
$(call EXPAND_LOCALE_SRCDIR,browser/locales)/installer $(AB_CD) $(CONFIG_DIR)
|
||||
$(PPL_LOCALE_ARGS) $(AB_CD) $(CONFIG_DIR)
|
||||
|
||||
GARBARGE_DIRS += instgen
|
||||
|
||||
|
||||
@@ -87,8 +87,7 @@ RETRIEVE_WINDOWS_INSTALLER = 1
|
||||
|
||||
MOZ_LANGPACK_EID=langpack-$(AB_CD)@firefox.mozilla.org
|
||||
|
||||
PREF_JS_EXPORTS = $(firstword $(wildcard $(LOCALE_SRCDIR)/firefox-l10n.js) \
|
||||
$(srcdir)/en-US/firefox-l10n.js )
|
||||
PREF_JS_EXPORTS = $(call MERGE_FILE,firefox-l10n.js)
|
||||
|
||||
ifneq (,$(filter cocoa,$(MOZ_WIDGET_TOOLKIT)))
|
||||
MOZ_PKG_MAC_DSSTORE=$(_ABS_DIST)/branding/dsstore
|
||||
@@ -126,9 +125,7 @@ install::
|
||||
$(LOCALE_SRCDIR)/existing-profile-defaults.js > $(DESTDIR)$(mozappdir)/defaults/existing-profile-defaults.js; \
|
||||
fi
|
||||
|
||||
README_FILES = \
|
||||
README.txt \
|
||||
$(NULL)
|
||||
README_FILE = $(call MERGE_FILE,README.txt)
|
||||
|
||||
PROFILE_FILES = \
|
||||
localstore.rdf \
|
||||
@@ -137,7 +134,7 @@ PROFILE_FILES = \
|
||||
|
||||
PROFILE_CHROME = userChrome-example.css userContent-example.css
|
||||
|
||||
libs:: $(addprefix $(LOCALE_SRCDIR)/,$(README_FILES))
|
||||
libs:: $(README_FILE)
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
$(EXIT_ON_ERROR) \
|
||||
for file in $^; do \
|
||||
@@ -164,7 +161,7 @@ libs:: $(FINAL_TARGET)/defaults/profile/bookmarks.html ;
|
||||
libs:: $(addprefix generic/profile/,$(PROFILE_FILES))
|
||||
$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/defaults/profile
|
||||
|
||||
libs:: $(addprefix $(LOCALE_SRCDIR)/profile/chrome/,$(PROFILE_CHROME))
|
||||
libs:: $(call MERGE_FILES,$(addprefix profile/chrome/,$(PROFILE_CHROME)))
|
||||
$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/defaults/profile/chrome
|
||||
|
||||
install:: $(DESTDIR)$(mozappdir)/defaults/profile/bookmarks.html ;
|
||||
@@ -172,10 +169,10 @@ install:: $(DESTDIR)$(mozappdir)/defaults/profile/bookmarks.html ;
|
||||
install:: $(addprefix generic/profile/,$(PROFILE_FILES))
|
||||
$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/defaults/profile
|
||||
|
||||
install:: $(addprefix $(LOCALE_SRCDIR)/profile/chrome/,$(PROFILE_CHROME))
|
||||
install:: $(call MERGE_FILES,$(addprefix profile/chrome/,$(PROFILE_CHROME)))
|
||||
$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/defaults/profile/chrome
|
||||
|
||||
SEARCH_PLUGINS = $(shell cat $(LOCALE_SRCDIR)/searchplugins/list.txt)
|
||||
SEARCH_PLUGINS = $(shell cat $(call MERGE_FILE,/searchplugins/list.txt))
|
||||
|
||||
libs:: $(addsuffix .xml,$(SEARCH_PLUGINS))
|
||||
$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/searchplugins
|
||||
@@ -193,31 +190,26 @@ libs-%:
|
||||
@$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1
|
||||
|
||||
|
||||
repackage-win32-installer: WIN32_INSTALLER_OUT="$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe"
|
||||
repackage-win32-installer: $(WIN32_INSTALLER_IN) $(SUBMAKEFILES)
|
||||
repackage-win32-installer: WIN32_INSTALLER_OUT=$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe
|
||||
repackage-win32-installer: $(call ESCAPE_SPACE,$(WIN32_INSTALLER_IN)) $(SUBMAKEFILES) libs-$(AB_CD)
|
||||
@echo "Repackaging $(WIN32_INSTALLER_IN) into $(WIN32_INSTALLER_OUT)."
|
||||
$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY) export
|
||||
$(MAKE) -C ../installer/windows CONFIG_DIR=l10ngen l10ngen/setup.exe l10ngen/7zSD.sfx
|
||||
$(MAKE) repackage-zip \
|
||||
AB_CD=$(AB_CD) \
|
||||
MOZ_PKG_FORMAT=SFX7Z \
|
||||
ZIP_IN=$(WIN32_INSTALLER_IN) \
|
||||
ZIP_OUT=$(WIN32_INSTALLER_OUT) \
|
||||
ZIP_IN="$(WIN32_INSTALLER_IN)" \
|
||||
ZIP_OUT="$(WIN32_INSTALLER_OUT)" \
|
||||
SFX_HEADER="$(PWD)/../installer/windows/l10ngen/7zSD.sfx \
|
||||
$(topsrcdir)/browser/installer/windows/app.tag"
|
||||
|
||||
ifeq (WINNT,$(OS_ARCH))
|
||||
repackage-win32-installer-%: $(WIN32_INSTALLER_IN) libs-%
|
||||
@$(MAKE) repackage-win32-installer AB_CD=$* WIN32_INSTALLER_IN=$(WIN32_INSTALLER_IN)
|
||||
repackage-win32-installer-%:
|
||||
@$(MAKE) repackage-win32-installer AB_CD=$* WIN32_INSTALLER_IN="$(WIN32_INSTALLER_IN)"
|
||||
else
|
||||
repackage-win32-installer-%: ;
|
||||
endif
|
||||
|
||||
ifneq (,$(filter cocoa,$(MOZ_WIDGET_TOOLKIT)))
|
||||
STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_APPNAME)/$(_APPNAME)/Contents/MacOS
|
||||
else
|
||||
STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)
|
||||
endif
|
||||
|
||||
clobber-zip:
|
||||
$(RM) $(STAGEDIST)/chrome/$(AB_CD).jar \
|
||||
@@ -239,7 +231,7 @@ installers-%: clobber-% langpack-% repackage-win32-installer-% repackage-zip-%
|
||||
@echo "repackaging done"
|
||||
|
||||
ifdef MOZ_UPDATER
|
||||
libs:: $(addprefix $(LOCALE_SRCDIR)/,updater/updater.ini)
|
||||
libs:: $(call MERGE_FILE,updater/updater.ini)
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
cat $< $(srcdir)/../installer/windows/nsis/updater_append.ini | \
|
||||
sed -e "s/^InfoText=/Info=/" -e "s/^TitleText=/Title=/" | \
|
||||
@@ -272,3 +264,11 @@ ifdef LOCALE_MERGEDIR
|
||||
MACOSX_DEPLOYMENT_TARGET= compare-locales -m $(LOCALE_MERGEDIR) $(srcdir)/l10n.ini $(L10NBASEDIR) $*
|
||||
endif
|
||||
@echo
|
||||
|
||||
# test target, depends on make package
|
||||
# try to repack x-test, with just toolkit/defines.inc being there
|
||||
l10n-check::
|
||||
$(RM) -rf x-test
|
||||
$(NSINSTALL) -D x-test/toolkit
|
||||
echo "#define MOZ_LANG_TITLE Just testing" > x-test/toolkit/defines.inc
|
||||
$(MAKE) installers-x-test L10NBASEDIR="$(PWD)" LOCALE_MERGEDIR="$(PWD)/mergedir"
|
||||
|
||||
@@ -793,6 +793,16 @@ MAKE_JARS_FLAGS += -c $(topsrcdir)/$(relativesrcdir)/en-US
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef LOCALE_MERGEDIR
|
||||
MERGE_FILE = $(firstword \
|
||||
$(wildcard $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))/$(1)) \
|
||||
$(wildcard $(LOCALE_SRCDIR)/$(1)) \
|
||||
$(srcdir)/en-US/$(1) )
|
||||
else
|
||||
MERGE_FILE = $(LOCALE_SRCDIR)/$(1)
|
||||
endif
|
||||
MERGE_FILES = $(foreach f,$(1),$(call MERGE_FILE,$(f)))
|
||||
|
||||
ifdef WINCE
|
||||
RUN_TEST_PROGRAM = $(PYTHON) $(topsrcdir)/build/mobile/devicemanager-run-test.py
|
||||
else
|
||||
|
||||
@@ -793,6 +793,16 @@ MAKE_JARS_FLAGS += -c $(topsrcdir)/$(relativesrcdir)/en-US
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef LOCALE_MERGEDIR
|
||||
MERGE_FILE = $(firstword \
|
||||
$(wildcard $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))/$(1)) \
|
||||
$(wildcard $(LOCALE_SRCDIR)/$(1)) \
|
||||
$(srcdir)/en-US/$(1) )
|
||||
else
|
||||
MERGE_FILE = $(LOCALE_SRCDIR)/$(1)
|
||||
endif
|
||||
MERGE_FILES = $(foreach f,$(1),$(call MERGE_FILE,$(f)))
|
||||
|
||||
ifdef WINCE
|
||||
RUN_TEST_PROGRAM = $(PYTHON) $(topsrcdir)/build/mobile/devicemanager-run-test.py
|
||||
else
|
||||
|
||||
@@ -102,14 +102,14 @@ include $(MOZILLA_DIR)/toolkit/mozapps/installer/packager.mk
|
||||
|
||||
|
||||
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||
STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_APPNAME)/$(_APPNAME)/Contents/MacOS
|
||||
STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)/$(_APPNAME)/Contents/MacOS
|
||||
else
|
||||
STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)
|
||||
endif
|
||||
|
||||
$(STAGEDIST): AB_CD:=en-US
|
||||
$(STAGEDIST): UNPACKAGE=$(ZIP_IN)
|
||||
$(STAGEDIST): $(ZIP_IN)
|
||||
$(STAGEDIST): UNPACKAGE=$(call ESCAPE_SPACE,$(ZIP_IN))
|
||||
$(STAGEDIST): $(call ESCAPE_SPACE,$(ZIP_IN))
|
||||
# only mac needs to remove the parent of STAGEDIST...
|
||||
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||
$(RM) -r -v $(DIST)/l10n-stage
|
||||
@@ -131,7 +131,7 @@ unpack: $(STAGEDIST)
|
||||
MOZDEPTH ?= $(DEPTH)
|
||||
|
||||
repackage-zip: UNPACKAGE="$(ZIP_IN)"
|
||||
repackage-zip:
|
||||
repackage-zip: libs-$(AB_CD)
|
||||
# Adjust jar logs with the new locale (can't use sed -i because of bug 373784)
|
||||
-$(PERL) -pi -e "s/en-US/$(AB_CD)/g" $(_ABS_DIST)/jarlog/*.jar.log
|
||||
# call a hook for apps to put their uninstall helper.exe into the package
|
||||
@@ -143,7 +143,7 @@ repackage-zip:
|
||||
mv $(STAGEDIST)/chrome/$(AB_CD).manifest $(STAGEDIST)/chrome/localized.manifest
|
||||
ifneq (en,$(AB))
|
||||
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||
mv $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_APPNAME)/$(_APPNAME)/Contents/Resources/en.lproj $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_APPNAME)/$(_APPNAME)/Contents/Resources/$(AB).lproj
|
||||
mv $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)/$(_APPNAME)/Contents/Resources/en.lproj $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)/$(_APPNAME)/Contents/Resources/$(AB).lproj
|
||||
endif
|
||||
endif
|
||||
$(NSINSTALL) -D $(DIST)/l10n-stage/$(PKG_PATH)
|
||||
@@ -162,7 +162,7 @@ endif
|
||||
# packaging done, undo l10n stuff
|
||||
ifneq (en,$(AB))
|
||||
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||
mv $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_APPNAME)/$(_APPNAME)/Contents/Resources/$(AB).lproj $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_APPNAME)/$(_APPNAME)/Contents/Resources/en.lproj
|
||||
mv $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)/$(_APPNAME)/Contents/Resources/$(AB).lproj $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)/$(_APPNAME)/Contents/Resources/en.lproj
|
||||
endif
|
||||
endif
|
||||
ifdef MOZ_OMNIJAR
|
||||
@@ -175,8 +175,8 @@ ifeq (WINCE,$(OS_ARCH))
|
||||
mv -f "$(DIST)/l10n-stage/$(PKG_BASENAME).cab" "$(DIST)/$(PKG_PATH)$(PKG_BASENAME).cab"
|
||||
endif
|
||||
|
||||
repackage-zip-%: $(ZIP_IN) $(STAGEDIST) libs-%
|
||||
@$(MAKE) repackage-zip AB_CD=$* ZIP_IN=$(ZIP_IN)
|
||||
repackage-zip-%: $(STAGEDIST)
|
||||
@$(MAKE) repackage-zip AB_CD=$* ZIP_IN="$(ZIP_IN)"
|
||||
|
||||
APP_DEFINES = $(firstword $(wildcard $(LOCALE_SRCDIR)/defines.inc) \
|
||||
$(srcdir)/en-US/defines.inc)
|
||||
@@ -207,8 +207,9 @@ wget-en-US:
|
||||
ifndef WGET
|
||||
$(error Wget not installed)
|
||||
endif
|
||||
(cd $(_ABS_DIST) && $(WGET) -nv -N $(EN_US_BINARY_URL)/$(PACKAGE))
|
||||
@echo "Downloaded $(EN_US_BINARY_URL)/$(PACKAGE) to $(_ABS_DIST)/$(PACKAGE)"
|
||||
$(NSINSTALL) -D $(_ABS_DIST)/$(PKG_PATH)
|
||||
(cd $(_ABS_DIST)/$(PKG_PATH) && $(WGET) -nv -N "$(EN_US_BINARY_URL)/$(PACKAGE)")
|
||||
@echo "Downloaded $(EN_US_BINARY_URL)/$(PACKAGE) to $(_ABS_DIST)/$(PKG_PATH)/$(PACKAGE)"
|
||||
ifdef RETRIEVE_WINDOWS_INSTALLER
|
||||
ifeq ($(OS_ARCH), WINNT)
|
||||
$(NSINSTALL) -D $(_ABS_DIST)/$(PKG_INST_PATH)
|
||||
|
||||
@@ -683,6 +683,7 @@ endif
|
||||
empty :=
|
||||
space = $(empty) $(empty)
|
||||
QUOTED_WILDCARD = $(if $(wildcard $(subst $(space),?,$(1))),"$(1)")
|
||||
ESCAPE_SPACE = $(subst $(space),\$(space),$(1))
|
||||
|
||||
# This variable defines which OpenSSL algorithm to use to
|
||||
# generate checksums for files that we upload
|
||||
|
||||
@@ -12,56 +12,9 @@
|
||||
# --convert-utf8-utf16le.
|
||||
|
||||
from codecs import BOM_UTF16_LE
|
||||
from os.path import join
|
||||
from os.path import join, isfile
|
||||
import sys
|
||||
|
||||
def preprocess_locale(argv):
|
||||
"""
|
||||
Validates command line arguments and displays usage if necessary
|
||||
"""
|
||||
if len(argv) < 1 or (argv[0] != '--convert-utf8-utf16le' and argv[0] != '--preprocess-locale'):
|
||||
sys.stderr.write("""
|
||||
preprocess-locale.py
|
||||
|
||||
Commands:
|
||||
--convert-utf8-utf16le - preprocesses installer locale properties files and
|
||||
creates a basic NSIS nlf file
|
||||
--preprocess-locale - converts a UTF-8 file to a new UTF-16LE file
|
||||
|
||||
use "preprocess-locale.py <command>" to see the usage for each command
|
||||
""")
|
||||
sys.exit(1)
|
||||
|
||||
if argv[0] == '--convert-utf8-utf16le':
|
||||
if len(argv) != 3:
|
||||
sys.stderr.write("""
|
||||
Converts a UTF-8 file to UTF-16LE
|
||||
|
||||
Usage: preprocess-locale.py --convert-utf8-utf16le <src> <dest>
|
||||
|
||||
Arguments:
|
||||
<src> \tthe path to the UTF-8 source file to convert
|
||||
<dest>\tthe path to the UTF-16LE destination file to create
|
||||
""")
|
||||
sys.exit(1)
|
||||
convert_utf8_utf16le(argv[1], argv[2])
|
||||
|
||||
if argv[0] == '--preprocess-locale':
|
||||
if len(argv) != 5:
|
||||
sys.stderr.write("""
|
||||
Preprocesses the installer localized properties files into the format
|
||||
required by NSIS and creates a basic NSIS nlf file.
|
||||
|
||||
Usage: preprocess-locale.py --preprocess-locale <src> <locale> <code> <dest>
|
||||
|
||||
Arguments:
|
||||
<src> \tthe path to top source directory for the toolkit source
|
||||
<locale>\tthe path to the installer's locale files
|
||||
<code> \tthe locale code
|
||||
<dest> \tthe path to the destination directory
|
||||
""")
|
||||
sys.exit(1)
|
||||
preprocess_locale_files(argv[1], argv[2], argv[3], argv[4])
|
||||
from optparse import OptionParser
|
||||
|
||||
def open_utf16le_file(path):
|
||||
"""
|
||||
@@ -108,16 +61,22 @@ def get_locale_strings(path, prefix, middle, add_cr):
|
||||
fp.close()
|
||||
return output
|
||||
|
||||
def preprocess_locale_files(moz_dir, locale_dir, ab_cd, config_dir):
|
||||
def lookup(path, l10ndirs):
|
||||
for d in l10ndirs:
|
||||
if isfile(join(d, path)):
|
||||
return join(d, path)
|
||||
return join(l10ndirs[-1], path)
|
||||
|
||||
def preprocess_locale_files(moz_dir, ab_cd, config_dir, l10ndirs):
|
||||
"""
|
||||
Preprocesses the installer localized properties files into the format
|
||||
required by NSIS and creates a basic NSIS nlf file.
|
||||
|
||||
Parameters:
|
||||
moz_dir - the path to top source directory for the toolkit source
|
||||
locale_dir - the path to the installer's locale files
|
||||
ab_cd - the locale code
|
||||
config_dir - the path to the destination directory
|
||||
l10ndirs - list of paths to search for installer locale files
|
||||
"""
|
||||
|
||||
# Set the language ID to 0 to make this locale the default locale. An
|
||||
@@ -157,7 +116,7 @@ NLF v6
|
||||
|
||||
# Create the main NSIS language file
|
||||
fp = open_utf16le_file(join(config_dir, "overrideLocale.nsh"))
|
||||
locale_strings = get_locale_strings(join(locale_dir, "override.properties"),
|
||||
locale_strings = get_locale_strings(lookup("override.properties", l10ndirs),
|
||||
"LangString ^", " " + lang_id + " ", False)
|
||||
fp.write(unicode(locale_strings, "utf-8").encode("utf-16-le"))
|
||||
fp.close()
|
||||
@@ -170,7 +129,7 @@ NLF v6
|
||||
!insertmacro MOZ_MUI_LANGUAGEFILE_BEGIN \"baseLocale\"
|
||||
!define MUI_LANGNAME \"baseLocale\"
|
||||
""" % (lang_id)).encode("utf-16-le"))
|
||||
locale_strings = get_locale_strings(join(locale_dir, "mui.properties"),
|
||||
locale_strings = get_locale_strings(lookup("mui.properties", l10ndirs),
|
||||
"!define ", " ", True)
|
||||
fp.write(unicode(locale_strings, "utf-8").encode("utf-16-le"))
|
||||
fp.write(u"!insertmacro MOZ_MUI_LANGUAGEFILE_END\n".encode("utf-16-le"))
|
||||
@@ -178,7 +137,7 @@ NLF v6
|
||||
|
||||
# Create the custom language file for our custom strings
|
||||
fp = open_utf16le_file(join(config_dir, "customLocale.nsh"))
|
||||
locale_strings = get_locale_strings(join(locale_dir, "custom.properties"),
|
||||
locale_strings = get_locale_strings(lookup("custom.properties", l10ndirs),
|
||||
"LangString ", " " + lang_id + " ", True)
|
||||
fp.write(unicode(locale_strings, "utf-8").encode("utf-16-le"))
|
||||
fp.close()
|
||||
@@ -198,4 +157,60 @@ def convert_utf8_utf16le(in_file_path, out_file_path):
|
||||
out_fp.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(preprocess_locale(sys.argv[1:]))
|
||||
usage = """usage: %prog command <args>
|
||||
|
||||
Commands:
|
||||
--convert-utf8-utf16le - preprocesses installer locale properties files and
|
||||
creates a basic NSIS nlf file
|
||||
--preprocess-locale - Preprocesses the installer localized properties files
|
||||
into the format required by NSIS and creates a basic
|
||||
NSIS nlf file.
|
||||
|
||||
preprocess-locale.py --preprocess-locale <src> <locale> <code> <dest>
|
||||
|
||||
Arguments:
|
||||
<src> \tthe path to top source directory for the toolkit source
|
||||
<locale>\tthe path to the installer's locale files
|
||||
<code> \tthe locale code
|
||||
<dest> \tthe path to the destination directory
|
||||
|
||||
|
||||
preprocess-locale.py --convert-utf8-utf16le <src> <dest>
|
||||
|
||||
Arguments:
|
||||
<src> \tthe path to the UTF-8 source file to convert
|
||||
<dest>\tthe path to the UTF-16LE destination file to create
|
||||
"""
|
||||
p = OptionParser(usage=usage)
|
||||
p.add_option("--preprocess-locale", action="store_true", default=False,
|
||||
dest='preprocess')
|
||||
p.add_option("--l10n-dir", action="append", default=[],
|
||||
dest="l10n_dirs",
|
||||
help="Add directory to lookup for locale files")
|
||||
p.add_option("--convert-utf8-utf16le", action="store_true", default=False,
|
||||
dest='convert')
|
||||
|
||||
options, args = p.parse_args()
|
||||
|
||||
if ((not (options.preprocess or options.convert)) or
|
||||
(options.preprocess and options.convert)):
|
||||
p.error("You need to specify either --preprocess-locale or --convert-utf-utf16le")
|
||||
|
||||
if options.preprocess:
|
||||
if len(args) not in (3,4):
|
||||
p.error("--preprocess-locale needs all of <src> <locale> <code> <dest>")
|
||||
pargs = args[:]
|
||||
if len(args) == 4:
|
||||
l10n_dirs = [args[1]]
|
||||
del pargs[1]
|
||||
else:
|
||||
if not options.l10n_dirs:
|
||||
p.error("--preprocess-locale needs either <locale> or --l10ndir")
|
||||
l10n_dirs = options.l10n_dirs
|
||||
|
||||
pargs.append(l10n_dirs)
|
||||
preprocess_locale_files(*pargs)
|
||||
else:
|
||||
if len(args) != 2:
|
||||
p.error("--convert-utf8-utf16le needs both of <src> <dest>")
|
||||
convert_utf8_utf16le(*args)
|
||||
|
||||
Reference in New Issue
Block a user