Permalink
Browse files

iswa names update

  • Loading branch information...
Slevinski committed May 17, 2012
1 parent 17bd52d commit 627bcd084c1587515ba22140fbd3f18fcce3aa24
Showing with 24 additions and 0 deletions.
  1. +5 −0 SWISTest.php
  2. +7 −0 database.php
  3. +12 −0 filesystem.php
View
@@ -995,5 +995,10 @@ public function test_id2key(){
public function test_key2id(){
$this->assertEquals('01-01-001-01-01-01',key2id('S10000',1));
}
+
+ //! @ingroup spl
+ public function test_iswaName(){
+ $this->assertEquals('Hands',iswaName("01","en"));
+ }
}
?>
View
@@ -112,6 +112,13 @@ function key2id($key,$force){
return sprintf("%02d-%02d-%03d-%02d-%02d-%02d",$row[0],$row[1],$row[2],$row[3],$ifill, $irot);
}
+function iswaName($id,$lang="en"){
+ global $iswa_db;
+ $query = 'select name from iswa_name where key = "' . $id . '" and lang = "' . $lang . '"';
+ $row = $iswa_db->query($query)->fetch();
+ return $row[0];
+}
+
function image_png($key,$ver){
global $iswa_db;
$code = key2code($key);
View
@@ -136,6 +136,18 @@ function key2id($key,$force){
return $sym . '-0' . $ifill . '-' . $srot;
}
+$messages = array();
+function load_iswaNames(){
+ global $messages;
+ include('iswa/data/iswa.i18n.php');
+}
+
+function iswaName($id, $lang='en'){
+ global $messages;
+ if (count($messages)==0) load_iswaNames();
+ return $messages[$lang]['iswa_' . $id];
+}
+
function image_png($key,$ver){
$base = substr($key,0,3);
$file = 'iswa/png' . $ver . '/' . $base . '/' . $key . '.png';

0 comments on commit 627bcd0

Please sign in to comment.