Beispiel #1
0
function i18n_load_dir($path, $locale, $id)
{
    if (preg_match('/\\/language\\/(.*)$/', $path, $matches)) {
        if (strpos($path, $locale) === false) {
            return;
        }
        i18n_load_values($path, $locale, $id);
    } else {
        if ($dh = opendir($path)) {
            while (($file = readdir($dh)) !== false) {
                if ($file != '.' && $file != '..') {
                    i18n_load($path . '/' . $file, $locale, $id);
                }
            }
            closedir($dh);
        }
    }
}
 /**
  * Load all values from file system (load() is reserved)
  *
  * @param  integer  $from    Locale id to copy from
  * @param  integer  $to      Locale id to copy to
  * @param  boolean  $replace Replace all values
  * @return boolean
  */
 function import($id, $locale, $replace = false, $prefix = '')
 {
     if ($replace) {
         $table = $this->getTableName(true);
         $sql = "DELETE FROM {$table} WHERE `locale_id` = {$id}";
         DB::execute($sql);
     }
     i18n_load(ROOT . '/language', $locale, $id, $prefix);
     i18n_load(ROOT . '/application/plugins', $locale, $id, $prefix);
 }
 /**
  * Load all values from file system (load() is reserved)
  *
  * @param  integer  $from    Locale id to copy from
  * @param  integer  $to      Locale id to copy to
  * @param  boolean  $replace Replace all values
  * @return boolean
  */
 function import($id, $locale)
 {
     i18n_load(ROOT . '/language', $locale, $id);
     i18n_load(ROOT . '/application/plugins', $locale, $id);
 }