mirror of
https://github.com/danpros/htmly.git
synced 2026-04-17 19:26:08 +05:30
Adding language support - currently only English and German
system/htmly.php - Loads language files from folder lang/ - Sets language settings for date and time format system/includes/dispatch.php - function i18n() returns translated strings
This commit is contained in:
parent
5423d65cdc
commit
4fde479aba
41 changed files with 352 additions and 147 deletions
|
|
@ -40,6 +40,22 @@ function error($code, $message)
|
|||
die($message);
|
||||
}
|
||||
|
||||
// i18n provides strings in the current language
|
||||
function i18n($key, $value = null)
|
||||
{
|
||||
static $_i18n = array();
|
||||
|
||||
if ($key === 'source') {
|
||||
if (file_exists($value))
|
||||
$_i18n = parse_ini_file($value, true);
|
||||
else
|
||||
$_i18n = parse_ini_file('lang/lang-en.ini', true);
|
||||
} elseif ($value == null)
|
||||
return (isset($_i18n[$key]) ? $_i18n[$key] : '_i18n_' . $key . '_i18n_');
|
||||
else
|
||||
$_i18n[$key] = $value;
|
||||
}
|
||||
|
||||
function config($key, $value = null)
|
||||
{
|
||||
static $_config = array();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue