[Libreoffice-commits] core.git: Branch 'feature/gengal' - 3 commits - configure.ac desktop/source extras/Gallery_sound.mk extras/source l10ntools/source solenv/bin solenv/gbuild svx/source

Michael Meeks michael.meeks at suse.com
Mon May 13 07:52:29 PDT 2013


 configure.ac                                  |    3 -
 desktop/source/app/appinit.cxx                |    2 
 extras/Gallery_sound.mk                       |    3 -
 extras/source/gallery/share/gallery_names.ulf |   12 +++++
 extras/source/gallery/sounds/sound.str        |    2 
 l10ntools/source/localize.cxx                 |    1 
 solenv/bin/desktop-translate.pl               |   18 ++++++--
 solenv/gbuild/Gallery.mk                      |   55 ++++++++++++++++++--------
 svx/source/gallery2/galini.cxx                |    6 ++
 9 files changed, 78 insertions(+), 24 deletions(-)

New commits:
commit 697a74e5d22cc68dc928b3e32d12075009fc8524
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Mon May 13 13:53:05 2013 +0100

    gallery: cleanup makefiles for new gallery naming and translation.
    
    Change-Id: I9ec5192c007df6d0ce15f5e61cb53cf6ea04db08

diff --git a/configure.ac b/configure.ac
index 4087cca..25eb980 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11423,7 +11423,8 @@ for lang in $WITH_LANG; do
         fi
     done
     if test "$vl" != "$lang"; then
-        AC_MSG_ERROR([invalid language: $lang; supported languages are: $ALL_LANGS])
+        # if you're reading this - you prolly quoted your languages remove the quotes ...
+        AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
     fi
 done
 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
diff --git a/extras/Gallery_sound.mk b/extras/Gallery_sound.mk
index 6f0aacb..358da05 100644
--- a/extras/Gallery_sound.mk
+++ b/extras/Gallery_sound.mk
@@ -6,8 +6,9 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
+# this should probably be done with more general rules: but how ?
 
-$(eval $(call gb_Gallery_Gallery,sound,extras/source/gallery/sounds,Sounds))
+$(eval $(call gb_Gallery_Gallery,sound,extras/source/gallery/sounds))
 
 $(eval $(call gb_Gallery_add_files,sound,\
 	extras/source/gallery/sounds/apert2.wav \
diff --git a/extras/source/gallery/share/gallery_names.ulf b/extras/source/gallery/share/gallery_names.ulf
new file mode 100644
index 0000000..47f75b5
--- /dev/null
+++ b/extras/source/gallery/share/gallery_names.ulf
@@ -0,0 +1,12 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+[sound]
+en-US = "Sounds"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extras/source/gallery/sounds/sound.str b/extras/source/gallery/sounds/sound.str
new file mode 100644
index 0000000..fab10d3
--- /dev/null
+++ b/extras/source/gallery/sounds/sound.str
@@ -0,0 +1,2 @@
+# Translated by desktop-translate and ulfex
+name = "Sounds"
diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx
index cc1e1de..8b93ec9 100644
--- a/l10ntools/source/localize.cxx
+++ b/l10ntools/source/localize.cxx
@@ -301,6 +301,7 @@ bool includeProject(const OString& rProject) {
         "dictionaries",
         "editeng",
         "extensions",
+        "extras",
         "filter",
         "forms",
         "formula",
diff --git a/solenv/bin/desktop-translate.pl b/solenv/bin/desktop-translate.pl
index 245ebaf..21d80ab 100644
--- a/solenv/bin/desktop-translate.pl
+++ b/solenv/bin/desktop-translate.pl
@@ -29,6 +29,7 @@ eval 'exec perl -wS $0 ${1+"$@"}'
 my ($prefix, $ext, $key);
 my $productname = "LibreOffice";
 my $workdir = ".";
+my $template_dir;
 
 while ($_ = $ARGV[0], /^-/) {
     shift;
@@ -53,6 +54,14 @@ while ($_ = $ARGV[0], /^-/) {
         $ext = $ARGV[0];
         shift;
     }
+    if (/^--template-dir/) {
+        $template_dir = $ARGV[0];
+        shift;
+    }
+}
+
+if (!defined $template_dir) {
+    $template_dir = "$workdir/$prefix";
 }
 
 # hack for unity section
@@ -65,8 +74,7 @@ my %templates;
 
 # open input file
 unless (open(SOURCE, $ARGV[0])) {
-    print STDERR "Can't open $ARGV[0] file: $!\n";
-    return;
+    die "Can't open $ARGV[0] file: $!\n";
 }
 
 # currently read template
@@ -81,7 +89,7 @@ while (<SOURCE>) {
         my %entry;
         # For every section in the specified ulf file there should exist
         # a template file in $workdir ..
-        $entry{'outfile'} = "$workdir/$prefix$template.$ext";
+        $entry{'outfile'} = "$template_dir$template.$ext";
         my %translations;
         $entry{'translations'} = \%translations;
         $templates{$template} = \%entry;
@@ -115,7 +123,7 @@ foreach $template (keys %templates) {
     # open the template file - ignore sections for which no
     # templates exist
     unless(open(TEMPLATE, $outfile)) {
-        print STDERR "Warning: No template found for item $_: $outfile: $!\n";
+        print STDERR "Warning: No template found for item '$template' : '$outfile' : '$_': $!\n";
         exit -1;
     }
 
diff --git a/solenv/gbuild/Gallery.mk b/solenv/gbuild/Gallery.mk
index 28a8f00..0e3f84b 100644
--- a/solenv/gbuild/Gallery.mk
+++ b/solenv/gbuild/Gallery.mk
@@ -30,6 +30,8 @@ gb_Gallery__UNO_TYPES := \
 	offapi \
 	udkapi
 
+gb_Gallery_TRANSLATE := $(SOLARENV)/bin/desktop-translate.pl
+
 # TODO: this should be in RepositoryExternal.mk, but it would lead to
 # duplication. Fix.
 gb_Gallery_EXTRA_DEPENCENCIES := \
@@ -93,15 +95,6 @@ $(call gb_Gallery_get_clean_target,%) :
 			$(call gb_Gallery_get_workdir,$*) \
 	)
 
-$(WORKDIR)/Gallery/%.sdv :
-	touch $@
-
-$(WORKDIR)/Gallery/%.thm :
-	touch $@
-
-$(WORKDIR)/Gallery/%.sdg :
-	touch $@
-
 gb_Gallery_get_packagename = Gallery/$(1)
 
 # Create a gallery.
@@ -115,21 +108,26 @@ $(call gb_Gallery__Gallery_impl,$(1),$(call gb_Gallery_get_packagename,$(1)),$(2
 
 endef
 
+
+gb_Gallery_basedir = $(patsubst %/,%,$(dir $(SRCDIR)/$(1)))
+
 # gb_Gallery__Gallery_impl gallery package basedir name
 define gb_Gallery__Gallery_impl
 $(call gb_Package_Package_internal,$(2),$(call gb_Gallery_get_workdir,$(1)))
 $(call gb_Package_set_outdir,$(2),$(INSTDIR))
-$(call gb_Package_add_file,$(2),$(gb_Gallery_INSTDIR)/$(1).sdg,sg1.sdg)
-$(call gb_Package_add_file,$(2),$(gb_Gallery_INSTDIR)/$(1).sdv,sg1.sdv)
-$(call gb_Package_add_file,$(2),$(gb_Gallery_INSTDIR)/$(1).thm,sg1.thm)
+$(call gb_Package_add_file,$(2),$(gb_Gallery_INSTDIR)/$(1).sdg,$(1).sdg)
+$(call gb_Package_add_file,$(2),$(gb_Gallery_INSTDIR)/$(1).sdv,$(1).sdv)
+$(call gb_Package_add_file,$(2),$(gb_Gallery_INSTDIR)/$(1).thm,$(1).thm)
+$(call gb_Package_add_file,$(2),$(gb_Gallery_INSTDIR)/$(1).str,$(1).str)
 
 # strip URL, without / to help the internal gallery system
-$(call gb_Gallery_get_target,$(1)) : GALLERY_BASEDIR := $(patsubst %/,%,$(call gb_Helper_make_url,$(dir $(SRCDIR)/$(3))))
+$(call gb_Gallery_get_target,$(1)) : GALLERY_BASEDIR := $(call gb_Helper_make_url,$(call gb_Gallery_basedir,$(3)))
 $(call gb_Gallery_get_target,$(1)) : GALLERY_FILES :=
-$(call gb_Gallery_get_target,$(1)) : GALLERY_NAME := $(4)
+$(call gb_Gallery_get_target,$(1)) : GALLERY_NAME := $(1)
 
-$(call gb_Gallery_get_workdir,$(1))/sg1.sdv \
-$(call gb_Gallery_get_workdir,$(1))/sg1.thm : $(call gb_Gallery_get_target,$(1))
+$(call gb_Gallery_get_workdir,$(1))/$(1).sdg \
+$(call gb_Gallery_get_workdir,$(1))/$(1).sdv \
+$(call gb_Gallery_get_workdir,$(1))/$(1).thm : $(call gb_Gallery_get_target,$(1))
 $(call gb_Gallery__get_final_target,$(1)) : $(call gb_Package_get_target,$(2))
 $(call gb_Gallery_get_clean_target,$(1)) : $(call gb_Package_get_clean_target,$(2))
 $(call gb_Gallery_get_target,$(1)) :| $(dir $(call gb_Gallery_get_target,$(1))).dir \
@@ -138,6 +136,31 @@ $(call gb_Gallery_get_target,$(1)) :| $(dir $(call gb_Gallery_get_target,$(1))).
 $$(eval $$(call gb_Module_register_target,$(call gb_Gallery__get_final_target,$(1)),$(call gb_Gallery_get_clean_target,$(1))))
 $(call gb_Helper_make_userfriendly_targets,$(1),Gallery,$(call gb_Gallery__get_final_target,$(1)))
 
+
+# this should probably be done with more general rules: but how ?
+ifneq ($(WITH_LANG),)
+$$(call gb_Gallery_get_workdir,$(1))/$(1).ulf : \
+	$$(call gb_Gallery_basedir,$(3))/share/gallery_names.ulf | $$(call gb_Executable_get_runtime_dependencies,ulfex) \
+	$(call gb_Gallery_get_target,$(1)) # that rule pre-cleans our output directory
+	$$(call gb_Output_announce,$@,$(true),SUM,1)
+	MERGEINPUT=`$(gb_MKTEMP)` && \
+	echo $(foreach lang,$(gb_TRANS_LANGS),$(gb_POLOCATION)/$(lang)/$(patsubst %/,%,$(dir $(3))).po) > $$$${MERGEINPUT} && \
+	$(call gb_Helper_abbreviate_dirs,\
+	$$(call gb_Executable_get_command,ulfex) -i $$< -o $$@ -m $$$${MERGEINPUT} -l all ) && \
+	rm -rf $$$${MERGEINPUT}
+else
+$$(call gb_Gallery_get_workdir,$(1))/$(1).ulf : $$(call gb_Gallery_basedir,$(3))/share/gallery_names.ulf
+	cp $< $@
+endif
+
+$(call gb_Gallery_get_workdir,$(1))/$(1).str : $(gb_Gallery_TRANSLATE) \
+		$$(call gb_Gallery_get_workdir,$(1))/$(1).ulf
+		cp -f $(SRCDIR)/$(3)/$(1).str $(call gb_Gallery_get_workdir,$(1))/$(1).str && \
+		$(PERL) $(gb_Gallery_TRANSLATE) -d $(WORKDIR)/$* \
+				--ext "str" --key "name" \
+				--template-dir $$(call gb_Gallery_get_workdir,$(1))/ \
+				$$(call gb_Gallery_get_workdir,$(1))/$(1).ulf
+
 endef
 
 # Add a file to the gallery.
commit 97d63fe500e2490dc0281c608358dfff453906c5
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Sat May 11 20:55:23 2013 +0100

    fdo#64311 - fix namespace issue / compile failure.
    
    Change-Id: I7ce3837a1a451560f5867786bb20d8280e7bef23

diff --git a/desktop/source/app/appinit.cxx b/desktop/source/app/appinit.cxx
index de9299b..d555c03 100644
--- a/desktop/source/app/appinit.cxx
+++ b/desktop/source/app/appinit.cxx
@@ -96,7 +96,7 @@ static void configureUcb()
                         ".*", false);
         }
     }
-    catch ( const uno::Exception & )
+    catch ( const Exception & )
     {
         SAL_WARN( "desktop", "missing gnome-vfs component to initialize thread workaround" );
     }
commit f3ece634c91b033b09528237359d97a39a125466
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Mon May 13 13:01:41 2013 +0100

    gallery: allow comments in .str files.
    
    Change-Id: I150dee5d9c3b8f2dc656c292d7e9ef56f05cff84

diff --git a/solenv/bin/desktop-translate.pl b/solenv/bin/desktop-translate.pl
index ad2a07c..245ebaf 100644
--- a/solenv/bin/desktop-translate.pl
+++ b/solenv/bin/desktop-translate.pl
@@ -137,7 +137,7 @@ foreach $template (keys %templates) {
                 # print "locale is $locale\n";
                 # print "value is $value\n";
                 if ($value) {
-                    if ($ext eq "desktop") {
+                    if ($ext eq "desktop" || $ext eq "str") {
                         print OUTFILE "$outkey\[$locale\]=$value\n";
                     } else {
                         print OUTFILE "\t\[$locale\]$outkey=$value\n";
diff --git a/svx/source/gallery2/galini.cxx b/svx/source/gallery2/galini.cxx
index ecb06b0..dce5ce3 100644
--- a/svx/source/gallery2/galini.cxx
+++ b/svx/source/gallery2/galini.cxx
@@ -45,6 +45,12 @@ OUString GalleryThemeEntry::ReadStrFromIni(const OUString &aKeyName )
             OUString aLocale;
             OUString aValue;
             sal_Int32 n;
+
+            // comments
+            if( aLine.indexOf( '#' ) == 0 )
+                continue;
+
+            // a[en_US] = Bob
             if( ( n = aLine.indexOf( '=' ) ) >= 1)
             {
                 aKey = OStringToOUString(


More information about the Libreoffice-commits mailing list