firefox-multilocale-chrome.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Wed, 26 Jun 2013 10:30:29 +0200
branchfirefox22
changeset 656 1f947ce4bf72
parent 650 e8c83b144fd1
child 653 38c67b6b2f37
permissions -rw-r--r--
changelog

# HG changeset patch
# Parent cd1ec2efff2b6c41550ce2b5b9b8ba8182eb9836
# User Wolfgang Rosenauer <wr@rosenauer.org>
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
@@ -342,16 +342,20 @@ pref("browser.download.panel.shown", fal
 pref("browser.download.panel.firstSessionCompleted", false);
 
 // search engines URL
 pref("browser.search.searchEnginesURL",      "https://addons.mozilla.org/%LOCALE%/firefox/search-engines/");
 
 // 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/");
+
 // disable logging for the search service by default
 pref("browser.search.log", false);
 
 // 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");
 
diff --git a/browser/locales/Makefile.in b/browser/locales/Makefile.in
--- a/browser/locales/Makefile.in
+++ b/browser/locales/Makefile.in
@@ -71,20 +71,22 @@ 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))
+SEARCHPLUGINS_NAMES = $(shell cat \
+	$(firstword $(wildcard $(LOCALE_SRCDIR)/searchplugins/list.txt) \
+	@srcdir@/en-US/searchplugins/list.txt ) )
 SEARCHPLUGINS_PATH := $(FINAL_TARGET)/searchplugins
 SEARCHPLUGINS := $(addsuffix .xml,$(SEARCHPLUGINS_NAMES))
-PP_TARGETS += SEARCHPLUGINS
+#PP_TARGETS += SEARCHPLUGINS
 
 # Required for l10n.mk - defines a list of app sub dirs that should
 # be included in langpack xpis.
 ifdef MOZ_METRO
 # metro build, include both app folders
 DIST_SUBDIRS = browser metro
 else
 DIST_SUBDIRS = $(DIST_SUBDIR)
@@ -142,20 +144,44 @@ install:: $(addprefix generic/profile/,$
 
 install:: $(call MERGE_FILES,$(addprefix profile/chrome/,$(PROFILE_CHROME)))
 	$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/defaults/profile/chrome
 
 # metro build calls back here for search engine plugins
 searchplugins: $(addprefix $(FINAL_TARGET)/searchplugins/,$(SEARCHPLUGINS))
 .PHONY: searchplugins
 
+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 \
+	  $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) \
+	  $$SEARCHPLUGIN > $$SEARCHPLUGIN-new ; \
+	  mv $$SEARCHPLUGIN-new $$SEARCHPLUGIN ; \
+	done
+
+searchplugins-jar:: tmp-search.jar.mn
+	$(PYTHON) $(MOZILLA_DIR)/config/JarMaker.py \
+	  $(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-$*
+	@$(MAKE) -B searchplugins-jar AB_CD=$* XPI_NAME=locale-$*
 	@$(MAKE) -C ../../extensions/spellcheck/locales AB_CD=$* XPI_NAME=locale-$*
 	@$(MAKE) -C ../../intl/locales AB_CD=$* XPI_NAME=locale-$*
 	@$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=$(PREF_DIR)
 ifdef MOZ_METRO
 	@$(MAKE) -C ../metro/locales AB_CD=$* XPI_NAME=locale-$*
 endif
 	@$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales AB_CD=$* XPI_NAME=locale-$*
 
diff --git a/browser/locales/en-US/searchplugins/google.xml b/browser/locales/en-US/searchplugins/google.xml
--- a/browser/locales/en-US/searchplugins/google.xml
+++ b/browser/locales/en-US/searchplugins/google.xml
@@ -9,24 +9,16 @@
 <Image width="16" height="16">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACuUlEQVRYw8VX60sUURSffybWv6MloxeV0Jug+hJB0YMoCCII1E3LnlYKlVkkUZKaRFEGFlgfMntYhlopVpaP1HXuPPbOzOmcOw/XZbed3ZndvXBYlr17zu+8fudcaWmlLKEsQWlFmUOBAsucY4tsSmQ8gjJTBMOpQjYjkoMGSiStUpHCnknmpXz+uLdJgY5eDsN/TJA1C9KdkUkTjraoWXXlBGDNaQZd/VwoP3xHhbVnGOxvVuHLL1MY5QZArEODbfUMllX70+kbACl8N2qAxgE2XmCLfltZI8O3CRtEXLVg00Xm2ynfAOoeacLA2+9G2t8P3lK98Lf3JsIH8OmH7eEzTEGmO6NT9p3JuBU+ADUB/40ASdsb+5KiFxAAw6pfHkt/p/G5Lu6MTZvhAyDP3VPdrqW90/zSRnmjWw8fwLG7C0VGOV5/dnGll2OXfEVeoFpZcUoOHwBJ0wvdA0FtdwS5YF0dg93XFHg1ZMDrYQNW17KcSC1nJtx3U4XH77nwdui3CaZDhAM/TSiP5c6qUhAu33qJeRFp6UnkpSMQgC1JAKZlC3Y1KsUFQEJ5dw/1/8kHWuEARKtk2HNdgctPdTENewYN0fPJxypUG1Zh74/PWsDQS2K8E/c12NmgQMU5BhXYksT/yaehSw8PgEuxn7HSUydhKkjuZIQ+N5xnwQEcv2cTkIGR3uxjzNY81LwoVLZpwQF0D3ChjCad33RRqujQchIYgDuG/2KbRX0CcDckP22ZFUBnH/dCWtuZ3SMqygTmv3/MCKcIt19RvFHMTbu6M1Eu7Yh9IwbMMEt0SGhdcOi2ClPzC9vvLBp48oELMLSq1SMv0HfakD+i5zuuKuHzwCqccmSMph6NY1pOqdWoNgbHTcEDB3AvjOZBxSV/mJT8aVZWwsdpmeQ8zyNOJOJFMBx3bJFN6R++on7RvMlpZAAAAABJRU5ErkJggg==</Image>
 <Url type="application/x-suggestions+json" method="GET" template="https://www.google.com/complete/search?client=firefox&amp;q={searchTerms}"/>
 <Url type="text/html" method="GET" template="https://www.google.com/search">
   <Param name="q" value="{searchTerms}"/>
   <Param name="ie" value="utf-8"/>
   <Param name="oe" value="utf-8"/>
   <Param name="aq" value="t"/>
   <Param name="rls" value="{moz:distributionID}:{moz:locale}:{moz:official}"/>
-#if MOZ_UPDATE_CHANNEL == beta
-  <MozParam name="client" condition="defaultEngine" trueValue="firefox-beta" falseValue="firefox"/>
-#elif MOZ_UPDATE_CHANNEL == aurora
-  <MozParam name="client" condition="defaultEngine" trueValue="firefox-aurora" falseValue="firefox"/>
-#elif MOZ_UPDATE_CHANNEL == nightly
-  <MozParam name="client" condition="defaultEngine" trueValue="firefox-nightly" falseValue="firefox"/>
-#else
   <MozParam name="client" condition="defaultEngine" trueValue="firefox-a" falseValue="firefox"/>
-#endif
   <MozParam name="channel" condition="purpose" purpose="contextmenu" value="rcs"/>
   <MozParam name="channel" condition="purpose" purpose="keyword" value="fflb"/>
   <MozParam name="channel" condition="purpose" purpose="homepage" value="np"/>
   <MozParam name="source" condition="purpose" purpose="homepage" value="hp"/>
 </Url>
 <SearchForm>https://www.google.com/</SearchForm>
 </SearchPlugin>
diff --git a/browser/locales/jar.mn b/browser/locales/jar.mn
--- a/browser/locales/jar.mn
+++ b/browser/locales/jar.mn
@@ -116,16 +116,17 @@
     locale/browser/syncQuota.properties         (%chrome/browser/syncQuota.properties)
 #endif
 % 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 testpilot @AB_CD@ %locale/feedback/
     locale/feedback/main.dtd                       (%feedback/main.dtd)
     locale/feedback/main.properties                (%feedback/main.properties)
 % locale pdf.js @AB_CD@ %locale/pdfviewer/
     locale/pdfviewer/viewer.properties             (%pdfviewer/viewer.properties)