firefox-multilocale-chrome.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Sat, 18 Jul 2015 15:01:59 +0200
branchfirefox40
changeset 868 284da266ec46
parent 837 a1f740acf68e
permissions -rw-r--r--
40beta rebase

# HG changeset patch
# Parent 16846914f968944f991c8b12fdc38ce8fc099d73
# User Wolfgang Rosenauer <wr@rosenauer.org>
# Parent  adcf975f1f5a796da0b1926a67beba003fd08b6b
Add searchplugins to chrome packaging for proper localization

diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -389,16 +389,20 @@ pref("browser.search.searchEnginesURL", 
 
 // Tell the search service to load search plugins from the locale JAR
 pref("browser.search.loadFromJars", true);
 pref("browser.search.jarURIs", "chrome://browser/locale/searchplugins/");
 
 // pointer to the default engine name
 pref("browser.search.defaultenginename",      "chrome://browser-region/locale/region.properties");
 
+// Tell the search service to load search plugins from the locale JAR
+pref("browser.search.loadFromJars", true);
+pref("browser.search.jarURIs", "chrome://browser/locale/searchplugins/");
+
 // Ordering of Search Engines in the Engine list. 
 pref("browser.search.order.1",                "chrome://browser-region/locale/region.properties");
 pref("browser.search.order.2",                "chrome://browser-region/locale/region.properties");
 pref("browser.search.order.3",                "chrome://browser-region/locale/region.properties");
 
 // Market-specific search defaults (US market only)
 pref("browser.search.geoSpecificDefaults", true);
 pref("browser.search.defaultenginename.US",      "data:text/plain,browser.search.defaultenginename.US=Yahoo");
diff --git a/browser/locales/Makefile.in b/browser/locales/Makefile.in
--- a/browser/locales/Makefile.in
+++ b/browser/locales/Makefile.in
@@ -63,24 +63,27 @@ UNINSTALLER_PACKAGE_HOOK = $(RM) -r $(ST
 
 STUB_HOOK = $(NSINSTALL) -D '$(_ABS_DIST)/$(PKG_INST_PATH)'; \
     $(RM) '$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe'; \
     cp ../installer/windows/l10ngen/stub.exe '$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe'; \
     chmod 0755 '$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe'; \
     $(NULL)
 endif
 
-SEARCHPLUGINS_NAMES = $(shell cat $(call MERGE_FILE,/searchplugins/list.txt)) ddg
+SEARCHPLUGINS_NAMES = $(shell cat \
+    $(firstword $(wildcard $(LOCALE_SRCDIR)/searchplugins/list.txt) \
+    @srcdir@/en-US/searchplugins/list.txt ) ) ddg
 SEARCHPLUGINS_PATH := .deps/generated_$(AB_CD)
 SEARCHPLUGINS_TARGET := libs searchplugins
-SEARCHPLUGINS := $(foreach plugin,$(addsuffix .xml,$(SEARCHPLUGINS_NAMES)),$(or $(wildcard $(call EN_US_OR_L10N_FILE,searchplugins/$(plugin))),$(info Missing searchplugin: $(plugin))))
+#SEARCHPLUGINS := $(foreach plugin,$(addsuffix .xml,$(SEARCHPLUGINS_NAMES)),$(or $(wildcard $(call EN_US_OR_L10N_FILE,searchplugins/$(plugin))),$(info Missing searchplugin: $(plugin))))
+SEARCHPLUGINS := $(addsuffix .xml,$(SEARCHPLUGINS_NAMES))
 # Some locale-specific search plugins may have preprocessor directives, but the
 # default en-US ones do not.
 SEARCHPLUGINS_FLAGS := --silence-missing-directive-warnings
-PP_TARGETS += SEARCHPLUGINS
+#PP_TARGETS += SEARCHPLUGINS
 
 list-txt = $(SEARCHPLUGINS_PATH)/list.txt
 GARBAGE += $(list-txt)
 
 libs:: searchplugins
 
 # Required for l10n.mk - defines a list of app sub dirs that should
 # be included in langpack xpis.
@@ -119,16 +122,39 @@ NO_JA_JP_MAC_AB_CD := $(if $(filter ja-J
 libs:: $(FINAL_TARGET)/defaults/profile/bookmarks.html ;
 
 libs:: $(addprefix generic/profile/,$(PROFILE_FILES))
 	$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/defaults/profile
 
 libs:: $(call MERGE_FILES,$(addprefix profile/chrome/,$(PROFILE_CHROME)))
 	$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/defaults/profile/chrome
 
+tmp-search.jar.mn::
+	printf "$(AB_CD).jar:" > $@
+	printf "$(foreach plugin,$(SEARCHPLUGINS), \n locale/browser/searchplugins/$(plugin) ($(plugin)))" >> $@
+	@echo >> $@
+
+searchplugins-jar:: $(SEARCHPLUGINS)
+	for SEARCHPLUGIN in $^; do \
+	$(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) \
+	$$SEARCHPLUGIN > $$SEARCHPLUGIN-new) ; \
+	mv $$SEARCHPLUGIN-new $$SEARCHPLUGIN ; \
+	done
+
+searchplugins-jar:: tmp-search.jar.mn
+	$(call py_action,jar_maker,\
+	$(QUIET) -j $(FINAL_TARGET)/chrome \
+	-s $(topsrcdir)/$(relativesrcdir)/en-US/searchplugins \
+	-s $(LOCALE_SRCDIR)/searchplugins \
+	$(MAKE_JARS_FLAGS) tmp-search.jar.mn)
+
+libs:: searchplugins-jar
+
+GARBAGE += tmp-search.jar.mn
+
 libs-%:
 	$(NSINSTALL) -D $(DIST)/install
 	@$(MAKE) -C ../../toolkit/locales libs-$*
 	@$(MAKE) -C ../../services/sync/locales AB_CD=$* XPI_NAME=locale-$*
 ifdef MOZ_WEBAPP_RUNTIME
 	@$(MAKE) -C ../../webapprt/locales AB_CD=$* XPI_NAME=locale-$*
 endif
 	@$(MAKE) -C ../../extensions/spellcheck/locales AB_CD=$* XPI_NAME=locale-$*
diff --git a/browser/locales/jar.mn b/browser/locales/jar.mn
--- a/browser/locales/jar.mn
+++ b/browser/locales/jar.mn
@@ -152,14 +152,15 @@
     locale/browser/searchplugins/list.txt       (.deps/generated_@AB_CD@/list.txt)
     locale/browser/searchplugins/               (.deps/generated_@AB_CD@/*.xml)
 % locale browser-region @AB_CD@ %locale/browser-region/
     locale/browser-region/region.properties        (%chrome/browser-region/region.properties)
 # the following files are browser-specific overrides
     locale/browser/netError.dtd                (%chrome/overrides/netError.dtd)
     locale/browser/appstrings.properties       (%chrome/overrides/appstrings.properties)
     locale/browser/downloads/settingsChange.dtd  (%chrome/overrides/settingsChange.dtd)
+    locale/browser/searchplugins/list.txt      (%searchplugins/list.txt)
 % override chrome://global/locale/netError.dtd chrome://browser/locale/netError.dtd
 % override chrome://global/locale/appstrings.properties chrome://browser/locale/appstrings.properties
 % override chrome://mozapps/locale/downloads/settingsChange.dtd chrome://browser/locale/downloads/settingsChange.dtd
 % locale pdf.js @AB_CD@ %locale/pdfviewer/
     locale/pdfviewer/viewer.properties             (%pdfviewer/viewer.properties)
     locale/pdfviewer/chrome.properties             (%pdfviewer/chrome.properties)