From c6e6d09dba4bb4807e5c6b4f8d23954019c6b38d Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Tue, 8 Mar 2011 00:35:15 +0000 Subject: improved languages.php --- h-source/Application/Include/languages.php | 250 ++++++++++----------------- h-source/Application/Include/myFunctions.php | 18 ++ h-source/Application/Views/top_left.php | 34 ++-- 3 files changed, 130 insertions(+), 172 deletions(-) (limited to 'h-source') diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php index 675684e..a967ec0 100644 --- a/h-source/Application/Include/languages.php +++ b/h-source/Application/Include/languages.php @@ -532,7 +532,101 @@ class Lang "Download the h-node hardware database in xml format" => "Téléchargez la base de données matérielle de h-node au format XML", ), ); - + + public static $singular = array( + 'en' => array( + 'notebooks' => 'notebook', + 'wifi' => 'wifi card', + 'videocards' => 'video card', + 'printers' => 'printer', + 'scanners' => 'scanner', + 'threegcards' => '3G-card', + 'soundcards' => 'soundcard', + 'webcams' => 'webcam', + 'bluetooth' => 'bluetooth device', + ), + 'it' => array( + 'notebooks' => 'notebook', + 'wifi' => 'wifi card', + 'videocards' => 'video card', + 'printers' => 'printer', + 'scanners' => 'scanner', + 'threegcards' => '3G-card', + 'soundcards' => 'soundcard', + 'webcams' => 'webcam', + 'bluetooth' => 'bluetooth device', + ), + 'es' => array( + 'notebooks' => 'notebook', + 'wifi' => 'wifi card', + 'videocards' => 'video card', + 'printers' => 'printer', + 'scanners' => 'scanner', + 'threegcards' => '3G-card', + 'soundcards' => 'soundcard', + 'webcams' => 'webcam', + 'bluetooth' => 'bluetooth device', + ), + 'fr' => array( + 'notebooks' => 'notebook', + 'wifi' => 'wifi card', + 'videocards' => 'video card', + 'printers' => 'printer', + 'scanners' => 'scanner', + 'threegcards' => '3G-card', + 'soundcards' => 'soundcard', + 'webcams' => 'webcam', + 'bluetooth' => 'bluetooth device', + ), + ); + + public static $plural = array( + 'en' => array( + 'notebooks' => 'notebooks', + 'wifi' => 'wifi cards', + 'videocards' => 'video cards', + 'printers' => 'printers', + 'scanners' => 'scanners', + 'threegcards' => '3G-cards', + 'soundcards' => 'soundcards', + 'webcams' => 'webcams', + 'bluetooth' => 'bluetooth devices', + ), + 'it' => array( + 'notebooks' => 'notebooks', + 'wifi' => 'wifi cards', + 'videocards' => 'video cards', + 'printers' => 'printers', + 'scanners' => 'scanners', + 'threegcards' => '3G-cards', + 'soundcards' => 'soundcards', + 'webcams' => 'webcams', + 'bluetooth' => 'bluetooth devices', + ), + 'es' => array( + 'notebooks' => 'notebooks', + 'wifi' => 'wifi cards', + 'videocards' => 'video cards', + 'printers' => 'printers', + 'scanners' => 'scanners', + 'threegcards' => '3G-cards', + 'soundcards' => 'soundcards', + 'webcams' => 'webcams', + 'bluetooth' => 'bluetooth devices', + ), + 'fr' => array( + 'notebooks' => 'notebooks', + 'wifi' => 'wifi cards', + 'videocards' => 'video cards', + 'printers' => 'printers', + 'scanners' => 'scanners', + 'threegcards' => '3G-cards', + 'soundcards' => 'soundcards', + 'webcams' => 'webcams', + 'bluetooth' => 'bluetooth devices', + ), + ); + public static function sanitize($lang = 'en') { return (in_array($lang,self::$allowed)) ? sanitizeAll($lang) : 'en'; @@ -566,161 +660,7 @@ class MyStrings { public static $view = array( - - 'en' => array( - 'notebooks' => array( - 'element' => 'notebook' - ), - - 'wifi' => array( - 'element' => 'wifi card' - ), - - 'videocards'=> array( - 'element' => 'video card' - ), - - 'printers'=> array( - 'element' => 'printer' - ), - - 'scanners'=> array( - 'element' => 'scanner' - ), - - 'threegcards' => array( - 'element' => '3G-card', - ), - - 'soundcards' => array( - 'element' => 'sound card', - ), - - 'webcams' => array( - 'element' => 'webcam', - ), - - 'bluetooth' => array( - 'element' => 'bluetooth', - ), - ), - - 'fr' => array( - - 'notebooks' => array( - 'element' => 'notebook' - ), - - 'wifi' => array( - 'element' => 'wifi card' - ), - - 'videocards'=> array( - 'element' => 'video card' - ), - - 'printers'=> array( - 'element' => 'printer' - ), - - 'scanners'=> array( - 'element' => 'scanner' - ), - - 'threegcards' => array( - 'element' => '3G-card', - ), - - 'soundcards' => array( - 'element' => 'sound card', - ), - - 'webcams' => array( - 'element' => 'webcam', - ), - - 'bluetooth' => array( - 'element' => 'bluetooth', - ), - ), - - 'it' => array( - - 'notebooks' => array( - 'element' => 'notebook' - ), - - 'wifi' => array( - 'element' => 'wifi card' - ), - - 'videocards'=> array( - 'element' => 'video card' - ), - - 'printers'=> array( - 'element' => 'printer' - ), - - 'scanners'=> array( - 'element' => 'scanner' - ), - 'threegcards' => array( - 'element' => '3G-card', - ), - - 'soundcards' => array( - 'element' => 'sound card', - ), - - 'webcams' => array( - 'element' => 'webcam', - ), - - 'bluetooth' => array( - 'element' => 'bluetooth', - ), - ), - - 'es' => array( - - 'notebooks' => array( - 'element' => 'notebook' - ), - - 'wifi' => array( - 'element' => 'wifi card' - ), - - 'videocards'=> array( - 'element' => 'video card' - ), - - 'printers'=> array( - 'element' => 'printer' - ), - - 'scanners'=> array( - 'element' => 'scanner' - ), - - 'threegcards' => array( - 'element' => '3G-card', - ), - - 'soundcards' => array( - 'element' => 'sound card', - ), - - 'webcams' => array( - 'element' => 'webcam', - ), - - 'bluetooth' => array( - 'element' => 'bluetooth', - ), - ), ); //type => controller diff --git a/h-source/Application/Include/myFunctions.php b/h-source/Application/Include/myFunctions.php index cdb5358..4d01851 100644 --- a/h-source/Application/Include/myFunctions.php +++ b/h-source/Application/Include/myFunctions.php @@ -386,6 +386,24 @@ function gtext($string) return $string; } +function singular($string) +{ + if (isset(Lang::$singular[Lang::$current][$string])) + { + return Lang::$singular[Lang::$current][$string]; + } + return $string; +} + +function plural($string) +{ + if (isset(Lang::$plural[Lang::$current][$string])) + { + return Lang::$plural[Lang::$current][$string]; + } + return $string; +} + //rewrite the vendor name function betterVendor($string) { diff --git a/h-source/Application/Views/top_left.php b/h-source/Application/Views/top_left.php index f068d11..2f67c3d 100644 --- a/h-source/Application/Views/top_left.php +++ b/h-source/Application/Views/top_left.php @@ -29,12 +29,12 @@ action,'view') === 0) { ?>
- Specifications of the controller]['element'];?> + Specifications of the controller);?>