-
Nucleus is installed in the selected locale, the locale of the Asterisk prefixed will be displayed in English because there is no translation of the installer file.
-
We will wait for the translator by volunteers!
-
+
+
+
@@ -944,7 +959,7 @@ function do_install()
if ( DB::execute($query) === FALSE )
{
$errinfo = DB::getError();
- $errors[] = _INST_ERROR4 . ' (
' . $newpost . '): ' . $errinfo[2];
+ $errors[] = _INST_ERROR4 . ' (
' . $query . '): ' . $errinfo[2];
}
/* push configurations */
@@ -1330,7 +1345,6 @@ function do_check_files()
'../index.php',
'../action.php',
'../nucleus/index.php',
- '../nucleus/media.php',
'../nucleus/libs/ACTION.php',
'../nucleus/libs/ACTIONLOG.php',
'../nucleus/libs/ACTIONS.php',
@@ -1341,7 +1355,6 @@ function do_check_files()
'../nucleus/libs/COMMENT.php',
'../nucleus/libs/COMMENTACTIONS.php',
'../nucleus/libs/COMMENTS.php',
- '../nucleus/libs/ENCAPSULATE.php',
'../nucleus/libs/ENTITY.php',
'../nucleus/libs/globalfunctions.php',
'../nucleus/libs/i18n.php',
@@ -1455,7 +1468,7 @@ class ParamManager
// set default values
$this->state = 'locale';
$this->install_mode = 'simple';
- $this->locale = 'en_Latn_US';
+ $this->locale = '';
$this->mysql_host = @ini_get('mysql.default_host');
$this->blog_name = 'My Nucleus CMS';
$this->blog_shortname = 'mynucleuscms';
@@ -1512,11 +1525,82 @@ class ParamManager
public function set_locale()
{
$this->read_parameter(array('locale'));
-
- if ( !in_array($this->locale, i18n::get_available_locale_list()) )
+
+ if ( !$this->locale )
+ {
+ /**
+ * default locale select simple implementation
+ *
+ * NOTE:
+ * RFC2616: Hypertext Transfer Protocol -- HTTP/1.1
+ * http://www.ietf.org/rfc/rfc2616.txt
+ *
+ * 14.4 Accept-Language
+ *
+ * The Accept-Language request-header field is similar to Accept, but
+ * restricts the set of natural languages that are preferred as a
+ * response to the request. Language tags are defined in section 3.10.
+ *
+ * Accept-Language = "Accept-Language" ":"
+ * 1#( language-range [ ";" "q" "=" qvalue ] )
+ * language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )
+ *
+ * Each language-range MAY be given an associated quality value which
+ * represents an estimate of the user's preference for the languages
+ * specified by that range. The quality value defaults to "q=1". For
+ * example,
+ *
+ * Accept-Language: da, en-gb;q=0.8, en;q=0.7
+ *
+ * would mean: "I prefer Danish, but will accept British English and
+ * other types of English." A language-range matches a language-tag if
+ * it exactly equals the tag, or if it exactly equals a prefix of the
+ * tag such that the first tag character following the prefix is "-".
+ * The special range "*", if present in the Accept-Language field,
+ * matches every tag not matched by any other range present in the
+ * Accept-Language field.
+ *
+ * TODO: this is appropriate implement or not
+ */
+ $languages = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
+
+ /* retrieve language token of language tag from first token */
+ $language = '';
+ if ( is_array($languages) && count($languages) > 0 )
+ {
+ $language = preg_replace('#^([\w]+).*$#', '$1', $languages[0]);
+ }
+
+ $locales = i18n::get_available_locale_list();
+ foreach ( $locales as $locale )
+ {
+ if ( i18n::strpos($locale, $language) === 0 )
+ {
+ $this->locale = $locale;
+ break;
+ }
+ }
+ }
+
+ /* include installer translation messages */
+ $translation_file = "./locales/{$this->locale}." . i18n::get_current_charset() . '.php';
+ if ( !file_exists($translation_file) )
{
- $this->locale = 'en_Latn_US';
+ $translation_file = './locales/en_Latn_US.UTF-8.php';
}
+ include($translation_file);
+
+ /* include global translation messages */
+ $translation_file = "../nucleus/locales/{$this->locale}." . i18n::get_current_charset() . '.php';
+ if ( !file_exists($translation_file) )
+ {
+ $translation_file = './locales/en_Latn_US.UTF-8.php';
+ }
+ include($translation_file);
+
+ i18n::set_current_locale($this->locale);
+
+ return;
}
public function check_mysql_parameters()