mirror of
https://github.com/danpros/htmly.git
synced 2026-04-22 13:36:22 +05:30
Simplify the language file
We just need to creating the file and load it via config
This commit is contained in:
parent
a5a3d662a3
commit
73e103b8ab
5 changed files with 25 additions and 10 deletions
|
|
@ -3201,3 +3201,26 @@ function replace_href($string, $tag, $class, $url)
|
|||
return preg_replace('~<(?:!DOCTYPE|/?(?:html|head|body))[^>]*>\s*~i', '', utf8_decode($doc->saveHTML($doc->documentElement)));
|
||||
|
||||
}
|
||||
|
||||
function get_language()
|
||||
{
|
||||
|
||||
$langID = config('language');
|
||||
$langFile = 'lang/'. $langID . '.ini';
|
||||
$local = strtolower($langID);
|
||||
|
||||
// Settings for the language
|
||||
if (!isset($langID) || config('language') === 'en') {
|
||||
i18n('source', 'lang/en.ini'); // Load the English language file
|
||||
setlocale(LC_ALL, 'en_US'); // Change time format to English
|
||||
} else {
|
||||
if (file_exists($langFile)) {
|
||||
i18n('source', 'lang/' . $langID . '.ini');
|
||||
setlocale(LC_ALL, $local);
|
||||
} else {
|
||||
i18n('source', 'lang/en.ini'); // Load the English language file
|
||||
setlocale(LC_ALL, 'en_US'); // Change time format to English
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue