diff options
author | Antonio Gallo <tonicucoz@gmail.com> | 2011-03-08 00:35:15 +0000 |
---|---|---|
committer | Antonio Gallo <tonicucoz@gmail.com> | 2011-03-08 00:35:15 +0000 |
commit | c6e6d09dba4bb4807e5c6b4f8d23954019c6b38d (patch) | |
tree | 1f76db45c866ba8fe8840b4cea609ca72d375610 /h-source/Application | |
parent | 27670aeb2ccd579751bdb15412aab4108597ae87 (diff) |
improved languages.php
Diffstat (limited to 'h-source/Application')
-rw-r--r-- | h-source/Application/Include/languages.php | 250 | ||||
-rw-r--r-- | h-source/Application/Include/myFunctions.php | 18 | ||||
-rw-r--r-- | h-source/Application/Views/top_left.php | 34 |
3 files changed, 130 insertions, 172 deletions
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 @@ <?php if (strcmp($this->action,'view') === 0) { ?> <div class="notebook_view_title"> - Specifications of the <?php echo MyStrings::$view[$lang][$this->controller]['element'];?> <b><?php echo $ne_name;?></b> + Specifications of the <?php echo singular($this->controller);?> <b><?php echo $ne_name;?></b> </div> <div class="notebook_insert_link"> <div class="view_page_back_button"> - <a title="Back to the list of <?php echo MyStrings::$view[$lang][$this->controller]['element'];?>s" href="<?php echo $this->baseUrl."/".$this->controller."/catalogue/$lang".$this->viewStatus;?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a> + <a title="Back to the list of <?php echo plural($this->controller);?>" href="<?php echo $this->baseUrl."/".$this->controller."/catalogue/$lang".$this->viewStatus;?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a> </div> <div class="view_page_history_button"> @@ -62,21 +62,21 @@ <?php } else if (strcmp($this->action,'catalogue') === 0) { ?> <div class="notebook_view_title"> - List of <b><?php echo MyStrings::$view[$lang][$this->controller]['element'];?>s</b> in the archive + List of <b><?php echo plural($this->controller);?></b> in the archive </div> <div class="notebook_insert_link"> - <a title="Insert a new <?php echo MyStrings::$view[$lang][$this->controller]['element'];?>" href="<?php echo $this->baseUrl."/".$this->controller."/insert/$lang/$token".$this->viewStatus;?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/new-60.png"></a> + <a title="Insert a new <?php echo singular($this->controller);?>" href="<?php echo $this->baseUrl."/".$this->controller."/insert/$lang/$token".$this->viewStatus;?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/new-60.png"></a> </div> <?php } else if (strcmp($this->action,'history') === 0) { ?> <div class="notebook_view_title"> - History of the <?php echo MyStrings::$view[$lang][$this->controller]['element'].' <b>'.$ne_name.'</b>';?> + History of the <?php echo singular($this->controller).' <b>'.$ne_name.'</b>';?> </div> <div class="notebook_insert_link"> - <a title="Back to the specifications of the <?php echo MyStrings::$view[$lang][$this->controller]['element'].' '.$name;?>" href="<?php echo $this->baseUrl."/".$this->controller."/view/$lang/$id/$name".$this->viewStatus;?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a> + <a title="Back to the specifications of the <?php echo singular($this->controller).' '.$name;?>" href="<?php echo $this->baseUrl."/".$this->controller."/view/$lang/$id/$name".$this->viewStatus;?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a> </div> <?php } else if (strcmp($this->action,'differences') === 0) { ?> @@ -88,57 +88,57 @@ <?php } ?> <div class="notebook_insert_link"> - <a title="Back to the history of the <?php echo MyStrings::$view[$lang][$this->controller]['element'];?> <?php echo $name;?>" href="<?php echo $this->baseUrl."/".$this->controller."/history/$lang/$id_hard".$this->viewStatus;?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a> + <a title="Back to the history of the <?php echo singular($this->controller);?> <?php echo $name;?>" href="<?php echo $this->baseUrl."/".$this->controller."/history/$lang/$id_hard".$this->viewStatus;?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a> </div> <?php } else if (strcmp($this->action,'climb') === 0) { ?> <div class="notebook_view_title"> - Make current this revision of the <?php echo MyStrings::$view[$lang][$this->controller]['element'].' <b>'.$ne_name.'</b>';?> + Make current this revision of the <?php echo singular($this->controller).' <b>'.$ne_name.'</b>';?> </div> <div class="notebook_insert_link"> - <a title="Back to the history of the <?php echo MyStrings::$view[$lang][$this->controller]['element'];?> <?php echo $name;?>" href="<?php echo $this->baseUrl."/".$this->controller."/history/$lang/$id_hard".$this->viewStatus;?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a> + <a title="Back to the history of the <?php echo singular($this->controller);?> <?php echo $name;?>" href="<?php echo $this->baseUrl."/".$this->controller."/history/$lang/$id_hard".$this->viewStatus;?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a> </div> <?php } else if (strcmp($this->action,'revision') === 0) { ?> <div class="notebook_view_title"> - Revision of the <?php echo MyStrings::$view[$lang][$this->controller]['element'].' <b>'.$ne_name.'</b>';?> + Revision of the <?php echo singular($this->controller).' <b>'.$ne_name.'</b>';?> </div> <div class="notebook_insert_link"> - <a title="Back to the history of the <?php echo MyStrings::$view[$lang][$this->controller]['element'];?> <?php echo $name;?>" href="<?php echo $this->baseUrl."/".$this->controller."/history/$lang/$id_hard".$this->viewStatus;?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a> + <a title="Back to the history of the <?php echo singular($this->controller);?> <?php echo $name;?>" href="<?php echo $this->baseUrl."/".$this->controller."/history/$lang/$id_hard".$this->viewStatus;?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a> </div> <?php } else if (strcmp($this->action,'insert') === 0) { ?> <div class="notebook_view_title"> - Insert a new <?php echo MyStrings::$view[$lang][$this->controller]['element'];?> + Insert a new <?php echo singular($this->controller);?> </div> <div class="notebook_insert_link"> - <a title="Back to the list of <?php echo MyStrings::$view[$lang][$this->controller]['element'];?>s" href="<?php echo $this->baseUrl."/".$this->controller."/catalogue/$lang".$this->viewStatus;?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a> + <a title="Back to the list of <?php echo plural($this->controller);?>" href="<?php echo $this->baseUrl."/".$this->controller."/catalogue/$lang".$this->viewStatus;?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a> </div> <?php } else if (strcmp($this->action,'update') === 0) { ?> <div class="notebook_view_title"> - Edit the <?php echo MyStrings::$view[$lang][$this->controller]['element'].' <b>'.$ne_name.'</b>';?> + Edit the <?php echo singular($this->controller).' <b>'.$ne_name.'</b>';?> </div> <div class="notebook_insert_link"> - <a title="Back to the <?php echo MyStrings::$view[$lang][$this->controller]['element'];?> specifications" href="<?php echo $this->baseUrl."/".$this->controller."/view/$lang/".$id_hard."/$name".$this->viewStatus;?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a> + <a title="Back to the <?php echo singular($this->controller);?> specifications" href="<?php echo $this->baseUrl."/".$this->controller."/view/$lang/".$id_hard."/$name".$this->viewStatus;?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a> </div> <?php } else if (strcmp($this->action,'talk') === 0) { ?> <div class="notebook_view_title"> - Talk page of the <?php echo MyStrings::$view[$lang][$this->controller]['element'].' <b>'.$ne_name.'</b>';?> + Talk page of the <?php echo singular($this->controller).' <b>'.$ne_name.'</b>';?> </div> <div class="notebook_insert_link"> - <a title="Back to the <?php echo MyStrings::$view[$lang][$this->controller]['element'];?> specifications" href="<?php echo $this->baseUrl."/".$this->controller."/view/$lang/".$id_hard."/$name".$this->viewStatus;?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a> + <a title="Back to the <?php echo singular($this->controller);?> specifications" href="<?php echo $this->baseUrl."/".$this->controller."/view/$lang/".$id_hard."/$name".$this->viewStatus;?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a> </div> <?php } ?>
\ No newline at end of file |