本文整理汇总了PHP中Translation::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Translation::get方法的具体用法?PHP Translation::get怎么用?PHP Translation::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Translation
的用法示例。
在下文中一共展示了Translation::get方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($attributes)
{
parent::__construct($attributes);
if (!isset($this->attributes['products_source_field']) || !$this->attributes['products_source_field'] instanceof ProductSelect) {
throw new Exception("Source field (attribute: products_source_field) not set for field '{$this->attributes['name']}'.");
}
$this->attributes['products_source_field_name'] = $this->attributes['products_source_field']->getName();
$this->attributes['vat_values'] = App::getModel('vat/vat')->getVATAll();
$this->attributes['prefixes'] = array(Translation::get('TXT_PRICE_NET'), Translation::get('TXT_PRICE_GROSS'));
$this->_jsFunction = 'LoadProductDataForAggregation_' . $this->_id;
$this->attributes['jsfunction'] = 'xajax_' . $this->_jsFunction;
App::getRegistry()->xajaxInterface->registerFunction(array($this->_jsFunction, $this, 'loadProductData'));
}
示例2: processVariants
public function processVariants($productId)
{
if (!isset($this->attributes['clientgroupid'])) {
$this->attributes['clientgroupid'] = 0;
}
if (!isset($this->attributes['currencyid'])) {
$this->attributes['currencyid'] = 0;
}
$rawVariants = App::getModel('product/product')->getAttributeCombinationsForProduct($productId, $this->attributes['clientgroupid'], $this->attributes['currencyid']);
$variants = [];
$variants[] = array('id' => '', 'caption' => Translation::get('TXT_CHOOSE_VARIANT'), 'price' => '');
foreach ($rawVariants as $variant) {
$caption = [];
foreach ($variant['attributes'] as $attribute) {
$caption[] = str_replace('"', '\'', $attribute['name']);
}
$variants[] = array('id' => $variant['id'], 'caption' => implode(', ', $caption), 'options' => array('price' => $variant['price'], 'stock' => $variant['qty'], 'weight' => $variant['weight'], 'ean' => $variant['symbol'], 'thumb' => App::getModel('product')->getThumbPathForId($variant['photoid'])));
}
return json_encode($variants);
}
示例3: is_exist_language
/**
* Verify if a language is available
*
* @param string $a_language_code
* @return <boolean|string>
*/
public function is_exist_language($a_language_code)
{
// Verify if a language matches the parameter
if (isset(self::$languages[$this->directory][$a_language_code])) {
$return = $a_language_code;
} else {
if (strlen($a_language_code) > 2) {
$a_language_code = substr($a_language_code, 0, 2);
}
$matches = array();
$translations = array();
foreach (self::$languages[$this->directory] as $item) {
if ($item->code_short == $a_language_code) {
$translation = new Translation($item);
$matches[$item->code] = $translation->get('language', 'priority');
$translations[$item->code] = $translation;
}
}
if (count($matches) == 1) {
$found_language = reset($translations);
$return = $found_language->get_language()->code;
} else {
if (count($matches) > 1) {
arsort($matches);
$keys = array_keys($matches);
$found_language = $translations[reset($keys)];
$return = $found_language->get_language()->code;
}
}
}
return isset($return) ? $return : false;
}
示例4: MultilingualTranslateForm
function MultilingualTranslateForm()
{
parent::MailForm();
$this->autosave = true;
global $page, $cgi, $intl;
$intl->language = $cgi->_lang;
$intl->charset = $intl->languages[$intl->language]['charset'];
$this->extra = 'id="multilingual-translate-form"';
$w =& $this->addWidget('template', '_header');
$this->lang = multilingual_filter_lang($cgi->_lang);
$this->reflang = multilingual_filter_lang(intl_default_lang());
$w->template = '<tr><th colspan="2" width="50%">{intl Language}: {lang}</th><th width="50%">{intl Reference}: {reflang}</th></tr>';
// get copy from repository
loader_import('cms.Versioning.Rex');
$rex = new Rex($cgi->_collection);
$doc = $rex->getCurrent($cgi->_key);
$widgets = $rex->getStruct();
if (!$widgets) {
$widgets = array();
}
// edit widgets go here
$this->widgets = array_merge($this->widgets, $widgets);
foreach ($this->widgets as $k => $v) {
if (in_array($k, array($rex->key, 'sitellite_status', 'sitellite_access', 'sitellite_startdate', 'sitellite_expirydate', 'sitellite_owner', 'sitellite_team'))) {
unset($this->widgets[$k]);
continue;
}
if ($v->name != '_header' && !in_array($v->type, array('text', 'textarea', 'xeditor'))) {
unset($this->widgets[$k]);
continue;
}
if (strtolower(get_class($this->widgets[$k])) == 'mf_widget_xeditor') {
$this->extra = 'onsubmit="xed_copy_value (this, \'' . $k . '\')"';
}
if (isset($doc->{$k})) {
$this->widgets[$k]->reference = $doc->{$k};
}
}
$w =& $this->addWidget('hidden', '_key');
$w =& $this->addWidget('hidden', '_collection');
$w =& $this->addWidget('hidden', '_lang');
$w =& $this->addWidget('status', '_status');
$w->alt = intl_get('Translation Status');
$w->setValue('draft');
$w->reference = '';
// submit buttons
$w =& $this->addWidget('msubmit', 'submit_button');
$w->reference = '';
$b =& $w->getButton();
$b->setValues(intl_get('Save'));
$b =& $w->addButton('submit_button', intl_get('Cancel'));
$b->extra = 'onclick="return cms_cancel (this.form)"';
$this->error_mode = 'all';
if ($rex->info['Collection']['singular']) {
page_title(intl_get('Translating') . ' ' . $rex->info['Collection']['singular'] . ': ' . $doc->{$rex->key});
} else {
page_title(intl_get('Translating Item') . ': ' . $doc->{$rex->key});
}
$tr = new Translation($cgi->_collection, $cgi->_lang);
$curr = $tr->get($cgi->_key);
if ($curr) {
foreach ($curr->data as $k => $v) {
if (isset($this->widgets[$k])) {
$this->widgets[$k]->setDefault($v);
}
}
$this->widgets['_status']->setDefault($curr->sitellite_status);
}
}
示例5: processVariants
public function processVariants($productId)
{
$rawVariants = App::getModel('product/product')->getAttributeCombinationsForProduct($productId);
$variants = [];
$variants[] = array('id' => '', 'caption' => Translation::get('TXT_ANY_VARIANT'));
foreach ($rawVariants as $variant) {
$caption = [];
foreach ($variant['attributes'] as $attribute) {
$caption[] = $attribute['name'];
}
$variants[] = array('id' => $variant['id'], 'caption' => implode(', ', $caption));
}
return json_encode($variants);
}
示例6: _
/**
* Return translated version of $name
* @param string $name
*/
function _($name)
{
return Translation::get($name);
}
示例7: __construct
public function __construct($attributes)
{
parent::__construct($attributes);
$this->attributes['file_types'] = array('octet-stream', 'jpg', 'jpeg', 'png', 'gif', 'psd', 'doc', 'docx', 'csv', 'xls', 'tgz', 'rar', 'zip', 'pdf', 'avi', 'mov', 'mpg', 'mpeg');
$this->attributes['file_types_description'] = Translation::get('TXT_FILE_TYPES_IMAGE');
}
示例8: __construct
public function __construct($attributes)
{
parent::__construct($attributes);
$this->_attributes['file_types'] = array('xls', 'csv', 'xml', 'odt', 'txt');
$this->_attributes['file_types_description'] = Translation::get('TXT_FILE_TYPES_EXCHANGE');
}
示例9: array
if (session_admin()) {
echo '<div class="scm-sidebar-top">';
echo loader_box('cms/buttons/add', array('collection' => 'sitellite_sidebar', 'return' => site_current(), 'extra' => '&position=' . $position));
echo '</div>';
}
if (!$res) {
return;
}
if (intl_lang() != intl_default_lang()) {
loader_import('multilingual.Translation');
$tr = new Translation('sitellite_sidebar', intl_lang());
}
foreach ($res as $key => $row) {
if (intl_lang() != intl_default_lang()) {
if (session_admin()) {
$translated = $tr->get($row->id);
} else {
$translated = $tr->get($row->id, true);
}
if ($translated) {
foreach ($translated->data as $k => $v) {
$row->{$k} = $v;
}
}
}
if (count($res) == 1) {
$up = false;
$down = false;
$upkey = '';
$downkey = '';
} elseif ($key == 0) {
示例10: assocify
/*$teams = session_allowed_teams_list ();
if ($teams[0] == 'all') {
$teams = assocify (session_get_teams ());
foreach ($teams as $k => $v) {
$teams[$k] = ucwords ($v);
}
}*/
if (!is_array($list)) {
$list = array();
}
$parameters['total'] = count($list);
$parameters['list'] = array();
if ($cgi->_status == 'untranslated') {
$r = new Rex($cgi->_collection);
foreach ($list as $item) {
$parameters['list'][$item->{$r->key}] = $tr->get($item->{$r->key});
if ($parameters['list'][$item->{$r->key}]->collection) {
$parameters['list'][$item->{$r->key}]->title = multilingual_filter_title($parameters['list'][$item->{$r->key}]->collection, $item->{$r->key});
} else {
$parameters['list'][$item->{$r->key}]->title = multilingual_filter_title($cgi->_collection, $item->{$r->key});
}
}
uasort($parameters['list'], 'multilingual_sort');
} else {
foreach ($list as $item) {
$parameters['list'][$item->id] = $tr->getByID($item->id);
$r = new Rex($parameters['list'][$item->id]->collection);
$parameters['list'][$item->id]->title = multilingual_filter_title($parameters['list'][$item->id]->collection, $parameters['list'][$item->id]->pkey);
$parameters['list'][$item->id]->_collection = $parameters['list'][$item->id]->collection;
$parameters['list'][$item->id]->collection = $parameters['collections'][$parameters['list'][$item->id]->collection];
}
示例11: Translation
/**
* Returns a single object with the specified $id.
*
* @access public
* @param mixed
* @return object
*/
function &get($id)
{
if ($this->usePermissions) {
if (session_admin()) {
$and = ' and ' . session_allowed_sql();
} else {
$and = ' and ' . session_approved_sql();
}
} else {
$and = '';
}
$res = db_fetch('SELECT * FROM ' . $this->table . ' WHERE ' . $this->pkey . ' = ?' . $and . $this->_end(), $id);
if (!$res) {
$this->error = db_error();
return false;
}
if ($this->multilingual && intl_lang() != intl_default_lang()) {
loader_import('multilingual.Translation');
$tr = new Translation($this->table, intl_lang());
if (session_admin()) {
$translated = $tr->get($res->{$this->pkey});
} else {
$translated = $tr->get($res->{$this->pkey}, true);
}
if ($translated) {
foreach ($translated->data as $key => $value) {
$res->{$key} = $value;
}
}
}
return $res;
}