From patchwork Wed Nov 8 22:14:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Fischer X-Patchwork-Id: 1525 Return-Path: Received: from mail01.ipfire.org (unknown [172.28.1.200]) by web02.ipfire.org (Postfix) with ESMTP id 638BB61281 for ; Wed, 8 Nov 2017 12:15:37 +0100 (CET) Received: from mail01.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id EB802353E; Wed, 8 Nov 2017 12:15:36 +0100 (CET) Received: from Devel.localdomain (p5B0A3944.dip0.t-ipconnect.de [91.10.57.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 8DE96353E for ; Wed, 8 Nov 2017 12:14:18 +0100 (CET) From: Matthias Fischer To: development@lists.ipfire.org Subject: [PATCH] Some cosmetics for 'lang.pl' Date: Wed, 8 Nov 2017 12:14:14 +0100 Message-Id: <20171108111414.32230-1-matthias.fischer@ipfire.org> X-Mailer: git-send-email 2.15.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Found by chance: Fixed and removed some typos, some trailing spaces/tabs/identations. Best, Matthias Signed-off-by: Matthias Fischer --- config/cfgroot/lang.pl | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/config/cfgroot/lang.pl b/config/cfgroot/lang.pl index 2b09c4a9f..390dc5ab4 100644 --- a/config/cfgroot/lang.pl +++ b/config/cfgroot/lang.pl @@ -15,17 +15,17 @@ use strict; ### A cache file to avoid long recalculation $Lang::CacheLang = '/var/ipfire/langs/cache-lang.pl'; -# When you want to add your own language strings/entries to the ipcop language file, +# When you want to add your own language strings/entries to the language file, # you should create a file with ..pl into CONFIG_ROOT/addon-lang dir -# is free choosable but should be significant. An Example might be "myAddnName" -# 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 +# PREFIX> is free choosable but should be significant. An example might be "myAddnName" +# 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 +# 'key1' => 'value', # add all your entries key/values here # 'key2' => 'value' # and end with (of course without the leading #): #); # --------- CODE END--------- @@ -47,7 +47,7 @@ $language = $settings{'LANGUAGE'}; # # Load requested language file from cachefile. If cachefile doesn't exist, build on the fly. -# (it is a developper options) +# (it is a developer option) # sub reload { my $LG = &FindWebLanguage(shift); @@ -56,12 +56,12 @@ sub reload { # 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 ? + ##fix: need to put a lock_shared on it in case rebuild is active? do "$Lang::CacheLang.$LG"; - #&General::log ("cachelang file used [$LG]"); + #&General::log ("cachelang file used [$LG]"); return; } - + #&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'); @@ -80,20 +80,20 @@ sub reload { # read again, overwriting 'en' with choosed lang if ($LG ne 'en') { foreach my $file (grep (/.*\.$LG\.pl$/,@files) ) { - do "$AddonDir/$file"; + do "$AddonDir/$file"; } } } # # Assume this procedure is called with enough privileges. -# Merge ipcop langage file + all other extension found in addon-lang +# Merge language 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; @@ -101,7 +101,7 @@ sub BuildUniqueCacheLang { # 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; @@ -112,7 +112,7 @@ sub BuildUniqueCacheLang { } print FILE ');'; close (FILE); - + # Make nobody:nobody file's owner # Will work when called by root/rc.sysinit chown (0,0,"$Lang::CacheLang.$LG"); @@ -121,12 +121,12 @@ sub BuildUniqueCacheLang { } # -# Switch Ipcop Language for each lang then call build cachelang +# Switch 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); @@ -140,7 +140,7 @@ sub BuildCacheLang { my $selected = '';; my $missed = ''; my $error = 0; - + open (LANGS, "${General::swroot}/langs/list"); while () { ($selected) = split (':'); @@ -150,10 +150,10 @@ sub BuildCacheLang { } close (LANGS); - if ($missed) { # collision with current cache lang being used ? + 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; }