Browse Source

Simplify the language file

We just need to creating the file and load it via config
pull/394/head
danpros 5 years ago
parent
commit
73e103b8ab
5 changed files with 25 additions and 10 deletions
  1. +0
    -0
      lang/de.ini
  2. +0
    -0
      lang/en.ini
  3. +0
    -0
      lang/pl.ini
  4. +2
    -10
      system/htmly.php
  5. +23
    -0
      system/includes/functions.php

lang/lang-de.ini → lang/de.ini View File


lang/lang-en.ini → lang/en.ini View File


lang/lang-pl.ini → lang/pl.ini View File


+ 2
- 10
system/htmly.php View File

@ -3,16 +3,8 @@
// Load the configuration file
config('source', $config_file);
// Settings for the language
if ( config('language') === "de" ) {
i18n('source', 'lang/lang-de.ini'); // Load the German language file
$date_format = '%d. %B %Y'; // Date format German style
setlocale(LC_TIME, 'de_DE', 'de_DE.utf8', "German"); // Change time format to German
} else { // Default: English ("en")
i18n('source', 'lang/lang-en.ini'); // Load the English language file
$date_format = '%B %d, %Y'; // Date format English style
setlocale(LC_TIME, 'en_US', 'en_US.utf8', "English"); // Change time format to English
}
// Load the language file
get_language();
// Set the timezone
if (config('timezone')) {


+ 23
- 0
system/includes/functions.php View File

@ -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…
Cancel
Save