本文整理汇总了PHP中Translation::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Translation::load方法的具体用法?PHP Translation::load怎么用?PHP Translation::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Translation
的用法示例。
在下文中一共展示了Translation::load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: translate
public function translate($s)
{
global $language_data;
if (isset($language_data) and isset($language_data[$s])) {
return $language_data[$s];
} else {
global $config, $home_dir, $db;
if ($config['debug_mode']) {
require_once $home_dir . 'models/translation.m.php';
require_once $home_dir . 'models/language.m.php';
$language = new Language($db);
$language->loadByCode($language_data['language_code']);
$t = new Translation($db);
$t->load($language->ival('language_id'), $s);
if (!$t->is_loaded) {
$t->data['translation_name'] = $s;
$t->data['translation_language_id'] = $language->ival('language_id');
$t->save();
}
}
return $s;
}
}
示例2: Localization
<?php
global $home_dir, $language_data;
require_once $home_dir . 'classes/localization.php';
require_once $home_dir . 'models/translation.m.php';
require_once $home_dir . 'models/language.m.php';
$localization = new Localization($home_dir . 'lang/');
$language = new Language($db);
$language->loadByCode($language_data['language_code']);
foreach ($language_data as $name => $translation) {
$t = new Translation($db);
$t->load($language->ival('language_id'), $name);
$t->data['translation_name'] = $name;
$t->data['translation_translation'] = $translation;
$t->data['translation_language_id'] = $language->ival('language_id');
$t->save();
}
echo 'Language imported.';