From: <ow...@us...> - 2007-11-14 21:49:47
|
Revision: 714 http://ipcop.svn.sourceforge.net/ipcop/?rev=714&view=rev Author: owes Date: 2007-11-14 13:49:50 -0800 (Wed, 14 Nov 2007) Log Message: ----------- Sit back for changes to GUI and language stuff 1) updated the tool to fetch text from lang DB, also created a make.sh option to start it (don't know if that's really a good idea). 2) created lfs/ipcop-lang to handle locale stuff. 3) the CGIs can now handle gettext() in addition to $Lang::tr. The locale (language for GUI and setup) is initially choosen in installer. Stored in main/settings and used by lang.pl to load correct language and set adminmanual URL. Locale is then changeable by gui.cgi. We should probably change General::adminmanualurl into Lang::adminmanualurl 4) added Perl Locale::Maketext::Gettext. Some additional Perl needed for changing locale in rootfiles/arch_i486/perl (other arch. miss that ATM). Perl rootfiles should be combined somewhat as the differ between archs. 5) restyled the GUI a bit, mainly to show our slogan in the GUI (top-center). Modified Paths: -------------- ipcop/trunk/config/cfgroot/general-functions.pl ipcop/trunk/config/cfgroot/header.pl ipcop/trunk/config/cfgroot/lang.pl ipcop/trunk/config/rootfiles/arch_i486/perl ipcop/trunk/config/rootfiles/common/apache ipcop/trunk/config/rootfiles/common/ipcop ipcop/trunk/doc/make.sh-usage ipcop/trunk/html/html/images/header_dyn.png ipcop/trunk/html/html/images/header_left.png ipcop/trunk/html/html/images/header_right.png ipcop/trunk/html/html/images/sflogo.png ipcop/trunk/html/html/images/shieldedtux.png ipcop/trunk/html/html/include/ipcop.css ipcop/trunk/lfs/installer ipcop/trunk/lfs/ipcop ipcop/trunk/make.sh ipcop/trunk/src/installer/language.c ipcop/trunk/src/installer/setup.c ipcop/trunk/tools/gen_strings.pl Added Paths: ----------- ipcop/trunk/config/rootfiles/common/Locale-Maketext-Gettext ipcop/trunk/config/rootfiles/common/ipcop-lang ipcop/trunk/html/html/images/header_top.png ipcop/trunk/lfs/ipcop-lang ipcop/trunk/lfs/perl-gettext Modified: ipcop/trunk/config/cfgroot/general-functions.pl =================================================================== --- ipcop/trunk/config/cfgroot/general-functions.pl 2007-11-14 21:31:34 UTC (rev 713) +++ ipcop/trunk/config/cfgroot/general-functions.pl 2007-11-14 21:49:50 UTC (rev 714) @@ -24,7 +24,6 @@ $General::version = 'VERSION'; $General::swroot = 'CONFIG_ROOT'; $General::noipprefix = 'noipg-'; -$General::adminmanualurl = 'http://www.ipcop.org/1.4.0/en/admin/html'; # # log ("message") use default 'ipcop' tag Modified: ipcop/trunk/config/cfgroot/header.pl =================================================================== --- ipcop/trunk/config/cfgroot/header.pl 2007-11-14 21:31:34 UTC (rev 713) +++ ipcop/trunk/config/cfgroot/header.pl 2007-11-14 21:49:50 UTC (rev 714) @@ -380,8 +380,8 @@ print <<END <!-- IPCOP HEADER --> <table width='100%' border='0' cellpadding='0' cellspacing='0'> -<tr> -<td width='719' style='background: url(/images/header_left.png);'> +<tr><td align='center' colspan='3'><img src='/images/header_top.png' /></td></tr> +<tr><td width='719' style='background: url(/images/header_left.png);'> <table width='100%' border='0' cellpadding='0' cellspacing='0'> <col width='75'> <col width='182'> @@ -416,12 +416,12 @@ sub closepage { - my $status = &connectionstatus() ."<br />". `/bin/date "+%Y-%m-%d %H:%M:%S"`; + my $status = &connectionstatus() ."<br />". `/bin/date "+%Y-%m-%d %H:%M:%S"` ."<br /><br /><small>IPCop v${General::version} © 2001-2008 The IPCop Team</small>"; print <<END <!-- IPCOP FOOTER --> <table width='100%' border='0'><tr> - <td width='25%'><img src='/images/null.gif' width='15' height='12' alt='' /><a href='http://sf.net/projects/ipcop/' target='_blank'><img src='/images/sflogo.png' width='154' height='12' alt='Sourceforge logo' /></a></td> + <td width='25%'><img src='/images/null.gif' width='15' height='12' alt='' /><a href='http://sourceforge.net/' target='_blank'><img src='/images/sflogo.png' width='154' height='12' alt='Sourceforge logo' /></a></td> <td align='center' valign='center'>$status</td> <td width='15%' valign='bottom'><a href='http://www.ipcop.org/' target='_blank'><img src='/images/shieldedtux.png' width='123' height='90' alt='IPCop Tux' /></a></td> </tr></table> Modified: ipcop/trunk/config/cfgroot/lang.pl =================================================================== --- ipcop/trunk/config/cfgroot/lang.pl 2007-11-14 21:31:34 UTC (rev 713) +++ ipcop/trunk/config/cfgroot/lang.pl 2007-11-14 21:49:50 UTC (rev 714) @@ -1,175 +1,52 @@ -# SmoothWall CGIs +#!/usr/bin/perl # -# This code is distributed under the terms of the GPL +# IPCop CGIs # -# (c) The SmoothWall Team -# Copyright (c) 2002/08/23 Mark Wormgoor <ma...@wo...> Split from header.pl +# (c) The IPCop Team +# Copyright (c) 2007-11-13 owes This is almost a full cleanup, texts are now fetched from .MO files. # # $Id$ # + package Lang; require 'CONFIG_ROOT/general-functions.pl'; +use Locale::Maketext::Gettext::Functions; use strict; -### A cache file to avoid long recalculation -$Lang::CacheLang = '/var/run/cache-lang.pl'; -# When you want to add your own language strings/entries to the ipcop language file, -# you should create a file with <PREFIX>.<LANG>.pl into CONFIG_ROOT/addon-lang dir -# <PREFIX> is free choosable but should be significant. An Example might be "myAddnName" -# <LANG> is a mnemonic of the used language like en, de, it, nl etc. -# You can find a detailed list of possible mnemonic's in the file CONFIG_ROOT/langs/list -# A file could be named "VirtualHttpd.en.pl" for example. -# -# The file content has to start with (of course without the leading #): -# --------- CODE --------- -#%tr = (%tr, -# 'key1' => 'value', # add all your entries key/values here -# 'key2' => 'value' # and end with (of course without the leading #): -#); -# --------- CODE END--------- -# -# After you have copied all your files to CONFIG_ROOT/add-lang you have to run the -# script compilation: -# perl -e "require 'CONFIG_ROOT/lang.pl'; &Lang::BuildCacheLang" - - -### Initialize language -%Lang::tr = (); +# Get selected language my %settings = (); &General::readhash("${General::swroot}/main/settings", \%settings); -reload($settings{'LANGUAGE'}); -# language variable used by makegraphs script +# Setup for __('text') +bindtextdomain("ipcop", "/usr/share/locale"); +textdomain("ipcop"); + +# Set language variable used by makegraphs script our $language; $language = $settings{'LANGUAGE'}; -# set admin manual URL to other language -if ($language eq 'de') { - $General::adminmanualurl = 'http://www.ipcop-forum.de/manuals/online/ipcop-admin-chunk-de-1.4.x'; -} +# Use reload function +reload($settings{'LOCALE'}); -# -# Load default (== english) language -# -sub loadLangDefault -{ - &reload("en"); -} - - -# -# Load requested language file from cachefile. If cachefile doesn't exist, build on the fly. -# (it is a developper options) -# +# reload is also used when changing languages in the GUI +# call with something like "en_GB", "de_DE", "fr_FR" etc. sub reload { + my $L = shift; - my ($LG) = @_; - %Lang::tr = (); # start with a clean array - - # Use CacheLang if present & not empty. - if (-s "$Lang::CacheLang.$LG" ) { - ##fix: need to put a lock_shared on it in case rebuild is active ? - do "$Lang::CacheLang.$LG"; - #&General::log ("cachelang file used [$LG]"); - return; + # Set locale for __('text') + get_handle($L); + # Get lexicon for $Lang::tr{'text'} + %Lang::tr = read_mo("/usr/share/locale/$L/LC_MESSAGES/ipcop.mo"); + # set admin manual URL + if ( $L eq 'de_DE' ) { + $General::adminmanualurl = 'http://www.ipcop-forum.de/manuals/online/ipcop-admin-chunk-de-1.4.x'; } - - #&General::log("Building on the fly cachelang file for [$LG]"); - do "${General::swroot}/langs/en.pl"; - do "${General::swroot}/langs/$LG.pl" if ($LG ne 'en'); - - my $AddonDir = ${General::swroot}.'/addon-lang'; - - opendir (DIR, $AddonDir); - my @files = readdir (DIR); - closedir (DIR); - - # default is to load english first - foreach my $file ( grep (/.*\.en.pl$/,@files)) { - do "$AddonDir/$file"; + else { + $General::adminmanualurl = 'http://www.ipcop.org/1.4.0/en/admin/html'; } - - # read again, overwriting 'en' with choosed lang - if ($LG ne 'en') { - foreach my $file (grep (/.*\.$LG\.pl$/,@files) ) { - do "$AddonDir/$file"; - } - } } -# -# Assume this procedure is called with enough privileges. -# Merge ipcop langage file + all other extension found in addon-lang -# to build a 'cachefile' for selected language -# -sub BuildUniqueCacheLang { - - my ($LG) = @_; - - # Make CacheLang empty so that it won't be used by Lang::reload - open (FILE, ">$Lang::CacheLang.$LG") or return 1; - flock (FILE, 2) or return 1; - close (FILE); - - # Load languages files - &Lang::reload ($LG); - - # Write the unique %tr=('key'=>'value') array - open (FILE, ">$Lang::CacheLang.$LG") or return 1; - flock (FILE, 2) or return 1; - print FILE '%tr=('; - foreach my $k ( keys %Lang::tr ){ - $Lang::tr{$k} =~ s/\'/\\\'/g; # quote ' => \' - print FILE "'$k' => '$Lang::tr{$k}',"; # key => value, - } - print FILE ');'; - close (FILE); - - # Make nobody:nobody file's owner - # Will work when called by root/rc.sysinit - chown (0,0,"$Lang::CacheLang.$LG"); - chmod (0004,"$Lang::CacheLang.$LG"); - return 0; -} - -# -# Switch Ipcop Language for each lang then call build cachelang -# -sub BuildCacheLang { - - my $AddonDir = ${General::swroot}.'/addon-lang'; - - # Correct permission in case addon-installer did not do it - opendir (DIR, $AddonDir); - my @files = readdir (DIR); - foreach my $file (@files) { - next if (($file eq '..') || ($file eq '.')); - chown (0,0,"$AddonDir/$file"); - chmod (0004,"$AddonDir/$file"); - } - closedir (DIR); - - my $selected = '';; - my $missed = ''; - my $error = 0; - - open (LANGS, "${General::swroot}/langs/list"); - while (<LANGS>) { - ($selected) = split (':'); - if (&BuildUniqueCacheLang ($selected) == 1) { - $missed = $selected; # will try latter. Can only be the current cachelang file locked - }; - } - close (LANGS); - - if ($missed) { # collision with current cache lang being used ? - $error = &BuildUniqueCacheLang ($missed); - } - - &General::log ("WARNING: cannot build cachelang file for [$missed].") if ($error); - return $error; -} 1; Modified: ipcop/trunk/config/rootfiles/arch_i486/perl =================================================================== --- ipcop/trunk/config/rootfiles/arch_i486/perl 2007-11-14 21:31:34 UTC (rev 713) +++ ipcop/trunk/config/rootfiles/arch_i486/perl 2007-11-14 21:49:50 UTC (rev 714) @@ -220,7 +220,7 @@ usr/lib/perl5/5.8.8/I18N/Collate.pm #usr/lib/perl5/5.8.8/I18N/LangTags usr/lib/perl5/5.8.8/I18N/LangTags.pm -#usr/lib/perl5/5.8.8/I18N/LangTags/Detect.pm +usr/lib/perl5/5.8.8/I18N/LangTags/Detect.pm usr/lib/perl5/5.8.8/I18N/LangTags/List.pm #usr/lib/perl5/5.8.8/IO #usr/lib/perl5/5.8.8/IO/Socket @@ -241,11 +241,11 @@ #usr/lib/perl5/5.8.8/Locale/Language.pm #usr/lib/perl5/5.8.8/Locale/Language.pod #usr/lib/perl5/5.8.8/Locale/Maketext -#usr/lib/perl5/5.8.8/Locale/Maketext.pm -#usr/lib/perl5/5.8.8/Locale/Maketext.pod -#usr/lib/perl5/5.8.8/Locale/Maketext/Guts.pm -#usr/lib/perl5/5.8.8/Locale/Maketext/GutsLoader.pm -#usr/lib/perl5/5.8.8/Locale/Maketext/TPJ13.pod +usr/lib/perl5/5.8.8/Locale/Maketext.pm +usr/lib/perl5/5.8.8/Locale/Maketext.pod +usr/lib/perl5/5.8.8/Locale/Maketext/Guts.pm +usr/lib/perl5/5.8.8/Locale/Maketext/GutsLoader.pm +usr/lib/perl5/5.8.8/Locale/Maketext/TPJ13.pod #usr/lib/perl5/5.8.8/Locale/Script.pm #usr/lib/perl5/5.8.8/Locale/Script.pod #usr/lib/perl5/5.8.8/Math Added: ipcop/trunk/config/rootfiles/common/Locale-Maketext-Gettext =================================================================== --- ipcop/trunk/config/rootfiles/common/Locale-Maketext-Gettext (rev 0) +++ ipcop/trunk/config/rootfiles/common/Locale-Maketext-Gettext 2007-11-14 21:49:50 UTC (rev 714) @@ -0,0 +1,13 @@ +# Locale-Maketext-Gettext 1.22 +# +#usr/bin/maketext +#usr/lib/perl5/site_perl/5.8.8/Locale +usr/lib/perl5/site_perl/5.8.8/Locale/Maketext +usr/lib/perl5/site_perl/5.8.8/Locale/Maketext/Gettext +usr/lib/perl5/site_perl/5.8.8/Locale/Maketext/Gettext.pm +usr/lib/perl5/site_perl/5.8.8/Locale/Maketext/Gettext/Functions.pm +#usr/lib/perl5/site_perl/5.8.8/i486-linux/auto/Locale-Maketext-Gettext +usr/lib/perl5/site_perl/5.8.8/MACHINE-linux/auto/Locale-Maketext-Gettext/.packlist +#usr/share/man/man1/maketext.1 +#usr/share/man/man3/Locale::Maketext::Gettext.3 +#usr/share/man/man3/Locale::Maketext::Gettext::Functions.3 Modified: ipcop/trunk/config/rootfiles/common/apache =================================================================== --- ipcop/trunk/config/rootfiles/common/apache 2007-11-14 21:31:34 UTC (rev 713) +++ ipcop/trunk/config/rootfiles/common/apache 2007-11-14 21:49:50 UTC (rev 714) @@ -158,6 +158,7 @@ home/httpd/html/images/header_left.png home/httpd/html/images/header_dyn.png home/httpd/html/images/header_right.png +home/httpd/html/images/header_top.png home/httpd/html/images/info.gif home/httpd/html/images/input.gif home/httpd/html/images/inputadv.gif Modified: ipcop/trunk/config/rootfiles/common/ipcop =================================================================== --- ipcop/trunk/config/rootfiles/common/ipcop 2007-11-14 21:31:34 UTC (rev 713) +++ ipcop/trunk/config/rootfiles/common/ipcop 2007-11-14 21:49:50 UTC (rev 714) @@ -1,73 +1,3 @@ -usr/lib/locale/ -usr/share/locale/af_ZA/LC_MESSAGES/install.mo -usr/share/locale/af_ZA/LC_MESSAGES/ipcop.mo -usr/share/locale/bg_BG/LC_MESSAGES/install.mo -usr/share/locale/bg_BG/LC_MESSAGES/ipcop.mo -usr/share/locale/ca_ES/LC_MESSAGES/install.mo -usr/share/locale/ca_ES/LC_MESSAGES/ipcop.mo -usr/share/locale/cs_CZ/LC_MESSAGES/install.mo -usr/share/locale/cs_CZ/LC_MESSAGES/ipcop.mo -usr/share/locale/da_DK/LC_MESSAGES/install.mo -usr/share/locale/da_DK/LC_MESSAGES/ipcop.mo -usr/share/locale/de_DE/LC_MESSAGES/install.mo -usr/share/locale/de_DE/LC_MESSAGES/ipcop.mo -usr/share/locale/el_GR/LC_MESSAGES/install.mo -usr/share/locale/el_GR/LC_MESSAGES/ipcop.mo -usr/share/locale/en_GB/LC_MESSAGES/install.mo -usr/share/locale/en_GB/LC_MESSAGES/ipcop.mo -usr/share/locale/es_ES/LC_MESSAGES/install.mo -usr/share/locale/es_ES/LC_MESSAGES/ipcop.mo -usr/share/locale/es_UY/LC_MESSAGES/install.mo -usr/share/locale/es_UY/LC_MESSAGES/ipcop.mo -usr/share/locale/fa_IR/LC_MESSAGES/install.mo -usr/share/locale/fa_IR/LC_MESSAGES/ipcop.mo -usr/share/locale/fi_FI/LC_MESSAGES/install.mo -usr/share/locale/fi_FI/LC_MESSAGES/ipcop.mo -usr/share/locale/fr_FR/LC_MESSAGES/install.mo -usr/share/locale/fr_FR/LC_MESSAGES/ipcop.mo -usr/share/locale/gu_IN/LC_MESSAGES/install.mo -usr/share/locale/gu_IN/LC_MESSAGES/ipcop.mo -usr/share/locale/hu_HU/LC_MESSAGES/install.mo -usr/share/locale/hu_HU/LC_MESSAGES/ipcop.mo -usr/share/locale/it_IT/LC_MESSAGES/install.mo -usr/share/locale/it_IT/LC_MESSAGES/ipcop.mo -usr/share/locale/ja_JA/LC_MESSAGES/install.mo -usr/share/locale/ja_JA/LC_MESSAGES/ipcop.mo -usr/share/locale/lt_LT/LC_MESSAGES/install.mo -usr/share/locale/lt_LT/LC_MESSAGES/ipcop.mo -usr/share/locale/nl_NL/LC_MESSAGES/install.mo -usr/share/locale/nl_NL/LC_MESSAGES/ipcop.mo -usr/share/locale/no_NO/LC_MESSAGES/install.mo -usr/share/locale/no_NO/LC_MESSAGES/ipcop.mo -usr/share/locale/pl_PL/LC_MESSAGES/install.mo -usr/share/locale/pl_PL/LC_MESSAGES/ipcop.mo -usr/share/locale/pt_BR/LC_MESSAGES/install.mo -usr/share/locale/pt_BR/LC_MESSAGES/ipcop.mo -usr/share/locale/pt_PT/LC_MESSAGES/install.mo -usr/share/locale/pt_PT/LC_MESSAGES/ipcop.mo -usr/share/locale/ro_RO/LC_MESSAGES/install.mo -usr/share/locale/ro_RO/LC_MESSAGES/ipcop.mo -usr/share/locale/ru_RU/LC_MESSAGES/install.mo -usr/share/locale/ru_RU/LC_MESSAGES/ipcop.mo -usr/share/locale/sk_SK/LC_MESSAGES/install.mo -usr/share/locale/sk_SK/LC_MESSAGES/ipcop.mo -usr/share/locale/sl_SI/LC_MESSAGES/install.mo -usr/share/locale/sl_SI/LC_MESSAGES/ipcop.mo -usr/share/locale/sv_SE/LC_MESSAGES/install.mo -usr/share/locale/sv_SE/LC_MESSAGES/ipcop.mo -usr/share/locale/th_TH/LC_MESSAGES/install.mo -usr/share/locale/th_TH/LC_MESSAGES/ipcop.mo -usr/share/locale/tr_TR/LC_MESSAGES/install.mo -usr/share/locale/tr_TR/LC_MESSAGES/ipcop.mo -usr/share/locale/ur_PK/LC_MESSAGES/install.mo -usr/share/locale/ur_PK/LC_MESSAGES/ipcop.mo -usr/share/locale/vi_VN/LC_MESSAGES/install.mo -usr/share/locale/vi_VN/LC_MESSAGES/ipcop.mo -usr/share/locale/zh_CN/LC_MESSAGES/install.mo -usr/share/locale/zh_CN/LC_MESSAGES/ipcop.mo -usr/share/locale/zh_TW/LC_MESSAGES/install.mo -usr/share/locale/zh_TW/LC_MESSAGES/ipcop.mo -#var/ipcop/addon-lang var/log/dyndns var/log/fw_timeframe_log var/log/time Added: ipcop/trunk/config/rootfiles/common/ipcop-lang =================================================================== --- ipcop/trunk/config/rootfiles/common/ipcop-lang (rev 0) +++ ipcop/trunk/config/rootfiles/common/ipcop-lang 2007-11-14 21:49:50 UTC (rev 714) @@ -0,0 +1,73 @@ +# +# ipcop-lang +# +#var/ipcop/addon-lang +usr/lib/locale/ +usr/share/locale/af_ZA/LC_MESSAGES/install.mo +usr/share/locale/af_ZA/LC_MESSAGES/ipcop.mo +usr/share/locale/bg_BG/LC_MESSAGES/install.mo +usr/share/locale/bg_BG/LC_MESSAGES/ipcop.mo +usr/share/locale/ca_ES/LC_MESSAGES/install.mo +usr/share/locale/ca_ES/LC_MESSAGES/ipcop.mo +usr/share/locale/cs_CZ/LC_MESSAGES/install.mo +usr/share/locale/cs_CZ/LC_MESSAGES/ipcop.mo +usr/share/locale/da_DK/LC_MESSAGES/install.mo +usr/share/locale/da_DK/LC_MESSAGES/ipcop.mo +usr/share/locale/de_DE/LC_MESSAGES/install.mo +usr/share/locale/de_DE/LC_MESSAGES/ipcop.mo +usr/share/locale/el_GR/LC_MESSAGES/install.mo +usr/share/locale/el_GR/LC_MESSAGES/ipcop.mo +usr/share/locale/en_GB/LC_MESSAGES/install.mo +usr/share/locale/en_GB/LC_MESSAGES/ipcop.mo +usr/share/locale/es_ES/LC_MESSAGES/install.mo +usr/share/locale/es_ES/LC_MESSAGES/ipcop.mo +usr/share/locale/es_UY/LC_MESSAGES/install.mo +usr/share/locale/es_UY/LC_MESSAGES/ipcop.mo +usr/share/locale/fa_IR/LC_MESSAGES/install.mo +usr/share/locale/fa_IR/LC_MESSAGES/ipcop.mo +usr/share/locale/fi_FI/LC_MESSAGES/install.mo +usr/share/locale/fi_FI/LC_MESSAGES/ipcop.mo +usr/share/locale/fr_FR/LC_MESSAGES/install.mo +usr/share/locale/fr_FR/LC_MESSAGES/ipcop.mo +usr/share/locale/gu_IN/LC_MESSAGES/install.mo +usr/share/locale/gu_IN/LC_MESSAGES/ipcop.mo +usr/share/locale/hu_HU/LC_MESSAGES/install.mo +usr/share/locale/hu_HU/LC_MESSAGES/ipcop.mo +usr/share/locale/it_IT/LC_MESSAGES/install.mo +usr/share/locale/it_IT/LC_MESSAGES/ipcop.mo +usr/share/locale/ja_JA/LC_MESSAGES/install.mo +usr/share/locale/ja_JA/LC_MESSAGES/ipcop.mo +usr/share/locale/lt_LT/LC_MESSAGES/install.mo +usr/share/locale/lt_LT/LC_MESSAGES/ipcop.mo +usr/share/locale/nl_NL/LC_MESSAGES/install.mo +usr/share/locale/nl_NL/LC_MESSAGES/ipcop.mo +usr/share/locale/no_NO/LC_MESSAGES/install.mo +usr/share/locale/no_NO/LC_MESSAGES/ipcop.mo +usr/share/locale/pl_PL/LC_MESSAGES/install.mo +usr/share/locale/pl_PL/LC_MESSAGES/ipcop.mo +usr/share/locale/pt_BR/LC_MESSAGES/install.mo +usr/share/locale/pt_BR/LC_MESSAGES/ipcop.mo +usr/share/locale/pt_PT/LC_MESSAGES/install.mo +usr/share/locale/pt_PT/LC_MESSAGES/ipcop.mo +usr/share/locale/ro_RO/LC_MESSAGES/install.mo +usr/share/locale/ro_RO/LC_MESSAGES/ipcop.mo +usr/share/locale/ru_RU/LC_MESSAGES/install.mo +usr/share/locale/ru_RU/LC_MESSAGES/ipcop.mo +usr/share/locale/sk_SK/LC_MESSAGES/install.mo +usr/share/locale/sk_SK/LC_MESSAGES/ipcop.mo +usr/share/locale/sl_SI/LC_MESSAGES/install.mo +usr/share/locale/sl_SI/LC_MESSAGES/ipcop.mo +usr/share/locale/sv_SE/LC_MESSAGES/install.mo +usr/share/locale/sv_SE/LC_MESSAGES/ipcop.mo +usr/share/locale/th_TH/LC_MESSAGES/install.mo +usr/share/locale/th_TH/LC_MESSAGES/ipcop.mo +usr/share/locale/tr_TR/LC_MESSAGES/install.mo +usr/share/locale/tr_TR/LC_MESSAGES/ipcop.mo +usr/share/locale/ur_PK/LC_MESSAGES/install.mo +usr/share/locale/ur_PK/LC_MESSAGES/ipcop.mo +usr/share/locale/vi_VN/LC_MESSAGES/install.mo +usr/share/locale/vi_VN/LC_MESSAGES/ipcop.mo +usr/share/locale/zh_CN/LC_MESSAGES/install.mo +usr/share/locale/zh_CN/LC_MESSAGES/ipcop.mo +usr/share/locale/zh_TW/LC_MESSAGES/install.mo +usr/share/locale/zh_TW/LC_MESSAGES/ipcop.mo Modified: ipcop/trunk/doc/make.sh-usage =================================================================== --- ipcop/trunk/doc/make.sh-usage 2007-11-14 21:31:34 UTC (rev 713) +++ ipcop/trunk/doc/make.sh-usage 2007-11-14 21:49:50 UTC (rev 714) @@ -23,5 +23,7 @@ files have been updated. Export IPCop sources in a .tgz othersrc : Build a .tgz with all source packages necessary to compile toolchain : Create our own toolchain package to speed next rebuild + language : Search for all lang entries in source, get translations from + lang DB and create .po files in langs/locale shell : Enter a shell inside the chroot, used to tune lfs script and / or during kernel upgrade to rebuild a new .config Modified: ipcop/trunk/html/html/images/header_dyn.png =================================================================== (Binary files differ) Modified: ipcop/trunk/html/html/images/header_left.png =================================================================== (Binary files differ) Modified: ipcop/trunk/html/html/images/header_right.png =================================================================== (Binary files differ) Added: ipcop/trunk/html/html/images/header_top.png =================================================================== (Binary files differ) Property changes on: ipcop/trunk/html/html/images/header_top.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: ipcop/trunk/html/html/images/sflogo.png =================================================================== (Binary files differ) Modified: ipcop/trunk/html/html/images/shieldedtux.png =================================================================== (Binary files differ) Modified: ipcop/trunk/html/html/include/ipcop.css =================================================================== --- ipcop/trunk/html/html/include/ipcop.css 2007-11-14 21:31:34 UTC (rev 713) +++ ipcop/trunk/html/html/include/ipcop.css 2007-11-14 21:49:50 UTC (rev 714) @@ -1,9 +1,7 @@ body { margin: 5px 0px 0px 0px; padding: 0px; - background: url(/images/header.png) no-repeat; background-color: #ffffff; - background-position: 0px 5px; color: #000000; font-family: Verdana, Tahoma, Arial, Sans-serif; font-size: 11px; Modified: ipcop/trunk/lfs/installer =================================================================== --- ipcop/trunk/lfs/installer 2007-11-14 21:31:34 UTC (rev 713) +++ ipcop/trunk/lfs/installer 2007-11-14 21:49:50 UTC (rev 714) @@ -68,10 +68,5 @@ cd $(DIR_APP) && install -m 0755 installer $(INSTALLER_DIR)/initrd/bin cd $(DIR_APP) && install -m 0755 setup /usr/local/sbin - #cd $(DIR_SRC)/langs && for LANGS in *_*; do \ - # mkdir -p $(INSTALLER_DIR)/initrd/share/locale/$$LANGS/LC_MESSAGES; \ - # msgfmt $$LANGS/install.po -o $(INSTALLER_DIR)/initrd/share/locale/$$LANGS/LC_MESSAGES/install.mo; \ - # done; - @rm -rf $(DIR_APP) # yes we want it rebuilt at each time, so no POSTBUILD Modified: ipcop/trunk/lfs/ipcop =================================================================== --- ipcop/trunk/lfs/ipcop 2007-11-14 21:31:34 UTC (rev 713) +++ ipcop/trunk/lfs/ipcop 2007-11-14 21:49:50 UTC (rev 714) @@ -61,7 +61,7 @@ # Create all directories for i in addon-lang alcatelusb auth backup ca certs cnx_pci crls ddns dhcp dhcpc dmzholes \ - eagle-usb eciadsl ethernet firewall firmware isdn key langs locale logging main modem optionsfw \ + eagle-usb eciadsl ethernet firewall firmware isdn key logging main modem optionsfw \ patches portfw ppp private proxy red remote shaping snort time vpn wireless xtaccess ; do \ mkdir -p $(CONFIG_ROOT)/$$i; \ done @@ -114,7 +114,6 @@ cp $(DIR_SRC)/config/cfgroot/firewall-lib.pl $(CONFIG_ROOT)/firewall/ cp $(DIR_SRC)/config/cfgroot/icmptypes $(CONFIG_ROOT)/firewall/ cp $(DIR_SRC)/config/cfgroot/protocols.pl $(CONFIG_ROOT)/firewall/ - cp $(DIR_SRC)/langs/list $(CONFIG_ROOT)/langs/ # Oneliner configfiles echo "ENABLED=off" > $(CONFIG_ROOT)/vpn/settings @@ -148,24 +147,11 @@ sed -i -e "s+CONFIG_ROOT+$(CONFIG_ROOT)+g" \ $(CONFIG_ROOT)/firewall/firewall-lib.pl - # Language files - for i in $(DIR_SRC)/langs/*/cgi-bin/*.pl ; do \ - cp $$i $(CONFIG_ROOT)/langs/; \ - done - - # Locale (en_GB for now), also add to locale-archive - for i in $(DIR_SRC)/langs/*_* ; do \ - mkdir -p /usr/share/locale/`basename $$i`/LC_MESSAGES; \ - msgfmt $$i/ipcop.po -o /usr/share/locale/`basename $$i`/LC_MESSAGES/ipcop.mo; \ - msgfmt $$i/install.po -o /usr/share/locale/`basename $$i`/LC_MESSAGES/install.mo; \ - localedef -i `basename $$i` -f UTF-8 `basename $$i.utf8` --no-archive; \ - done - # Configroot permissions chown -R nobody:nobody $(CONFIG_ROOT) chown root:root $(CONFIG_ROOT) - for i in backup/ header.pl general-functions.pl lang.pl addon-lang/ langs/ locale/ proxy/acl-1.4 red/ ; do \ + for i in backup/ header.pl general-functions.pl lang.pl addon-lang/ proxy/acl red/ ; do \ chown -R root:root $(CONFIG_ROOT)/$$i; \ done Added: ipcop/trunk/lfs/ipcop-lang =================================================================== --- ipcop/trunk/lfs/ipcop-lang (rev 0) +++ ipcop/trunk/lfs/ipcop-lang 2007-11-14 21:49:50 UTC (rev 714) @@ -0,0 +1,83 @@ +############################################################################### +# This file is part of the IPCop Firewall. # +# # +# IPCop is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# IPCop is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with IPCop; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +# Makefiles are based on LFSMake, which is # +# Copyright (C) 2002 Rod Roard <ro...@su...> # +# # +# Modifications by: # +# ??-12-2003 Mark Wormgoor < ma...@wo...> # +# - Modified Makefile for IPCop build # +# # +# $Id: stage5 2 2007-04-07 18:46:27Z mark $ +# # +############################################################################### + +############################################################################### +# Definitions +############################################################################### + +include Config + +PKG_NAME = ipcop-lang +HOST_ARCH = all +OTHER_SRC = no + +THISAPP = ipcop-lang +TARGET = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP) + +############################################################################### +# Top-level Rules +############################################################################### + +install : $(TARGET) + +check : + +download : + +md5 : + +############################################################################### +# Installation Details +############################################################################### + +$(TARGET) : $(firstword $(MAKEFILE_LIST)) + @$(PREBUILD) + + # First, start clean by removing anything from previous runs ? + + mkdir -p $(CONFIG_ROOT)/langs + # List of translated languages + cp $(DIR_SRC)/langs/list $(CONFIG_ROOT)/langs/ + + # Language files (1.4 style) + # for i in $(DIR_SRC)/langs/*/cgi-bin/*.pl ; do \ + # cp $$i $(CONFIG_ROOT)/langs/; \ + # done + chown -R root:root $(CONFIG_ROOT)/langs + + # Locale (en_GB for now), also add to locale-archive + for i in $(DIR_SRC)/langs/*_* ; do \ + mkdir -p /usr/share/locale/`basename $$i`/LC_MESSAGES; \ + msgfmt $$i/ipcop.po -o /usr/share/locale/`basename $$i`/LC_MESSAGES/ipcop.mo; \ + msgfmt $$i/install.po -o /usr/share/locale/`basename $$i`/LC_MESSAGES/install.mo; \ + localedef -i `basename $$i` -f UTF-8 `basename $$i.utf8` --no-archive; \ + done + + # Locale files for installer are created later in initramfs + + @$(POSTBUILD) Added: ipcop/trunk/lfs/perl-gettext =================================================================== --- ipcop/trunk/lfs/perl-gettext (rev 0) +++ ipcop/trunk/lfs/perl-gettext 2007-11-14 21:49:50 UTC (rev 714) @@ -0,0 +1,91 @@ +############################################################################### +# This file is part of the IPCop Firewall. # +# # +# IPCop is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# IPCop is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with IPCop; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +# Makefiles are based on LFSMake, which is # +# Copyright (C) 2002 Rod Roard <ro...@su...> # +# # +# Modifications by: # +# ??-12-2003 Mark Wormgoor < ma...@wo...> # +# - Modified Makefile for IPCop build # +# # +# $Id: Digest-SHA1 329 2007-05-01 06:25:54Z chepati $ +# # +############################################################################### + +############################################################################### +# Definitions +############################################################################### + +include Config + +PKG_NAME = perl-gettext +VER = 1.22 +HOST_ARCH = all +OTHER_SRC = yes + +THISAPP = Locale-Maketext-Gettext-$(VER) +DL_FILE = $(THISAPP).tar.gz +DL_FROM = $(URL_CPAN)/Locale +DIR_APP = $(DIR_SRC)/$(THISAPP) +TARGET = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP) + +############################################################################### +# Top-level Rules +############################################################################### + +objects = $(DL_FILE) + +$(DL_FILE) = $(DL_FROM)/$(DL_FILE) + +$(DL_FILE)_MD5 = 322e4d4726aa7f36f1c3f12696ebb873 + +install : $(TARGET) + +check : $(patsubst %,$(DIR_CHK)/%,$(objects)) + +download :$(patsubst %,$(DIR_DL)/%,$(objects)) + +md5 : $(subst %,%_MD5,$(objects)) + +############################################################################### +# Downloading, checking, md5sum +############################################################################### + +$(patsubst %,$(DIR_CHK)/%,$(objects)) : + @$(CHECK) + +$(patsubst %,$(DIR_DL)/%,$(objects)) : + @$(LOAD) + +$(subst %,%_MD5,$(objects)) : + @$(MD5) + +############################################################################### +# Installation Details +############################################################################### + +$(TARGET) : $(firstword $(MAKEFILE_LIST)) $(patsubst %,$(DIR_DL)/%,$(objects)) + @$(PREBUILD) + @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE) + + cd $(DIR_APP) && sed -i "s%,'y'%,'n'%" Makefile.PL + cd $(DIR_APP) && yes 'n' | perl Makefile.PL + cd $(DIR_APP) && make + cd $(DIR_APP) && make install + + @rm -rf $(DIR_APP) + @$(POSTBUILD) Modified: ipcop/trunk/make.sh =================================================================== --- ipcop/trunk/make.sh 2007-11-14 21:31:34 UTC (rev 713) +++ ipcop/trunk/make.sh 2007-11-14 21:49:50 UTC (rev 714) @@ -1201,6 +1201,7 @@ chroot_make oinkmaster chroot_make openssh chroot_make openswan + chroot_make perl-gettext chroot_make pptp chroot_make pkg-config chroot_make cgilib @@ -1245,6 +1246,7 @@ chroot_make newt chroot_make hwinfo chroot_make busybox + chroot_make ipcop-lang chroot_make stage4 } # End of misc_build() @@ -1697,6 +1699,9 @@ fi fi ;; +language) + $BASEDIR/tools/gen_strings.pl $BASEDIR langs/ + ;; *) echo "Usage: $0 {build|changelog|check|checkclean|clean|dist|getothersrc|gettoolchain|othersrc|prefetch|shell|toolchain}" cat doc/make.sh-usage Modified: ipcop/trunk/src/installer/language.c =================================================================== --- ipcop/trunk/src/installer/language.c 2007-11-14 21:31:34 UTC (rev 713) +++ ipcop/trunk/src/installer/language.c 2007-11-14 21:49:50 UTC (rev 714) @@ -140,7 +140,6 @@ mysystem("/bin/setfont lat0-16"); strcpy(selected_locale, install_locale[choice]); - strcat(selected_locale, ".utf8"); /* setlocale(LC_MESSAGES, selected_locale); bindtextdomain("install", "/usr/share/locale"); Modified: ipcop/trunk/src/installer/setup.c =================================================================== --- ipcop/trunk/src/installer/setup.c 2007-11-14 21:31:34 UTC (rev 713) +++ ipcop/trunk/src/installer/setup.c 2007-11-14 21:49:50 UTC (rev 714) @@ -61,10 +61,14 @@ read_kv_from_file(&kv, CONFIG_ROOT "/main/settings"); strcpy(selected_locale, "en_GB"); find_kv_default(kv, "LOCALE", selected_locale); + /* We store locale as en_GB not as en_GB.utf8 in settings + append .utf8 to make setlocale happy. + */ + strcat(selected_locale, ".utf8"); - setlocale(LC_ALL, selected_locale); bindtextdomain("install", "/usr/share/locale"); textdomain("install"); + setlocale(LC_ALL, selected_locale); menuchoices[0] = gettext("TR_KEYBOARD_MAPPING"); menuchoices[1] = gettext("TR_TIMEZONE"); Modified: ipcop/trunk/tools/gen_strings.pl =================================================================== --- ipcop/trunk/tools/gen_strings.pl 2007-11-14 21:31:34 UTC (rev 713) +++ ipcop/trunk/tools/gen_strings.pl 2007-11-14 21:49:50 UTC (rev 714) @@ -135,7 +135,8 @@ # fill tr_en hash with english texts which are used print "Load default (== English) lang entries:\n"; # For now load english file from cvs as the lang DB does not contain all lang entries yet. -do "../langs/en/cgi-bin/en.pl"; +do "$basedir/langs/en/cgi-bin/en.pl"; +# In real life we should be using this. #do "$targetdir/en_GB/en.pl.tmp"; for my $key ( sort (keys %tr) ) { @@ -224,8 +225,16 @@ else { # end of head comment: one single blank line and finished with comment + # add type and encoding info to .po file print FILE_PL "\n"; - print FILE_GT "\n"; + print FILE_GT <<END +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\\n" +"Content-Transfer-Encoding: 8bit\\n" + +END + ; last; } } @@ -235,12 +244,26 @@ for my $key ( sort (keys %tr_wanted) ) { my $value = $tr_trans{$key}; + my $po_value = $value; + $po_value =~ s+\\'+'+g; + $po_value =~ s+\\+\\\\+g; + $po_value =~ s+\"+\\\"+g; + my $po_value_en = $tr_en{$key}; + $po_value_en =~ s+\\'+'+g; + $po_value_en =~ s+\\+\\\\+g; + $po_value_en =~ s+\"+\\\"+g; + my $po_value_w = $tr_wanted{$key}; + $po_value_w =~ s+\\'+'+g; + $po_value_w =~ s+\\+\\\\+g; + $po_value_w =~ s+\"+\\\"+g; + if ($value) { + $value =~ s/'/\\'/g; print FILE_PL "'$key' => '$value',\n"; print FILE_GT "msgid \"$key\"\n"; - print FILE_GT "msgstr \"$value\"\n"; + print FILE_GT "msgstr \"$po_value\"\n"; } elsif($tr_en{$key}) { @@ -253,7 +276,7 @@ print FILE_MISS "'$key' => '$tr_en{$key}',\n"; print FILE_GT "#### UNTRANSLATED:\n"; print FILE_GT "msgid \"$key\"\n"; - print FILE_GT "msgstr \"$tr_en{$key}\"\n"; + print FILE_GT "msgstr \"$po_value_en\"\n"; } else { @@ -265,7 +288,7 @@ print FILE_MISS "'$key' => '$tr_wanted{$key}',\n"; print FILE_GT "#### UNTRANSLATED:\n"; print FILE_GT "msgid \"$key\"\n"; - print FILE_GT "msgstr \"$tr_wanted{$key}\"\n"; + print FILE_GT "msgstr \"$po_value_w\"\n"; } } close(FILE_PL); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |