diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-06-11 20:56:30 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-07-21 08:20:50 +0100 |
commit | 00657aef09d854c74fb426a935a3e8b1fc390bb0 (patch) | |
tree | fd1a9bb264fe15dcc129498e62060ecd256b1ee7 /solenv/gbuild/UIConfig.mk | |
parent | fa987cbb813cfd729fe490f2f1258b7c8d7fb174 (diff) |
migrate to boost::gettext
* all .ui files go from <interface> to <interface domain="MODULE"> e.g. vcl
* all .src files go away and the english source strings folded into the .hrc as NC_("context", "source string")
* ResMgr is dropped in favour of std::locale imbued by boost::locale::generator pointed at matching
MODULE .mo files
* UIConfig translations are folded into the module .mo, so e.g. UIConfig_cui
goes from l10n target to normal one, so the res/lang.zips of UI files go away
* translation via Translation::get(hrc-define-key, imbued-std::locale)
* python can now be translated with its inbuilt gettext support (we keep the name strings.hrc there
to keep finding the .hrc file uniform) so magic numbers can go away there
* java and starbasic components can be translated via the pre-existing css.resource.StringResourceWithLocation
mechanism
* en-US res files go away, their strings are now the .hrc keys in the source code
* remaining .res files are replaced by .mo files
* in .res/.ui-lang-zip files, the old scheme missing translations of strings
results in inserting the english original so something can be found, now the
standard fallback of using the english original from the source key is used, so
partial translations shrink dramatically in size
* extract .hrc strings with hrcex which backs onto
xgettext -C --add-comments --keyword=NC_:1c,2 --from-code=UTF-8 --no-wrap
* extract .ui strings with uiex which backs onto
xgettext --add-comments --no-wrap
* qtz for gettext translations is generated at runtime as ascii-ified crc32 of
content + "|" + msgid
* [API CHANGE] remove deprecated binary .res resouce loader related uno apis
com::sun::star::resource::OfficeResourceLoader
com::sun::star::resource::XResourceBundleLoader
com::sun::star::resource::XResourceBundle
when translating strings via uno apis
com.sun.star.resource.StringResourceWithLocation
can continue to be used
Change-Id: Ia2594a2672b7301d9c3421fdf31b6cfe7f3f8d0a
Diffstat (limited to 'solenv/gbuild/UIConfig.mk')
-rw-r--r-- | solenv/gbuild/UIConfig.mk | 144 |
1 files changed, 0 insertions, 144 deletions
diff --git a/solenv/gbuild/UIConfig.mk b/solenv/gbuild/UIConfig.mk index 55446a31851d..01bfdbaea5b6 100644 --- a/solenv/gbuild/UIConfig.mk +++ b/solenv/gbuild/UIConfig.mk @@ -7,76 +7,6 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -# class UILocalizeTarget - -# Produces translations for one .ui file. - -gb_UILocalizeTarget_WORKDIR := $(WORKDIR)/UILocalizeTarget - -gb_UILocalizeTarget_DEPS := $(call gb_Executable_get_runtime_dependencies,uiex) -gb_UILocalizeTarget_COMMAND := $(call gb_Executable_get_command,uiex) - -# If translatable strings from a .ui file are not merged into the -# respective .po file yet, the produced translated files are empty, -# which breaks delivery. This hack avoids the problem by creating a -# dummy translation file. -$(call gb_UILocalizeTarget_get_workdir,%).ui : - $(if $(wildcard $@) \ - ,touch $@ \ - ,echo '<?xml version="1.0"?><t></t>' > $@ \ - ) - -define gb_UILocalizeTarget__command -$(call gb_Output_announce,$(2),$(true),UIX,1) -MERGEINPUT=$(call var2file,$(shell $(gb_MKTEMP)),100,$(POFILES)) && \ -$(call gb_Helper_abbreviate_dirs,\ - $(gb_UILocalizeTarget_COMMAND) \ - -i $(UIConfig_FILE) \ - -o $(call gb_UILocalizeTarget_get_workdir,$(2)) \ - -l all \ - -m $${MERGEINPUT} \ - && touch $(1) \ -) && \ -rm -rf $${MERGEINPUT} -endef - -$(dir $(call gb_UILocalizeTarget_get_target,%)).dir : - $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) - -$(dir $(call gb_UILocalizeTarget_get_target,%))%/.dir : - $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) - -$(call gb_UILocalizeTarget_get_target,%) : $(gb_UILocalizeTarget_DEPS) - $(call gb_UILocalizeTarget__command,$@,$*) - -.PHONY : $(call gb_UILocalizeTarget_get_clean_target,%) -$(call gb_UILocalizeTarget_get_clean_target,%) : - $(call gb_Output_announce,$*,$(false),UIX,1) - $(call gb_Helper_abbreviate_dirs,\ - rm -rf $(call gb_UILocalizeTarget_get_target,$*) $(call gb_UILocalizeTarget_get_workdir,$*) \ - ) - -# Produce translations for one .ui file -# -# gb_UILocalizeTarget_UILocalizeTarget target -define gb_UILocalizeTarget_UILocalizeTarget -$(call gb_UILocalizeTarget__UILocalizeTarget_impl,$(1),$(2),$(wildcard $(foreach lang,$(gb_TRANS_LANGS),$(gb_POLOCATION)/$(lang)/$(patsubst %/,%,$(dir $(2))).po))) - -endef - -# gb_UILocalizeTarget__UILocalizeTarget_impl target pofiles -define gb_UILocalizeTarget__UILocalizeTarget_impl -$(call gb_UILocalizeTarget_get_target,$(1)) : POFILES := $(3) -$(call gb_UILocalizeTarget_get_target,$(1)) : UIConfig_FILE := $(SRCDIR)/$(2).ui - -$(call gb_UILocalizeTarget_get_target,$(1)) : $(3) -$(call gb_UILocalizeTarget_get_target,$(1)) : $(SRCDIR)/$(2).ui -$(call gb_UILocalizeTarget_get_target,$(1)) :| \ - $(dir $(call gb_UILocalizeTarget_get_target,$(1))).dir \ - $(call gb_UILocalizeTarget_get_workdir,$(1))/.dir - -endef - # class UIMenubarTarget # Handles platform-specific processing of menubar config files. @@ -162,13 +92,8 @@ endef # # This class provides the following filelists: # * UIConfig/<name> containing all nontranslatable files -# * UIConfig/<name>_<lang> for each active lang, containing translations -# of .ui files. This filelist only exists if the UIConfig contains any -# .ui files. gb_UIConfig_INSTDIR := $(LIBO_SHARE_FOLDER)/config/soffice.cfg -# en-US is the default, so there is no translation for it -gb_UIConfig_LANGS := $(filter-out en-US,$(gb_WITH_LANG)) $(dir $(call gb_UIConfig_get_target,%)).dir : $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) @@ -194,7 +119,6 @@ $(call gb_UIConfig_get_clean_target,%) : gb_UIConfig_get_packagename = UIConfig/$(1) gb_UIConfig_get_packagesetname = UIConfig/$(1) -gb_UIConfig_get_zipname_for_lang = UIConfig/$(1)/$(2) # Processes and delivers a set of UI configuration files. # @@ -217,26 +141,12 @@ $(call gb_UIConfig_get_imagelist_target,$(1)) :| $(dir $(call gb_UIConfig_get_im $(call gb_UIConfig_get_target,$(1)) : $(call gb_PackageSet_get_target,$(call gb_UIConfig_get_packagesetname,$(1))) $(call gb_UIConfig_get_clean_target,$(1)) : $(call gb_PackageSet_get_clean_target,$(call gb_UIConfig_get_packagesetname,$(1))) -ifneq ($(gb_UIConfig_LANGS),) -$(foreach lang,$(gb_UIConfig_LANGS),$(call gb_UIConfig__UIConfig_for_lang,$(1),$(lang))) -endif - $$(eval $$(call gb_Module_register_target,$(call gb_UIConfig_get_target,$(1)),$(call gb_UIConfig_get_clean_target,$(1)))) $(call gb_Helper_make_userfriendly_targets,$(1),UIConfig) $(call gb_Postprocess_register_target,AllUIConfigs,UIConfig,$(1)) endef -define gb_UIConfig__UIConfig_for_lang -$(call gb_UIConfig_get_target,$(1)) : $(call gb_Zip_get_target,$(call gb_UIConfig_get_zipname_for_lang,$(1),$(2))) -$(call gb_UIConfig_get_clean_target,$(1)) : $(call gb_Zip_get_clean_target,$(call gb_UIConfig_get_zipname_for_lang,$(1),$(2))) -$(call gb_Zip_Zip_internal,$(call gb_UIConfig_get_zipname_for_lang,$(1),$(2)),$(gb_UILocalizeTarget_WORKDIR)/$(1)) -$(call gb_Zip_add_commandoptions,$(call gb_UIConfig_get_zipname_for_lang,$(1),$(2)),--suffixes .ui) -$(call gb_Zip_get_target,$(call gb_UIConfig_get_zipname_for_lang,$(1),$(2))) : $(SRCDIR)/solenv/gbuild/UIConfig.mk -$(call gb_Zip_set_install_name,$(call gb_UIConfig_get_zipname_for_lang,$(1),$(2)),$(INSTROOT)/$(gb_UIConfig_INSTDIR)/$(1)/ui/res/$(2).zip) - -endef - # gb_UIConfig__package_file target package type destfile srcfile define gb_UIConfig__package_file $(call gb_Package_add_file,$(2),$(gb_UIConfig_INSTDIR)/$(1)/$(3)/$(4),$(5)) @@ -260,56 +170,6 @@ $(call gb_UIConfig_get_clean_target,$(1)) : $(call gb_UIImageListTarget_get_clea endef -# Add a l10n for an .ui file to respective lang package. -# -# gb_UIConfig__add_uifile_for_lang target file lang -define gb_UIConfig__add_uifile_for_lang -$(call gb_Zip_add_file,$(call gb_UIConfig_get_zipname_for_lang,$(1),$(3)),$(notdir $(2))/$(3).ui) -$(call gb_Zip_add_dependency,$(call gb_UIConfig_get_zipname_for_lang,$(1),$(3)),$(call gb_UILocalizeTarget_get_target,$(1)/$(notdir $(2)))) - -endef - -# Add a l10n for an .ui file to respective lang package. -# -# This is only for "real" languages, i.e., everything except qtz. -# -# gb_UIConfig__add_uifile_for_real_lang target file lang -define gb_UIConfig__add_uifile_for_real_lang -$(if $(filter qtz,$(3)),$(call gb_Output_error,gb_UIConfig__add_uifile_for_real_lang called with qtz)) -$(call gb_UIConfig__add_uifile_for_lang,$(1),$(2),$(3)) - -endef - -# gb_UIConfig__add_translations_impl target uifile langs -define gb_UIConfig__add_translations_impl -$(call gb_UILocalizeTarget_UILocalizeTarget,$(1)/$(notdir $(2)),$(2)) -$(call gb_UIConfig_get_target,$(1)) : $(call gb_UILocalizeTarget_get_target,$(1)/$(notdir $(2))) -$(call gb_UIConfig_get_clean_target,$(1)) : $(call gb_UILocalizeTarget_get_clean_target,$(1)/$(notdir $(2))) -$(foreach lang,$(3),$(call gb_UIConfig__add_uifile_for_real_lang,$(1),$(2),$(lang))) - -endef - -# gb_UIConfig__add_translations target uifile langs qtz -define gb_UIConfig__add_translations -$(if $(strip $(3) $(4)),$(call gb_UIConfig__add_translations_impl,$(1),$(2),$(3))) -$(if $(strip $(4)),$(call gb_UIConfig__add_uifile_for_lang,$(1),$(2),$(strip $(4)))) - -endef - -# Adds translations for languages that have corresponding .po file -# -# gb_UIConfig__add_uifile_translations target uifile -define gb_UIConfig__add_uifile_translations -$(call gb_UIConfig__add_translations,$(1),$(2),\ - $(foreach lang,$(gb_UIConfig_LANGS),\ - $(if $(wildcard $(gb_POLOCATION)/$(lang)/$(patsubst %/,%,$(dir $(2))).po),$(lang)) \ - ),\ - $(filter qtz,$(gb_UIConfig_LANGS)) \ -) - -endef - - gb_UIConfig_ALLFILES:= # Adds .ui file to the package # @@ -320,10 +180,6 @@ define gb_UIConfig_add_uifile gb_UIConfig_ALLFILES+=$(1):$(notdir $(2)) $(call gb_UIConfig__add_uifile,$(1),$(2)) -ifneq ($(gb_UIConfig_LANGS),) -$(call gb_UIConfig__add_uifile_translations,$(1),$(2)) -endif - endef # Adds multiple .ui files to the package |