diff options
author | plegall <plg@piwigo.org> | 2013-08-20 17:10:56 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2013-08-20 17:10:56 +0000 |
commit | 6f2fc71ffadb049855b2ff2c9fc0a1952b736484 (patch) | |
tree | dd40e49beddde1c22be2a939b8aa7f71e9d8317a /tools/convert_language_to_2.1.pl | |
parent | 6b73cb58b78a9b23d71f9843ee3fa176058a521e (diff) |
remove obsolete/useless scripts
git-svn-id: http://piwigo.org/svn/trunk@24201 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'tools/convert_language_to_2.1.pl')
-rw-r--r-- | tools/convert_language_to_2.1.pl | 184 |
1 files changed, 0 insertions, 184 deletions
diff --git a/tools/convert_language_to_2.1.pl b/tools/convert_language_to_2.1.pl deleted file mode 100644 index b78547a33..000000000 --- a/tools/convert_language_to_2.1.pl +++ /dev/null @@ -1,184 +0,0 @@ -#!/usr/bin/perl - -# Here is the way I finally used this script: -# -# for language in ar_SA cz_CZ da_DK de_DE es_AR es_ES hr_HR hu_HU it_IT ja_JP nl_NL pl_PL pt_BR pt_PT ru_RU sr_RS vi_VN zh_CN -# do -# export PWG_LANG=$language -# rm -rf language/$PWG_LANG -# cp -r ../branches/2.0/language/$PWG_LANG language/ -# perl tools/convert_language_to_2.1.pl language/$PWG_LANG -# done - -use strict; -use warnings; - -my $language_dir = $ARGV[0]; - -my @file_codes = qw/upgrade install admin common/; - -my %ignore_keys = ( - 'user_status_admin' => '', - 'user_status_generic' => '', - 'user_status_guest' => '', - 'user_status_normal' => '', - 'user_status_webmaster' => '', - 'Level 0' => '', - 'Level 1' => '', - 'Level 2' => '', - 'Level 4' => '', - 'Level 8' => '', - 'ACCESS_0' => '', - 'ACCESS_1' => '', - 'ACCESS_2' => '', - 'ACCESS_3' => '', - 'ACCESS_4' => '', - 'ACCESS_5' => '', - 'month' => '', - 'day' => '', - 'chronology_monthly_calendar' => '', - 'chronology_monthly_list' => '', - 'chronology_weekly_list' => '', -); - -my %remove_keys = ( - common => { - "You can\\'t upload pictures in this category" => '', - 'display pictures added on' => '', - 'Email address is missing' => '', - 'Delete: %s' => '', - 'All tags must match' => '', - 'Validate: %s' => '', - 'Upgrade from %s to %s' => '', - }, - admin => { - 'nbm_content_goto_2' => '', - 'nbm_content_hello_2' => '', - 'nbm_redirect_msg' => '', - - 'username' => '', - 'No tag defined. Use Administration>Pictures>Tags' => '', - 'Remote site url must start by http or https and must only contain characters among "/", "a-zA-Z0-9", "-" or "_"' => '', - 'path' => '', - 'Unable to retrieve server informations since allow_url_fopen is disabled.' => '', - 'The following tag were deleted' => '', - 'Remote site' => '', - 'Piwigo home' => '', - 'Move up' => '', - 'Instructions' => '', - 'Hits' => '', - 'General' => '', - 'Gallery description' => '', - 'Extensions' => '', - 'Demo' => '', - 'Categories ascending alphanumerically ordered' => '', - 'Categories descending alphanumerically ordered' => '', - 'Categories sorted in ascending order ⇓' => '', - 'Categories sorted in ascending order ⇓' => '', - 'Categories sorted in descending order ⇑' => '', - 'Categories sorted in descending order ⇑' => '', - 'Bugs' => '', - 'Automatic installation' => '', - 'Upgrade from version %s to %s' => '', - 'Upgrade from %s to %s' => '', - 'Upload Form' => '', - }, - upgrade => { - 'Are you sure?' => '', - 'In <i>%s</i>, before <b>?></b>, insert:' => '', - }, - install => { - 'Parameters are correct' => '', - 'Installation finished' => '', - 'The next step of the installation is now possible' => '', - 'next step' => '', - } -); - -my %to_copy = (); - -# load the replacements -my %replace_by = (); -foreach my $file_code (@file_codes) { - open(my $ifh_rep, '<language/templates/'.$file_code.'.lang.php'); - while (<$ifh_rep>) { - if (m/^\$lang\['(.*)'\] \s* = \s* (['"])(.*)\2;/x) { - if ($1 ne $3 and length($1) > 0) { - $replace_by{$1} = $3; - } - } - } -} -# use Data::Dumper; print Dumper(\%replace_by); exit(); - -my $append_to_common = ''; - -foreach my $file_code (@file_codes) { - my $filename = $language_dir.'/'.$file_code.'.lang.php'; - print $filename; - if (not -f $filename) { - print ' is missing', "\n"; - next; - } - print ' is under process', "\n"; - - if ($file_code eq 'admin') { - %to_copy = ( - 'Are you sure?' => '', - 'Email address is missing. Please specify an email address.' => '', - 'delete this comment' => '', - 'validate this comment' => '', - ); - } - else { - %to_copy = (); - } - - my $file_content = ''; - my $copy_content = ''; - - open(my $ifh, '<'.$language_dir.'/'.$file_code.'.lang.php'); - while (my $line = <$ifh>) { - if ($line =~ m/^\$lang\['(.*)'\] \s* =/x) { - if (defined $remove_keys{$file_code}{$1}) { - next; - } - elsif (defined $ignore_keys{$1}) { - $file_content.= $line; - } - elsif (defined $to_copy{$1}) { - $append_to_common.= $line; - } - elsif (defined $replace_by{$1}) { - my $search = quotemeta($1); - my $replace = $replace_by{$1}; - - $line =~ s{$search}{$replace}; - - if (defined $to_copy{$replace}) { - $append_to_common.= $line; - } - else { - $file_content.= $line; - } - } - else { - $file_content.= $line; - } - } - elsif ($line =~ m/^?>/) { - if ('common' eq $file_code) { - $file_content.= $append_to_common; - } - $file_content.= $line; - } - else { - $file_content.= $line; - } - } - close($ifh); - - open(my $ofh, '>'.$language_dir.'/'.$file_code.'.lang.php'); - print {$ofh} $file_content; - close($ofh); -} |