summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-11-07 17:23:52 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-11-08 13:26:55 +0000
commit89e47b8bf1ba3f86204ae3ab997432c26b0eea6b (patch)
tree00a5810e2b8a044b6fe1a23ca0baecbf574bc140
parent144fbefbf858ab6a680437fa69f406967b6ae9e3 (diff)
put .ui translations into the langpacks
and drop .ui suffix from the translation files Change-Id: I01e0e2f17c97584230b8da4ee0dd08a0444d77fd
-rw-r--r--postprocess/packconfig/makefile.mk2
-rw-r--r--postprocess/packconfig/packconfig.pl60
-rw-r--r--postprocess/prj/d.lst2
-rw-r--r--scp2/source/ooo/file_ooo.scp10
-rw-r--r--scp2/source/ooo/module_lang_template.scp3
-rw-r--r--solenv/gbuild/UI.mk2
-rw-r--r--vcl/inc/vcl/builder.hxx1
-rw-r--r--vcl/source/window/builder.cxx54
8 files changed, 103 insertions, 31 deletions
diff --git a/postprocess/packconfig/makefile.mk b/postprocess/packconfig/makefile.mk
index b1d8998b144d..e54b4bb571f4 100644
--- a/postprocess/packconfig/makefile.mk
+++ b/postprocess/packconfig/makefile.mk
@@ -29,5 +29,5 @@ TARGET=uiconfig
ALLTAR : $(BIN)$/uiconfig.zip
$(BIN)$/uiconfig.zip .PHONY:
- $(PERL) packconfig.pl -i $(SOLARXMLDIR)$/uiconfig -o $@
+ $(PERL) packconfig.pl -i $(SOLARXMLDIR)$/uiconfig -o $(BIN)$/
diff --git a/postprocess/packconfig/packconfig.pl b/postprocess/packconfig/packconfig.pl
index 59a69ade4459..ec59dce36e66 100644
--- a/postprocess/packconfig/packconfig.pl
+++ b/postprocess/packconfig/packconfig.pl
@@ -27,6 +27,7 @@ use strict;
use Getopt::Long;
use File::Find;
use File::Basename;
+use File::Spec;
use Archive::Zip qw(:ERROR_CODES :CONSTANTS);
#### globals ####
@@ -35,6 +36,7 @@ my $out_path; # path to output archives in
my $files_path; # path to look for desired files
my $verbose; # be verbose
my $extra_verbose; # be extra verbose
+my $current_lang; # big fat global because File::Find is a pig
#### script id #####
@@ -43,10 +45,23 @@ my $extra_verbose; # be extra verbose
#### main #####
parse_options();
+
+#pack the .ui translations
+my @langs = split(/\s+/, $ENV{WITH_LANG});
+foreach (@langs) {
+ next if ($_ eq "en-US");
+ my %files_hash;
+ my $file_ref = get_lang_files(\%files_hash, $_);
+ my $out_file="$out_path"."uiconfig_".$_.".zip";
+ packzip(\%files_hash, $out_file);
+}
+
+#pack the core files
my %files_hash;
my $file_ref = get_core_files(\%files_hash);
my $out_file="$out_path"."uiconfig.zip";
packzip(\%files_hash, $out_file);
+
exit(0);
#### subroutines ####
@@ -108,8 +123,8 @@ sub get_core_files
my $files_hash_ref = shift;
find_core_files($files_hash_ref);
- if ( !keys %files_hash ) {
- print_error("can't find any image lists in '$files_path'", 3);
+ if ( !keys $files_hash_ref ) {
+ print_error("can't find any config files in '$files_path'", 3);
}
return wantarray ? @main::file_list : \@main::file_list;
@@ -118,14 +133,40 @@ sub get_core_files
sub find_core_files
{
my $files_hash_ref = shift;
- find({ wanted => \&wanted, no_chdir => 0 }, "$files_path");
+ find({ wanted => \&wanted_core, no_chdir => 0 }, "$files_path");
+ foreach ( @main::file_list ) {
+ /^\Q$files_path\E\/(.*)$/o;
+ $files_hash_ref->{$1}++;
+ }
+}
+
+sub get_lang_files
+{
+ local @main::file_list;
+
+ my $files_hash_ref = shift;
+ my $lang = shift;
+ find_lang_files($files_hash_ref, $lang);
+
+ if ( !keys $files_hash_ref ) {
+ print_error("can't find any config files in '$files_path'", 3);
+ }
+
+ return wantarray ? @main::file_list : \@main::file_list;
+}
+
+sub find_lang_files
+{
+ my $files_hash_ref = shift;
+ $current_lang = shift;
+ find({ wanted => \&wanted_lang, no_chdir => 0 }, "$files_path");
foreach ( @main::file_list ) {
/^\Q$files_path\E\/(.*)$/o;
$files_hash_ref->{$1}++;
}
}
-sub wanted
+sub wanted_core
{
my $file = $_;
@@ -134,6 +175,17 @@ sub wanted
}
}
+sub wanted_lang
+{
+ my $file = $_;
+
+ my @dirs = File::Spec->splitdir($File::Find::dir);
+
+ if ($dirs[-1] eq $current_lang) {
+ push @main::file_list, $File::Find::name;
+ }
+}
+
sub is_file_newer
{
my $test_hash_ref = shift;
diff --git a/postprocess/prj/d.lst b/postprocess/prj/d.lst
index f6be8cf864ab..123f94528a69 100644
--- a/postprocess/prj/d.lst
+++ b/postprocess/prj/d.lst
@@ -1,5 +1,5 @@
mkdir: %_DEST%\xml\ooo
-..\%__SRC%\bin\uiconfig.zip %_DEST%\bin\uiconfig.zip
+..\%__SRC%\bin\uiconfig*.zip %_DEST%\bin\
..\%__SRC%\misc\*.xcd %_DEST%\xml\
..\%__SRC%\misc\lang\*.xcd %_DEST%\xml\
..\%__SRC%\misc\scriptproviderforbeanshell.rdb %_DEST%\xml\scriptproviderforbeanshell.rdb
diff --git a/scp2/source/ooo/file_ooo.scp b/scp2/source/ooo/file_ooo.scp
index 36ca6d2e3747..eaf929478a1f 100644
--- a/scp2/source/ooo/file_ooo.scp
+++ b/scp2/source/ooo/file_ooo.scp
@@ -738,7 +738,7 @@ End
#endif
#endif
-// new user interface configuration files
+// user interface configuration files
File gid_File_Share_Config_Sofficecfg_uiconfig_Zip
TXT_FILE_BODY;
Styles = (ARCHIVE);
@@ -747,6 +747,14 @@ File gid_File_Share_Config_Sofficecfg_uiconfig_Zip
Patchfiles = ();
End
+// user interface configuration file translations
+File gid_File_Share_Config_Sofficecfg_uiconfig_Zip_Lang
+ TXT_FILE_BODY;
+ Styles = (ARCHIVE);
+ Dir = gid_Dir_Share_Config_Sofficecfg;
+ EXTRA_ALL_LANG_BUT_EN_US(uiconfig,zip);
+End
+
#ifdef WNT
STD_SHELLNEW_FILE(gid_File_Shellnew_Ods_Soffice, soffice.ods)
diff --git a/scp2/source/ooo/module_lang_template.scp b/scp2/source/ooo/module_lang_template.scp
index 213b00ec69a8..9a85f8884988 100644
--- a/scp2/source/ooo/module_lang_template.scp
+++ b/scp2/source/ooo/module_lang_template.scp
@@ -30,7 +30,8 @@ Module gid_Module_Langpack_Basis_Template
Name = "gid_Module_Langpack_Root_Template";
Description = "gid_Module_Langpack_Root_Template";
Styles = (TEMPLATEMODULE);
- Files = (gid_File_Extra_Autotextshare_Lang,
+ Files = (gid_File_Share_Config_Sofficecfg_uiconfig_Zip_Lang,
+ gid_File_Extra_Autotextshare_Lang,
gid_File_Registry_Filter_Zip,
gid_File_Registry_Lang,
gid_File_Registry_Spool_Langpack_Lang,
diff --git a/solenv/gbuild/UI.mk b/solenv/gbuild/UI.mk
index 2c6435ec114a..18978cedb020 100644
--- a/solenv/gbuild/UI.mk
+++ b/solenv/gbuild/UI.mk
@@ -156,7 +156,7 @@ $$(eval $$(call gb_Module_register_target,$(call gb_UI_get_target,$(1)),$(call g
endef
# gb_UI__get_outdir_filename target file lang?
-gb_UI__get_outdir_filename = xml/uiconfig/$(1)/ui/$(if $(3),res/$(3)/)$(notdir $(2)).ui
+gb_UI__get_outdir_filename = xml/uiconfig/$(1)/ui/$(if $(3),res/$(3)/)$(notdir $(2))$(if $(3),,.ui)
# gb_UI__add_uifile target package destfile srcfile lang?
define gb_UI__package_uifile
diff --git a/vcl/inc/vcl/builder.hxx b/vcl/inc/vcl/builder.hxx
index b3a0e1326b5f..27e6db9e9650 100644
--- a/vcl/inc/vcl/builder.hxx
+++ b/vcl/inc/vcl/builder.hxx
@@ -116,6 +116,7 @@ private:
std::set<Window*> m_aRedundantParentWidgets;
};
+ void loadTranslations(const com::sun::star::lang::Locale &rLocale, const OUString &rUri);
OString getTranslation(const OString &rId, const OString &rProperty) const;
OString m_sID;
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index dcef331df2f8..3e0fe3482414 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -73,44 +73,32 @@ namespace
}
}
-VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OString sID)
- : m_sID(sID)
- , m_sHelpRoot(OUStringToOString(sUIFile, RTL_TEXTENCODING_UTF8))
- , m_sProductName(OUStringToOString(utl::ConfigManager::getProductName(), RTL_TEXTENCODING_UTF8))
- , m_pParent(pParent)
- , m_pParserState(new ParserState)
+void VclBuilder::loadTranslations(const com::sun::star::lang::Locale &rLocale, const OUString& rUri)
{
- m_bToplevelHasDeferredInit = (pParent && pParent->IsDialog()) ? ((Dialog*)pParent)->isDeferredInit() : false;
-
- sal_Int32 nIdx = m_sHelpRoot.lastIndexOf('.');
- if (nIdx != -1)
- m_sHelpRoot = m_sHelpRoot.copy(0, nIdx);
- m_sHelpRoot = m_sHelpRoot + OString('/');
-
- OUString sUri = sUIDir + sUIFile;
-
- ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
- for (int i = aLocale.Country.isEmpty() ? 1 : 0; i < 2; ++i)
+ for (int i = rLocale.Country.isEmpty() ? 1 : 0; i < 2; ++i)
{
OUStringBuffer aTransBuf;
- sal_Int32 nLastSlash = sUri.lastIndexOf('/');
+ sal_Int32 nLastSlash = rUri.lastIndexOf('/');
if (nLastSlash != -1)
- aTransBuf.append(sUri.copy(0, nLastSlash));
+ aTransBuf.append(rUri.copy(0, nLastSlash));
else
{
aTransBuf.append('.');
nLastSlash = 0;
}
- aTransBuf.append("/res/").append(aLocale.Language);
+ aTransBuf.append("/res/").append(rLocale.Language);
switch (i)
{
case 0:
- aTransBuf.append('-').append(aLocale.Country);
+ aTransBuf.append('-').append(rLocale.Country);
break;
default:
break;
}
- aTransBuf.append(sUri.copy(nLastSlash));
+ sal_Int32 nEndName = rUri.lastIndexOf('.');
+ if (nEndName == -1)
+ nEndName = rUri.getLength();
+ aTransBuf.append(rUri.copy(nLastSlash, nEndName-nLastSlash));
OUString sTransUri = aTransBuf.makeStringAndClear();
try
@@ -122,6 +110,28 @@ VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OStri
{
}
}
+}
+
+VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OString sID)
+ : m_sID(sID)
+ , m_sHelpRoot(OUStringToOString(sUIFile, RTL_TEXTENCODING_UTF8))
+ , m_sProductName(OUStringToOString(utl::ConfigManager::getProductName(), RTL_TEXTENCODING_UTF8))
+ , m_pParent(pParent)
+ , m_pParserState(new ParserState)
+{
+ m_bToplevelHasDeferredInit = (pParent && pParent->IsDialog()) ? ((Dialog*)pParent)->isDeferredInit() : false;
+
+ sal_Int32 nIdx = m_sHelpRoot.lastIndexOf('.');
+ if (nIdx != -1)
+ m_sHelpRoot = m_sHelpRoot.copy(0, nIdx);
+ m_sHelpRoot = m_sHelpRoot + OString('/');
+
+ OUString sUri = sUIDir + sUIFile;
+
+ com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
+ bool bEN_US = aLocale.Language == "en" && aLocale.Country == "US" && aLocale.Variant.isEmpty();
+ if (!bEN_US)
+ loadTranslations(aLocale, sUri);
xmlreader::XmlReader reader(sUri);