本文整理汇总了PHP中translate函数的典型用法代码示例。如果您正苦于以下问题:PHP translate函数的具体用法?PHP translate怎么用?PHP translate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了translate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: WriteData
function WriteData(&$data)
{
$this->count++;
if (isset($this->block_title) && strlen($this->block_title) > 0) {
if (preg_match("/(\\.[^\\/\\\\]+)\\s*\$/", $data, $m)) {
$title = $this->block_title . $m[1];
} else {
$title = $this->block_title;
}
} else {
$title = basename($data);
}
if (in_array($title, $this->list)) {
if (preg_match("/^(.*)(\\.[^\\/\\\\]+)\\s*\$/", $title, $m)) {
$base = $m[1];
$ext = $m[2];
} else {
$base = $title;
$ext = "";
}
$i = 0;
do {
$title = $base . ++$i . $ext;
} while (in_array($title, $this->list));
}
array_push($this->list, $title);
if ($this->zip->open($this->tmpfile, ZIPARCHIVE::CREATE) !== true) {
throw new ADEIException(translate("Can't open/create ZIP archive (%s)", $this->tmpfile));
}
$this->zip->addFile($data, $title);
$this->zip->close();
}
示例2: __construct
public function __construct()
{
if (!pageArray(2) || !pageArray(3)) {
return false;
}
$email = pageArray(2);
$code = pageArray(3);
runHook("action:verify_email:before");
$access = getIgnoreAccess();
setIgnoreAccess();
$user = getEntities(array("type" => "User", "metadata_name_value_pairs" => array(array("name" => "email", "value" => $email), array("name" => "email_verification_code", "value" => $code))));
setIgnoreAccess($access);
if (!$user) {
new SystemMessage(translate("system_message:email_could_not_be_verified"));
forward("home");
}
$user = $user[0];
$user->email_verification_code = NULL;
$user->verified = "true";
$user->save();
runHook("action:verify_email:after");
new SystemMessage(translate("system_message:email_verified"));
new Activity($user->guid, "activity:joined", array($user->getURL(), $user->full_name));
forward("login");
}
示例3: lodgegold_dohook
function lodgegold_dohook($hookname, $args)
{
global $session;
$cost1 = get_module_setting("cost1", "lodgegold");
$cost2 = get_module_setting("cost2", "lodgegold");
$cost3 = get_module_setting("cost3", "lodgegold");
$gold1 = get_module_setting("gold1", "lodgegold");
$gold2 = get_module_setting("gold2", "lodgegold");
$gold3 = get_module_setting("gold3", "lodgegold");
switch ($hookname) {
case "lodge":
addnav("Buy Requisition");
$donationsleft = $session['user']['donation'] - $session['user']['donationspent'];
if ($donationsleft >= $cost1) {
addnav(array("`^%s Gold - `#(%s Points)", $gold1, $cost1), "runmodule.php?module=lodgegold&op=cost1&gold=gold1");
}
if ($donationsleft >= $cost2) {
addnav(array("`^%s Gold - `#(%s Points)", $gold2, $cost2), "runmodule.php?module=lodgegold&op=cost2&gold=gold2");
}
if ($donationsleft >= $cost3) {
addnav(array("`^%s Gold - `#(%s Points)", $gold3, $cost3), "runmodule.php?module=lodgegold&op=cost3&gold=gold3");
}
break;
case "pointsdesc":
$args['count']++;
$format = $args['format'];
$str = translate("Trade in donation points for gold.");
$str = sprintf($str, get_module_setting("cost1"), get_module_setting("cost2"));
output($format, $str, true);
break;
}
return $args;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:33,代码来源:lodgegold.php
示例4: launch
function launch()
{
global $interface;
$id = $_GET['id'];
$interface->assign('id', $id);
$this->eContentRecord = new EContentRecord();
$this->eContentRecord->id = $_GET['id'];
$this->eContentRecord->find(true);
$recordDriver = new EcontentRecordDriver();
$recordDriver->setDataObject($this->eContentRecord);
$interface->assign('sourceUrl', $this->eContentRecord->sourceUrl);
$interface->assign('source', $this->eContentRecord->source);
$interface->setPageTitle(translate('Copies') . ': ' . $recordDriver->getBreadcrumb());
$driver = new EContentDriver();
$holdings = $driver->getHolding($id);
$showEContentNotes = false;
foreach ($holdings as $holding) {
if (strlen($holding->notes) > 0) {
$showEContentNotes = true;
}
}
$interface->assign('showEContentNotes', $showEContentNotes);
$interface->assign('holdings', $holdings);
//Load status summary
$result = $driver->getStatusSummary($id, $holdings);
if (PEAR_Singleton::isError($result)) {
PEAR_Singleton::raiseError($result);
}
$holdingData->holdingsSummary = $result;
$interface->assign('subTemplate', 'view-holdings.tpl');
$interface->setTemplate('view-alt.tpl');
// Display Page
$interface->display('layout.tpl');
}
示例5: saveDropDown
/**
* Takes in the request params from a save request and processes
* them for the save.
*
* @param REQUEST params $params
*/
function saveDropDown($params)
{
require_once 'modules/Administration/Common.php';
$emptyMarker = translate('LBL_BLANK');
$selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language'];
$type = $_REQUEST['view_package'];
$dir = '';
$dropdown_name = $params['dropdown_name'];
$json = getJSONobj();
$list_value = str_replace('"":""', '"__empty__":""', $params['list_value']);
//Bug 21362 ENT_QUOTES- convert single quotes to escaped single quotes.
$dropdown = $json->decode(html_entity_decode(rawurldecode($list_value), ENT_QUOTES));
if (array_key_exists($emptyMarker, $dropdown)) {
unset($dropdown[$emptyMarker]);
$dropdown[''] = '';
}
if ($type != 'studio') {
$mb = new ModuleBuilder();
$module =& $mb->getPackageModule($params['view_package'], $params['view_module']);
$this->synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module);
//Can't use synch on selected lang as we want to overwrite values, not just keys
$module->mblanguage->appListStrings[$selected_lang . '.lang.php'][$dropdown_name] = $dropdown;
$module->mblanguage->save($module->key_name);
// tyoung - key is required parameter as of
} else {
$contents = return_custom_app_list_strings_file_contents($selected_lang);
$my_list_strings = return_app_list_strings_language($selected_lang);
if ($selected_lang == $GLOBALS['current_language']) {
$GLOBALS['app_list_strings'][$dropdown_name] = $dropdown;
}
//write to contents
$contents = str_replace("?>", '', $contents);
if (empty($contents)) {
$contents = "<?php";
}
//add new drop down to the bottom
if (!empty($params['use_push'])) {
//this is for handling moduleList and such where nothing should be deleted or anything but they can be renamed
foreach ($dropdown as $key => $value) {
//only if the value has changed or does not exist do we want to add it this way
if (!isset($my_list_strings[$dropdown_name][$key]) || strcmp($my_list_strings[$dropdown_name][$key], $value) != 0) {
//clear out the old value
$pattern_match = '/\\s*\\$app_list_strings\\s*\\[\\s*\'' . $dropdown_name . '\'\\s*\\]\\[\\s*\'' . $key . '\'\\s*\\]\\s*=\\s*[\'\\"]{1}.*?[\'\\"]{1};\\s*/ism';
$contents = preg_replace($pattern_match, "\n", $contents);
//add the new ones
$contents .= "\n\$GLOBALS['app_list_strings']['{$dropdown_name}']['{$key}']=" . var_export_helper($value) . ";";
}
}
} else {
//Now synch up the keys in other langauges to ensure that removed/added Drop down values work properly under all langs.
$this->synchDropDown($dropdown_name, $dropdown, $selected_lang, $dir);
$contents = $this->getNewCustomContents($dropdown_name, $dropdown, $selected_lang);
}
if (!empty($dir) && !is_dir($dir)) {
$continue = mkdir_recursive($dir);
}
save_custom_app_list_strings_contents($contents, $selected_lang, $dir);
}
sugar_cache_reset();
}
示例6: errorMessage
function errorMessage($tag = '')
{
$toReturn = translate('If you want to install Plugin WIRIS manually, see') . ' <a href="http://www.wiris.com/download/moodle/install.html#' . $tag . '">' . translate('our manual') . '</a>.<br /><br />';
$toReturn .= '<a href="..">' . translate('Return to moodle home.') . '</a><br /><br />';
$toReturn .= '<a href="./install.php">' . translate('Try to reinstall') . '</a>.';
return $toReturn;
}
示例7: smarty_function_sugar_translate
/**
* Smarty {sugar_translate} function plugin
*
* Type: function<br>
* Name: sugar_translate<br>
* Purpose: translates a label into the users current language
*
* @author Majed Itani {majed at sugarcrm.com
* @param array
* @param Smarty
*/
function smarty_function_sugar_translate($params, &$smarty)
{
if (!isset($params['label'])) {
$smarty->trigger_error("sugar_translate: missing 'label' parameter");
return '';
}
$module = isset($params['module']) ? $params['module'] : '';
if (isset($params['select'])) {
if (empty($params['select'])) {
$value = "";
} else {
$value = translate($params['label'], $module, $params['select']);
}
} else {
$value = translate($params['label'], $module);
}
if (!empty($params['for_js']) && $params['for_js']) {
$value = addslashes($value);
$value = str_replace(array(''', '''), "\\'", $value);
}
if (isset($params['trimColon']) && !$params['trimColon']) {
return $value;
} elseif ($params['label'] == '0') {
return translate("DEFAULT", $module);
} else {
return preg_replace("/([:]|:)[\\s]*\$/", "", $value);
}
}
示例8: action_get_user_admin_page
/**
* set the html for user admin page
* this function is registered in xajax
* @return xajaxResponse every xajax registered function needs to return this object
*/
function action_get_user_admin_page()
{
global $logging;
global $user;
global $user_admin_table_configuration;
global $user_start_time_array;
$logging->info("USER_ACTION " . __METHOD__ . " (user=" . $user->get_name() . ")");
# store start time
$user_start_time_array[__METHOD__] = microtime(TRUE);
# create necessary objects
$result = new Result();
$response = new xajaxResponse();
$html_database_table = new HtmlDatabaseTable($user_admin_table_configuration);
# set page, title, explanation and navigation
$response->assign("page_title", "innerHTML", translate("LABEL_USER_ADMIN_TITLE"));
$response->assign("navigation_container", "innerHTML", get_page_navigation(PAGE_TYPE_USER_ADMIN));
$html_database_table->get_page(translate("LABEL_USER_ADMIN_TITLE"), $result);
$response->assign("main_body", "innerHTML", $result->get_result_str());
# set content
$html_database_table->get_content($user, HTML_NO_LIST_PERMISSION_CHECK, "", DATABASETABLE_UNKWOWN_PAGE, $result);
$response->custom_response->assign_with_effect(PORTAL_CSS_NAME_PREFIX . "content_pane", $result->get_result_str());
# set action pane
$html_str = $html_database_table->get_action_bar(USER_TABLE_NAME, "");
$response->custom_response->assign_and_show("action_pane", $html_str);
# set footer
$response->assign("footer_text", "innerHTML", " ");
# check post conditions
if (check_postconditions($result, $response) == FALSE) {
return $response;
}
# log total time for this function
$logging->info(get_function_time_str(__METHOD__));
return $response;
}
示例9: action_savelanguages
public function action_savelanguages()
{
global $sugar_config;
$toDecode = html_entity_decode($_REQUEST['disabled_langs'], ENT_QUOTES);
$disabled_langs = json_decode($toDecode);
$toDecode = html_entity_decode($_REQUEST['enabled_langs'], ENT_QUOTES);
$enabled_langs = json_decode($toDecode);
if (count($sugar_config['languages']) === count($disabled_langs)) {
sugar_die(translate('LBL_CAN_NOT_DISABLE_ALL_LANG'));
} else {
$cfg = new Configurator();
if (in_array($sugar_config['default_language'], $disabled_langs)) {
reset($enabled_langs);
$cfg->config['default_language'] = current($enabled_langs);
}
if (in_array($GLOBALS['current_user']->preferred_language, $disabled_langs)) {
$GLOBALS['current_user']->preferred_language = current($enabled_langs);
$GLOBALS['current_user']->save();
}
$cfg->config['disabled_languages'] = join(',', $disabled_langs);
// TODO: find way to enforce order
$cfg->handleOverride();
// Clear the metadata cache so changes to languages are picked up right away
MetaDataManager::refreshLanguagesCache($enabled_langs);
require_once 'modules/Administration/QuickRepairAndRebuild.php';
$repair = new RepairAndClear();
$repair->clearLanguageCache();
}
//Call Ping API to refresh the language list.
die("\n <script>\n var app = window.parent.SUGAR.App;\n app.api.call('read', app.api.buildURL('ping'));\n app.router.navigate('#bwc/index.php?module=Administration&action=Languages', {trigger:true, replace:true});\n </script>");
}
示例10: action_get_user_settings_page
/**
* set the html for user settings page
* this function is registered in xajax
* @return xajaxResponse every xajax registered function needs to return this object
*/
function action_get_user_settings_page()
{
global $logging;
global $user;
global $user_settings_table_configuration;
global $firstthingsfirst_portal_title;
global $user_start_time_array;
$logging->info("USER_ACTION " . __METHOD__ . " (user=" . $user->get_name() . ")");
# store start time
$user_start_time_array[__METHOD__] = microtime(TRUE);
# create necessary objects
$result = new Result();
$response = new xajaxResponse();
$html_database_table = new HtmlDatabaseTable($user_settings_table_configuration);
# create an array with selection of fields that user may change
$db_fields_array = array(DB_ID_FIELD_NAME, USER_NAME_FIELD_NAME, USER_PW_FIELD_NAME, USER_LANG_FIELD_NAME, USER_DATE_FORMAT_FIELD_NAME, USER_DECIMAL_MARK_FIELD_NAME, USER_LINES_PER_PAGE_FIELD_NAME, USER_THEME_FIELD_NAME);
$user_record_key_string = DatabaseTable::_get_encoded_key_string(array(DB_ID_FIELD_NAME => $user->get_id()));
# set page, title, explanation and navigation
$response->assign("page_title", "innerHTML", translate("LABEL_USER_SETTINGS_TITLE"));
$response->assign("navigation_container", "innerHTML", get_page_navigation(PAGE_TYPE_USER_SETTINGS));
$html_database_table->get_page(translate("LABEL_USER_SETTINGS_TITLE"), $result);
$response->assign("main_body", "innerHTML", $result->get_result_str());
# get action pane for current user
$html_database_table->get_record($user, USER_TABLE_NAME, $user_record_key_string, $db_fields_array, $result);
$response->custom_response->assign_with_effect("action_pane", $result->get_result_str());
# set footer
$response->assign("footer_text", "innerHTML", " ");
# check post conditions
if (check_postconditions($result, $response) == FALSE) {
return $response;
}
# log total time for this function
$logging->info(get_function_time_str(__METHOD__));
return $response;
}
示例11: __construct
function __construct($data)
{
$guid = $data['guid'];
$text = $data['text'];
$chat_message = new Chatmessage();
$chat_message->text = $text;
$chat_message->owner_guid = getLoggedInUserGuid();
$chat_message->container_guid = $guid;
$chat_message->save();
// If recipient is offline, send them an email
$chat = getEntity($guid);
if (getLoggedInUserGuid() == $chat->user_one) {
$recipient_guid = $chat->user_two;
} else {
$recipient_guid = $chat->user_one;
}
$recipient = getEntity($recipient_guid);
if ($recipient->online == "false") {
$offline_chats = $recipient->offline_chats;
if (!is_array($offline_chats)) {
$offline_chats = array(getLoggedInUserGuid());
$recipient->offline_chats = $offline_chats;
$recipient->save();
}
if (!in_array(getLoggedInUserGuid(), $recipient->offline_chats)) {
$recipient->offline_chats[] = getLoggedInUserGuid();
$recipient->save();
}
$setting = $recipient->notify_offline_chat;
if ($setting == "yes") {
new Email(array("to" => array("name" => "", "email" => ""), "from" => array("name" => "", "email" => ""), "subject" => translate("offline_message_email_subject"), "body" => translate("offline_message_email_body"), "html" => true));
}
}
}
示例12: _getModuleTitleParams
/**
* @see SugarView::_getModuleTitleParams()
*/
protected function _getModuleTitleParams($browserTitle = false)
{
global $mod_strings;
$returnAction = 'DetailView';
$returnModule = 'Users';
$returnId = $GLOBALS['current_user']->id;
$returnName = $GLOBALS['current_user']->full_name;
if (!empty($_REQUEST['return_action']) && !empty($_REQUEST['return_module'])) {
if ('Users' == $_REQUEST['return_module']) {
if ('EditView' == $_REQUEST['return_action']) {
$returnAction = 'EditView';
}
if (!empty($_REQUEST['return_name'])) {
$returnName = $_REQUEST['return_name'];
}
if (!empty($_REQUEST['user_id'])) {
$returnId = $_REQUEST['user_id'];
}
}
}
$this->_returnId = $returnId;
$iconPath = $this->getModuleTitleIconPath($this->module);
$params = array();
if (!empty($iconPath) && !$browserTitle) {
$params[] = "<a href='index.php?module=Users&action=index'><!--not_in_theme!--><img src='{$iconPath}' alt='" . translate('LBL_MODULE_NAME', 'Users') . "' title='" . translate('LBL_MODULE_NAME', 'Users') . "' align='absmiddle'></a>";
} else {
$params[] = translate('LBL_MODULE_NAME', 'Users');
}
$params[] = "<a href='index.php?module={$returnModule}&action=EditView&record={$returnId}'>" . $returnName . "</a>";
if ($returnAction == 'EditView') {
$params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL'];
}
return $params;
}
示例13: parse_template_bean
function parse_template_bean($string, $bean_name, &$focus)
{
$repl_arr = array();
foreach ($focus->field_defs as $field_def) {
if ($field_def['type'] == 'enum' && isset($field_def['options'])) {
$translated = translate($field_def['options'], $bean_name, $focus->{$field_def}['name']);
if (isset($translated) && !is_array($translated)) {
$repl_arr[strtolower($focus->module_dir) . "_" . $field_def['name']] = $translated;
} else {
// unset enum field, make sure we have a match string to replace with ""
$repl_arr[strtolower($focus->module_dir) . "_" . $field_def['name']] = '';
}
} else {
$repl_arr[strtolower($focus->module_dir) . "_" . $field_def['name']] = $focus->{$field_def}['name'];
}
}
// end foreach()
krsort($repl_arr);
reset($repl_arr);
foreach ($repl_arr as $name => $value) {
if ($value != '' && is_string($value)) {
$string = str_replace("\${$name}", $value, $string);
} else {
$string = str_replace("\${$name}", ' ', $string);
}
}
return $string;
}
示例14: get_list_view_data
function get_list_view_data()
{
$data = parent::get_list_view_data();
$data['VNAME'] = translate($this->vname, $this->custom_module);
$data['NAMELINK'] = '<input class="checkbox" type="checkbox" name="remove[]" value="' . $this->id . '"> <a href="index.php?module=Studio&action=wizard&wizard=EditCustomFieldsWizard&option=EditCustomField&record=' . $this->id . '" >';
return $data;
}
示例15: display_conflict_between_objects
function display_conflict_between_objects($object_1, $object_2, $field_defs, $module_dir, $display_name)
{
$mod_strings = return_module_language($GLOBALS['current_language'], 'OptimisticLock');
$title = '<tr><td > </td>';
$object1_row = '<tr class="oddListRowS1"><td><b>' . $mod_strings['LBL_YOURS'] . '</b></td>';
$object2_row = '<tr class="evenListRowS1"><td><b>' . $mod_strings['LBL_IN_DATABASE'] . '</b></td>';
$exists = false;
foreach ($field_defs as $name => $ignore) {
$value = $object_1[$name];
// FIXME: Replace the comparison here with a function from SugarWidgets
if (!is_scalar($value) || $name == 'team_name') {
continue;
}
if ($value != $object_2->{$name} && !$object_2->{$name} instanceof Link) {
$title .= '<td ><b> ' . translate($field_defs[$name]['vname'], $module_dir) . '</b></td>';
$object1_row .= '<td> ' . $value . '</td>';
$object2_row .= '<td> ' . $object_2->{$name} . '</td>';
$exists = true;
}
}
if ($exists) {
echo "<b>{$mod_strings['LBL_CONFLICT_EXISTS']}<a href='index.php?action=DetailView&module={$module_dir}&record={$object_1['id']}' target='_blank'>{$display_name}</a> </b> <br><table class='list view' border='0' cellspacing='0' cellpadding='2'>{$title}<td > </td></tr>{$object1_row}<td><a href='index.php?&module=OptimisticLock&action=LockResolve&save=true'>{$mod_strings['LBL_ACCEPT_YOURS']}</a></td></tr>{$object2_row}<td><a href='index.php?&module={$object_2->module_dir}&action=DetailView&record={$object_2->id}'>{$mod_strings['LBL_ACCEPT_DATABASE']}</a></td></tr></table><br>";
} else {
echo "<b>{$mod_strings['LBL_RECORDS_MATCH']}</b><br>";
}
}