diff options
author | patdenice <patdenice@piwigo.org> | 2010-03-25 20:18:28 +0000 |
---|---|---|
committer | patdenice <patdenice@piwigo.org> | 2010-03-25 20:18:28 +0000 |
commit | 6b445114da301438f386eeb9853448b53fd9e516 (patch) | |
tree | 029b826deec8d484047a7394c92b9477f3e54f43 /install | |
parent | 7ebdbee901b1290fc3578b81241b25227c786efb (diff) |
Feature 1535: Add language manager.
git-svn-id: http://piwigo.org/svn/trunk@5357 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | install.php | 18 | ||||
-rw-r--r-- | install/db/90-database.php | 14 |
2 files changed, 15 insertions, 17 deletions
diff --git a/install.php b/install.php index e1d7a96fe..926dddc67 100644 --- a/install.php +++ b/install.php @@ -188,6 +188,9 @@ include(PHPWG_ROOT_PATH . 'include/functions.inc.php'); include(PHPWG_ROOT_PATH . 'admin/include/functions.php'); include(PHPWG_ROOT_PATH . 'admin/include/functions_upgrade.php'); +include(PHPWG_ROOT_PATH . 'admin/include/languages.class.php'); +$languages = new languages('utf-8'); + if (isset($_GET['language'])) { $language = strip_tags($_GET['language']); @@ -196,7 +199,7 @@ else { $language = 'en_UK'; // Try to get browser language - foreach (get_languages('utf-8') as $language_code => $language_name) + foreach ($languages->fs_languages as $language_code => $language_name) { if (substr($language_code,0,2) == @substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2)) { @@ -286,7 +289,7 @@ if ( isset( $_POST['install'] )) $pwg_charset = 'iso-8859-1'; $pwg_db_charset = 'latin1'; $install_charset_collate = ''; - if ( !array_key_exists($language, get_languages($pwg_charset) ) ) + if ( !array_key_exists($language, $languages->get_fs_languages($pwg_charset) ) ) { $language='en_UK'; } @@ -375,15 +378,10 @@ INSERT INTO '.$prefixeTable.'config (param,value,comment) pwg_query($query); // fill languages table - $inserts = array(); - foreach (get_languages('utf-8') as $language_code => $language_name) + foreach ($languages->get_fs_languages($pwg_charset) as $language_code => $language_name) { - $inserts[] = array( - 'id' => $language_code, - 'name' => $language_name, - ); + $languages->perform_action('activate', $language_code); } - mass_inserts(LANGUAGES_TABLE, array('id', 'name'), $inserts); // fill $conf global array load_conf_from_db(); @@ -475,7 +473,7 @@ else { $dbengines = available_engines(); - foreach (get_languages('utf-8') as $language_code => $language_name) + foreach ($languages->fs_languages as $language_code => $language_name) { if ($language == $language_code) { diff --git a/install/db/90-database.php b/install/db/90-database.php index 2daa931a1..532f36a2c 100644 --- a/install/db/90-database.php +++ b/install/db/90-database.php @@ -44,15 +44,15 @@ if (DB_CHARSET == 'utf8') pwg_query($query); // Fill table -$inserts = array(); -foreach (get_languages('utf-8') as $language_code => $language_name) +include_once(PHPWG_ROOT_PATH.'include/constants.php'); +include_once(PHPWG_ROOT_PATH.'admin/include/languages.class.php'); + +$languages = new languages(PWG_CHARSET); + +foreach ($languages->fs_languages as $language_code => $language_name) { - $inserts[] = array( - 'id' => $language_code, - 'name' => $language_name, - ); + $languages->perform_action('activate', $language_code); } -mass_inserts(PREFIX_TABLE.'languages', array('id', 'name'), $inserts); echo "\n" |