diff options
author | momo-i <webmaster@momo-i.org> | 2011-12-27 15:30:25 +0900 |
---|---|---|
committer | momo-i <webmaster@momo-i.org> | 2011-12-27 15:30:25 +0900 |
commit | 95620b40a19cf180babcbf1798ff5fdae36ecb75 (patch) | |
tree | 10141d5e4d7d5bb1f87ca8698847e3dafce90fcf | |
parent | 9f491c064ab3f593f887b9da427529397b3fc53c (diff) | |
download | ampache-95620b40a19cf180babcbf1798ff5fdae36ecb75.tar.gz ampache-95620b40a19cf180babcbf1798ff5fdae36ecb75.tar.bz2 ampache-95620b40a19cf180babcbf1798ff5fdae36ecb75.zip |
Fixed messages translatable.
-rw-r--r-- | lib/class/api.class.php | 6 | ||||
-rw-r--r-- | lib/class/catalog.class.php | 24 | ||||
-rw-r--r-- | lib/class/config.class.php | 2 | ||||
-rw-r--r-- | lib/class/radio.class.php | 2 | ||||
-rw-r--r-- | lib/install.php | 29 |
5 files changed, 32 insertions, 31 deletions
diff --git a/lib/class/api.class.php b/lib/class/api.class.php index 2c0fd01c..61b071f6 100644 --- a/lib/class/api.class.php +++ b/lib/class/api.class.php @@ -132,7 +132,7 @@ class Api { if (intval($version) < self::$version) { debug_event('API', 'Login Failed: version too old', 1); - Error::add('api', 'Login Failed: version too old'); + Error::add('api', _('Login Failed: version too old')); return false; } @@ -140,7 +140,7 @@ class Api { if (($timestamp < (time() - 1800)) || ($timestamp > (time() + 1800))) { debug_event('API', 'Login Failed: timestamp out of range', 1); - Error::add('api', 'Login Failed: timestamp out of range'); + Error::add('api', _('Login Failed: timestamp out of range')); return false; } @@ -169,7 +169,7 @@ class Api { if (!$row['password']) { debug_event('API', 'Unable to find user with userid of ' . $user_id, 1); - Error::add('api','Invalid Username/Password'); + Error::add('api', _('Invalid Username/Password')); return false; } diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index f7783454..f4ff7be7 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -276,7 +276,7 @@ class Catalog extends database_object { // Make sure the path is readable/exists if (!is_readable($data['path']) AND $data['type'] == 'local') { - Error::add('general','Error: ' . scrub_out($data['path']) . ' is not readable or does not exist'); + Error::add('general', sprintf(_('Error: %s is not readable or does not exist'), scrub_out($data['path']))); return false; } @@ -285,7 +285,7 @@ class Catalog extends database_object { $db_results = Dba::read($sql); if (Dba::num_rows($db_results)) { - Error::add('general','Error: Catalog with ' . $path . ' already exists'); + Error::add('general', sprintf(_('Error: Catalog with %s already exists'), $path)); return false; } @@ -312,7 +312,7 @@ class Catalog extends database_object { $insert_id = Dba::insert_id(); if (!$insert_id) { - Error::add('general','Catalog Insert Failed check debug logs'); + Error::add('general', _('Catalog Insert Failed check debug logs')); debug_event('catalog','SQL Failed:' . $sql,'3'); return false; } @@ -496,14 +496,14 @@ class Catalog extends database_object { if (!is_resource($handle)) { debug_event('read', "Unable to open $path", 5,'ampache-catalog'); - Error::add('catalog_add',_('Error: Unable to open') . ' ' . $path); + Error::add('catalog_add', sprintf(_('Error: Unable to open %s'), $path)); return false; } /* Change the dir so is_dir works correctly */ if (!chdir($path)) { debug_event('read', "Unable to chdir $path", 2,'ampache-catalog'); - Error::add('catalog_add',_('Error: Unable to change to directory') . ' ' . $path); + Error::add('catalog_add', sprintf(_('Error: Unable to change to directory %s'), $path)); return false; } @@ -549,7 +549,7 @@ class Catalog extends database_object { /* Change the dir so is_dir works correctly */ if (!chdir($path)) { debug_event('read',"Unable to chdir $path",'2','ampache-catalog'); - Error::add('catalog_add',_('Error: Unable to change to directory') . ' ' . $path); + Error::add('catalog_add', sprintf(_('Error: Unable to change to directory %s'), $path)); } /* Skip to the next file */ @@ -586,7 +586,7 @@ class Catalog extends database_object { if (!$file_size) { debug_event('read',"Unable to get filesize for $full_file",'2','ampache-catalog'); /* HINT: FullFile */ - Error::add('catalog_add',sprintf(_('Error: Unable to get filesize for %s'), $full_file)); + Error::add('catalog_add', sprintf(_('Error: Unable to get filesize for %s'), $full_file)); } // file_size check if (!is_readable($full_file)) { @@ -1462,7 +1462,7 @@ class Catalog extends database_object { $file_info = filesize($results['file']); if (!file_exists($results['file']) || $file_info < 1) { debug_event('clean', 'File not found or empty: ' . $results['file'], 5, 'ampache-catalog'); - Error::add('general',_('Error File Not Found or 0 Bytes:') . $results['file']); + Error::add('general', sprintf(_('Error File Not Found or 0 Bytes: %s'), $results['file'])); // Store it in an array we'll delete it later... @@ -1479,7 +1479,7 @@ class Catalog extends database_object { if ($file_info == false) { /* Add Error */ - Error::add('general',_('Error Remote File Not Found or 0 Bytes:') . $results['file']); + Error::add('general', sprintf(_('Error Remote File Not Found or 0 Bytes: %s'), $results['file'])); // Store it in an array we'll delete it later... @@ -1895,7 +1895,7 @@ class Catalog extends database_object { $sql = "UPDATE `artist` SET `mbid`='$mbid' WHERE `id`='$artist_id'"; $db_results = Dba::write($sql); if (!$db_results) { - Error::add('general',"Updating Artist: $artist"); + Error::add('general', sprintf(_('Updating Artist: %s'), $artist)); } } } @@ -1916,7 +1916,7 @@ class Catalog extends database_object { $artist_id = Dba::insert_id(); if (!$db_results) { - Error::add('general',"Inserting Artist:$artist"); + Error::add('general', sprintf(_('Inserting Artist: %s'), $artist)); } } // not found @@ -2096,7 +2096,7 @@ class Catalog extends database_object { if (!$db_results) { debug_event('insert',"Unable to insert $file -- $sql" . Dba::error(),'5','ampache-catalog'); - Error::add('catalog_add','SQL Error Adding ' . $file); + Error::add('catalog_add', sprintf(_('SQL Error Adding %s'), $file)); } $song_id = Dba::insert_id(); diff --git a/lib/class/config.class.php b/lib/class/config.class.php index 4ac45469..e12fdedc 100644 --- a/lib/class/config.class.php +++ b/lib/class/config.class.php @@ -109,7 +109,7 @@ class Config { public static function set($name, $value, $clobber = 0) { if (isset(self::$_global[$name]) && !$clobber) { - Error::add('Config Global',"Trying to clobber'$name' without setting clobber"); + Error::add('Config Global', sprintf(_('Trying to clobber \'%s\' without setting clobber'), $name)); return; } else { diff --git a/lib/class/radio.class.php b/lib/class/radio.class.php index b69f8a6e..46743614 100644 --- a/lib/class/radio.class.php +++ b/lib/class/radio.class.php @@ -144,7 +144,7 @@ class Radio extends database_object implements media { $elements = explode(":",$data['url']); if (!in_array($elements['0'],$allowed_array)) { - Error::add('url','Invalid URL must be http:// or https://'); + Error::add('url', _('Invalid URL must be http:// or https://')); } // Make sure it's a real catalog diff --git a/lib/install.php b/lib/install.php index 9c3b2c54..0513f5b7 100644 --- a/lib/install.php +++ b/lib/install.php @@ -123,7 +123,7 @@ function install_insert_db($username,$password,$hostname,$database,$dbuser=false $is_valid = preg_match("/([^\d\w\_\-])/",$database,$matches); if (count($matches)) { - Error::add('general','Error: Database name invalid must not be a reserved word, and must be Alphanumeric'); + Error::add('general',_('Error: Database name invalid must not be a reserved word, and must be Alphanumeric')); return false; } @@ -140,7 +140,7 @@ function install_insert_db($username,$password,$hostname,$database,$dbuser=false $dbh = Dba::dbh(); if (!is_resource($dbh)) { - Error::add('general',_('Error: Unable to make Database Connection') . " " . mysql_error()); + Error::add('general', sprintf(_('Error: Unable to make Database Connection %s'), mysql_error())); return false; } @@ -151,13 +151,13 @@ function install_insert_db($username,$password,$hostname,$database,$dbuser=false // Rien a faire, we've got the db just blow through } elseif ($db_selected && !$_POST['overwrite_db']) { - Error::add('general','Error: Database Already exists and Overwrite not checked'); + Error::add('general',_('Error: Database Already exists and Overwrite not checked')); return false; } elseif (!$db_selected) { $sql = "CREATE DATABASE `" . Dba::escape($database) . "`"; if (!$db_results = @mysql_query($sql, $dbh)) { - Error::add('general',"Error: Unable to Create Database " . mysql_error()); + Error::add('general',sprintf(_('Error: Unable to Create Database %s'), mysql_error())); return false; } @mysql_select_db($database, $dbh); @@ -167,7 +167,7 @@ function install_insert_db($username,$password,$hostname,$database,$dbuser=false $db_results = @mysql_query($sql,$dbh); $sql = "CREATE DATABASE `" . Dba::escape($database) . "`"; if (!$db_results = @mysql_query($sql, $dbh)) { - Error::add('general',"Error: Unable to Create Database " . mysql_error()); + Error::add('general', sprintf(_('Error: Unable to Create Database %s'), mysql_error())); return false; } @mysql_select_db($database, $dbh); @@ -180,7 +180,7 @@ function install_insert_db($username,$password,$hostname,$database,$dbuser=false $db_pass = $_POST['db_password'] ? scrub_in($_POST['db_password']) : $dbpass; if (!strlen($db_user) || !strlen($db_pass)) { - Error::add('general','Error: Ampache SQL Username or Password missing'); + Error::add('general',_('Error: Ampache SQL Username or Password missing')); return false; } @@ -188,7 +188,8 @@ function install_insert_db($username,$password,$hostname,$database,$dbuser=false "'" . Dba::escape($db_user) . "'@'" . Dba::escape($hostname) . "' IDENTIFIED BY '" . Dba::escape($db_pass) . "' WITH GRANT OPTION"; if (!$db_results = @mysql_query($sql, $dbh)) { - Error::add('general',"Error: Unable to Insert $db_user with permissions to $database on $hostname " . mysql_error()); + // HINT: 1: db_user, 2: database, 3: hostname, 4: mysql_error() + Error::add('general', sprintf(_('Error: Unable to Insert %1$s with permissions to %2$s on %3$s %4$s'), $db_user, $database, $hostname, mysql_error())); return false; } } // end if we are creating a user @@ -257,11 +258,11 @@ function install_create_config($web_path,$username,$password,$hostname,$database */ // Connect to the DB if(!is_resource($dbh)) { - Error::add('general',"Database Connection Failed Check Hostname, Username and Password"); + Error::add('general', _("Database Connection Failed Check Hostname, Username and Password")); return false; } if (!@mysql_select_db($database, $dbh)) { - Error::add('general',"Database Selection Failure Check Existance of $database"); + Error::add('general', sprintf(_('Database Selection Failure Check Existance of %s'), $database)); return false; } @@ -270,13 +271,13 @@ function install_create_config($web_path,$username,$password,$hostname,$database // Make sure the directory is writable OR the empty config file is if (!$download) { if (!check_config_writable()) { - Error::add('general',"Config file is not writable"); + Error::add('general', _("Config file is not writable")); return false; } else { // Given that $final is > 0, we can ignore lazy comparison problems if (!file_put_contents($config_file,$final)) { - Error::add('general',"Error Writing config file"); + Error::add('general', _("Error Writing config file")); return false; } } @@ -311,14 +312,14 @@ function install_create_account($username,$password,$password2) { $dbh = Dba::dbh(); if (!is_resource($dbh)) { - Error::add('general','Database Connection Failed:' . mysql_error()); + Error::add('general', sprintf(_('Database Connection Failed: %s'), mysql_error())); return false; } $db_select = @mysql_select_db(Config::get('database_name'),$dbh); if (!$db_select) { - Error::add('general','Database Select Failed:' . mysql_error()); + Error::add('general', sprintf(_('Database Select Failed: %s'), mysql_error())); return false; } @@ -328,7 +329,7 @@ function install_create_account($username,$password,$password2) { $insert_id = User::create($username,'Administrator','',$password,'100'); if (!$insert_id) { - Error::add('general',"Insert of Base User Failed " . mysql_error()); + Error::add('general', sprintf(_('Insert of Base User Failed %s'), mysql_error())); return false; } |