[Libreoffice-commits] .: Branch 'libreoffice-4-0' - solenv/gbuild

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jan 2 04:57:44 PST 2013


 solenv/gbuild/UI.mk |   34 +++++++++++++++++++++++++++++-----
 1 file changed, 29 insertions(+), 5 deletions(-)

New commits:
commit afa240330b51fb3607cfa6390aeb4e085cd1c525
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Jan 2 13:51:20 2013 +0100

    only package .ui translations that can be produced
    
    That means that there is corresponding .po file for given language.
    
    As a slight optimization, do not even try to run uiex if _no_
    translation would be produced.
    
    Change-Id: I901e88b20edfb55e4f8bc661bacf8218b603bdcb
    (cherry picked from commit 76091d814ca084ba66fcb9db8bc4565c47ee16a5)
    
    Signed-off-by: David Tardon <dtardon at redhat.com>

diff --git a/solenv/gbuild/UI.mk b/solenv/gbuild/UI.mk
index 00572b0..f6f4e00 100644
--- a/solenv/gbuild/UI.mk
+++ b/solenv/gbuild/UI.mk
@@ -147,6 +147,34 @@ $(call gb_UI__package_uifile,$(1),$(1)_ui_localized,res/$(3)/$(notdir $(2)),$(2)
 
 endef
 
+# gb_UI__add_translations_impl target uifile langs
+define gb_UI__add_translations_impl
+$(call gb_UILocalizeTarget_UILocalizeTarget,$(2))
+$(call gb_UI_get_target,$(1)) : $(call gb_UILocalizeTarget_get_target,$(2))
+$(call gb_UI_get_clean_target,$(1)) : $(call gb_UILocalizeTarget_get_clean_target,$(2))
+$(call gb_Package_get_preparation_target,$(1)_ui_localized) : $(call gb_UILocalizeTarget_get_target,$(2))
+$(foreach lang,$(3),$(call gb_UI__add_uifile_for_lang,$(1),$(2),$(lang)))
+
+endef
+
+# gb_UI__add_translations target uifile langs
+define gb_UI__add_translations
+$(if $(strip $(3)),$(call gb_UI__add_translations_impl,$(1),$(2),$(3)))
+
+endef
+
+# Adds translations for languages that have corresponding .po file
+#
+# gb_UI__add_uifile_translations target uifile
+define gb_UI__add_uifile_translations
+$(call gb_UI__add_translations,$(1),$(2),\
+	$(foreach lang,$(gb_UI_LANGS),\
+		$(if $(wildcard $(gb_POLOCATION)/$(lang)/$(patsubst %/,%,$(dir $(2))).po),$(lang)) \
+	) \
+)
+
+endef
+
 # Adds .ui file to the package
 #
 # The file is relative to $(SRCDIR) and without extension.
@@ -156,11 +184,7 @@ define gb_UI_add_uifile
 $(call gb_UI__add_uifile,$(1),$(2))
 
 ifneq ($(gb_UI_LANGS),)
-$(call gb_UILocalizeTarget_UILocalizeTarget,$(2))
-$(call gb_UI_get_target,$(1)) : $(call gb_UILocalizeTarget_get_target,$(2))
-$(call gb_UI_get_clean_target,$(1)) : $(call gb_UILocalizeTarget_get_clean_target,$(2))
-$(call gb_Package_get_preparation_target,$(1)_ui_localized) : $(call gb_UILocalizeTarget_get_target,$(2))
-$(foreach lang,$(gb_UI_LANGS),$(call gb_UI__add_uifile_for_lang,$(1),$(2),$(lang)))
+$(call gb_UI__add_uifile_translations,$(1),$(2))
 endif
 
 endef


More information about the Libreoffice-commits mailing list