diff options
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | extras/Gallery_sound.mk | 3 | ||||
-rw-r--r-- | extras/source/gallery/share/gallery_names.ulf | 12 | ||||
-rw-r--r-- | extras/source/gallery/sounds/sound.str | 2 | ||||
-rw-r--r-- | l10ntools/source/localize.cxx | 1 | ||||
-rw-r--r-- | solenv/bin/desktop-translate.pl | 16 | ||||
-rw-r--r-- | solenv/gbuild/Gallery.mk | 55 |
7 files changed, 70 insertions, 22 deletions
diff --git a/configure.ac b/configure.ac index 21384ee7b960..78dd71208fe8 100644 --- a/configure.ac +++ b/configure.ac @@ -11370,7 +11370,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 6f0aacb70a05..358da05a774c 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 000000000000..47f75b562135 --- /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 000000000000..fab10d3f8d61 --- /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 cc1e1de93964..8b93ec9d36dd 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 245ebaf5f279..21d80ab91a76 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 28a8f00a3591..0e3f84b1dd55 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. |