Kaydet (Commit) 89e47b8b authored tarafından Caolán McNamara's avatar Caolán McNamara

put .ui translations into the langpacks

and drop .ui suffix from the translation files

Change-Id: I01e0e2f17c97584230b8da4ee0dd08a0444d77fd
üst 144fbefb
......@@ -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)$/
......@@ -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;
......
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
......
......@@ -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)
......
......@@ -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,
......
......@@ -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
......
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment