mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-19 10:23:16 +09:00
Issue 130 adding xml spec for multi-languages.
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8909 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
511b7f184e
commit
83a38b61fa
385 changed files with 19224 additions and 23260 deletions
|
|
@ -461,14 +461,8 @@ class Context {
|
|||
if(!is_object($lang)) $lang = new stdClass;
|
||||
if(!$self->lang_type) return;
|
||||
|
||||
if(substr($path,-1)!='/') $path .= '/';
|
||||
$path_tpl = $path.'%s.lang.php';
|
||||
$filename = sprintf($path_tpl, $self->lang_type);
|
||||
$langs = array('ko','en'); // this will be configurable.
|
||||
while(!is_readable($filename) && $langs[0]) {
|
||||
$filename = sprintf($path_tpl, array_shift($langs));
|
||||
}
|
||||
if(!is_readable($filename)) return;
|
||||
$filename = $self->_loadXmlLang($path);
|
||||
if(!$filename) $filename = $self->_loadPhpLang($path);
|
||||
|
||||
if(!is_array($self->loaded_lang_files)) $self->loaded_lang_files = array();
|
||||
if(in_array($filename, $self->loaded_lang_files)) return;
|
||||
|
|
@ -477,6 +471,31 @@ class Context {
|
|||
@include($filename);
|
||||
}
|
||||
|
||||
function _loadXmlLang($path) {
|
||||
if(substr($path,-1)!='/') $path .= '/';
|
||||
$file = $path.'lang.xml';
|
||||
|
||||
$oXmlLangParser = new XmlLangParser($file, $this->lang_type);
|
||||
$file = $oXmlLangParser->compile();
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
function _loadPhpLang($path) {
|
||||
|
||||
if(substr($path,-1)!='/') $path .= '/';
|
||||
$path_tpl = $path.'%s.lang.php';
|
||||
$file = sprintf($path_tpl, $self->lang_type);
|
||||
|
||||
$langs = array('ko','en'); // this will be configurable.
|
||||
while(!is_readable($file) && $langs[0]) {
|
||||
$file = sprintf($path_tpl, array_shift($langs));
|
||||
}
|
||||
|
||||
if(!is_readable($file)) return false;
|
||||
return $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief set lang_type
|
||||
* @return none
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue