diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-11-07 17:23:52 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-11-08 13:26:55 +0000 |
commit | 89e47b8bf1ba3f86204ae3ab997432c26b0eea6b (patch) | |
tree | 00a5810e2b8a044b6fe1a23ca0baecbf574bc140 /postprocess | |
parent | 144fbefbf858ab6a680437fa69f406967b6ae9e3 (diff) |
put .ui translations into the langpacks
and drop .ui suffix from the translation files
Change-Id: I01e0e2f17c97584230b8da4ee0dd08a0444d77fd
Diffstat (limited to 'postprocess')
-rw-r--r-- | postprocess/packconfig/makefile.mk | 2 | ||||
-rw-r--r-- | postprocess/packconfig/packconfig.pl | 60 | ||||
-rw-r--r-- | postprocess/prj/d.lst | 2 |
3 files changed, 58 insertions, 6 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 |