本文整理汇总了PHP中get_translations函数的典型用法代码示例。如果您正苦于以下问题:PHP get_translations函数的具体用法?PHP get_translations怎么用?PHP get_translations使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_translations函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: startup_gettext
function startup_gettext()
{
# Get locale from Accept-Language header
$lang = al2gt(array_keys(get_translations()), "text/html");
if (defined('_TRANSLATION_OVERRIDE_DEFAULT')) {
$lang = _TRANSLATION_OVERRIDE_DEFAULT;
}
if ($_SESSION["uid"] && get_schema_version() >= 120) {
$pref_lang = get_pref("USER_LANGUAGE", $_SESSION["uid"]);
if ($pref_lang && $pref_lang != 'auto') {
$lang = $pref_lang;
}
}
if ($lang) {
if (defined('LC_MESSAGES')) {
_setlocale(LC_MESSAGES, $lang);
} else {
if (defined('LC_ALL')) {
_setlocale(LC_ALL, $lang);
}
}
_bindtextdomain("messages", "locale");
_textdomain("messages");
_bind_textdomain_codeset("messages", "UTF-8");
}
}
示例2: startup_gettext
function startup_gettext()
{
# Get locale from Accept-Language header
$lang = al2gt(array_keys(get_translations()), "text/html");
if (defined('_TRANSLATION_OVERRIDE_DEFAULT')) {
$lang = _TRANSLATION_OVERRIDE_DEFAULT;
}
/* In login action of mobile version */
if ($_POST["language"] && defined('MOBILE_VERSION')) {
$lang = $_POST["language"];
} else {
if ($_SESSION["language"] && $_SESSION["language"] != "auto") {
$lang = $_SESSION["language"];
}
}
if ($lang) {
if (defined('LC_MESSAGES')) {
_setlocale(LC_MESSAGES, $lang);
} else {
if (defined('LC_ALL')) {
_setlocale(LC_ALL, $lang);
}
}
if (defined('MOBILE_VERSION')) {
_bindtextdomain("messages", "../locale");
} else {
_bindtextdomain("messages", "locale");
}
_textdomain("messages");
_bind_textdomain_codeset("messages", "UTF-8");
}
}
示例3: get_country_id
<?php
include BASE_PATH . 'app/utils/initialize.php';
$country_id = get_country_id($first);
echo $twig->render('article.html', array('data' => $data, 'utils' => $utils, 'link' => get_article_link($url), 'countries' => get_countries($first), 'translations' => get_translations($country_id)));
示例4: index
//.........这里部分代码省略.........
}
$type_name = $line["type_name"];
$pref_name = $line["pref_name"];
$section_name = $this->getSectionName($line["section_id"]);
$value = $line["value"];
$short_desc = $this->getShortDesc($pref_name);
$help_text = $this->getHelpText($pref_name);
if (!$short_desc) {
continue;
}
if ($_SESSION["profile"] && in_array($line["pref_name"], $profile_blacklist)) {
continue;
}
if ($active_section != $line["section_id"]) {
if ($active_section != "") {
print "</table>";
}
print "<table width=\"100%\" class=\"prefPrefsList\">";
$active_section = $line["section_id"];
print "<tr><td colspan=\"3\"><h3>" . $section_name . "</h3></td></tr>";
$lnum = 0;
}
print "<tr>";
print "<td width=\"40%\" class=\"prefName\" id=\"{$pref_name}\">";
print "<label for='CB_{$pref_name}'>";
print $short_desc;
print "</label>";
if ($help_text) {
print "<div class=\"prefHelp\">" . __($help_text) . "</div>";
}
print "</td>";
print "<td class=\"prefValue\">";
if ($pref_name == "USER_LANGUAGE") {
print_select_hash($pref_name, $value, get_translations(), "style='width : 220px; margin : 0px' dojoType='dijit.form.Select'");
} else {
if ($pref_name == "USER_TIMEZONE") {
$timezones = explode("\n", file_get_contents("lib/timezones.txt"));
print_select($pref_name, $value, $timezones, 'dojoType="dijit.form.FilteringSelect"');
} else {
if ($pref_name == "USER_STYLESHEET") {
print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\t\tonclick=\"customizeCSS()\">" . __('Customize') . "</button>";
} else {
if ($pref_name == "USER_CSS_THEME") {
$themes = array_map("basename", glob("themes/*.css"));
print_select($pref_name, $value, $themes, 'dojoType="dijit.form.Select"');
} else {
if ($pref_name == "DEFAULT_UPDATE_INTERVAL") {
global $update_intervals_nodefault;
print_select_hash($pref_name, $value, $update_intervals_nodefault, 'dojoType="dijit.form.Select"');
} else {
if ($type_name == "bool") {
array_push($listed_boolean_prefs, $pref_name);
$checked = $value == "true" ? "checked=\"checked\"" : "";
if ($pref_name == "PURGE_UNREAD_ARTICLES" && FORCE_ARTICLE_PURGE != 0) {
$disabled = "disabled=\"1\"";
$checked = "checked=\"checked\"";
} else {
$disabled = "";
}
print "<input type='checkbox' name='{$pref_name}' {$checked} {$disabled}\n\t\t\t\t\tdojoType='dijit.form.CheckBox' id='CB_{$pref_name}' value='1'>";
} else {
if (array_search($pref_name, array('FRESH_ARTICLE_MAX_AGE', 'PURGE_OLD_DAYS', 'LONG_DATE_FORMAT', 'SHORT_DATE_FORMAT')) !== false) {
$regexp = $type_name == 'integer' ? 'regexp="^\\d*$"' : '';
if ($pref_name == "PURGE_OLD_DAYS" && FORCE_ARTICLE_PURGE != 0) {
$disabled = "disabled=\"1\"";
$value = FORCE_ARTICLE_PURGE;
示例5: __
echo __("Password:");
?>
</td>
<td align="right"><input type="password" name="password"
onchange="fetchProfiles()" onfocus="fetchProfiles()"
value="<?php
echo get_remote_fakepass($link);
?>
"></td></tr>
<tr><td align="right"><?php
echo __("Language:");
?>
</td>
<td align="right">
<?php
print_select_hash("language", $_COOKIE["ttrss_lang"], get_translations(), "style='width : 100%' onchange='languageChange(this)'");
?>
</td></tr>
<tr><td align="right"><?php
echo __("Profile:");
?>
</td>
<td align="right" id="profile_box">
<select style='width : 100%' disabled='1'>
<option><?php
echo __("Default profile");
?>
</option></select>
</td></tr>
示例6: __
</label>
<input type="password" name="password" required="1"
style="width : 220px" class="input"
value="<?php
echo $_SESSION["fake_password"];
?>
"/>
</div>
<div class="row">
<label><?php
echo __("Language:");
?>
</label>
<?php
print_select_hash("language", $_COOKIE["ttrss_lang"], get_translations(), "style='width : 220px; margin : 0px' dojoType='dijit.form.Select'");
?>
</div>
<div class="row">
<label><?php
echo __("Profile:");
?>
</label>
<span id='profile_box'><select disabled='disabled' dojoType='dijit.form.Select'
style='width : 220px; margin : 0px'>
<option><?php
echo __("Default profile");
?>
</option></select></span>
示例7: sharepopup
//.........这里部分代码省略.........
placeholder='Alpha, Beta, Gamma' value="">
</td></tr>
<tr><td>
<div class="autocomplete" id="labels_choices"
style="display : block"></div></td></tr>
<script type='text/javascript'>document.forms[0].title.focus();</script>
<script type='text/javascript'>
new Ajax.Autocompleter('labels_value', 'labels_choices',
"backend.php?op=rpc&method=completeLabels",
{ tokens: ',', paramName: "search" });
</script>
<tr><td colspan='2'>
<div style='float : right' class='insensitive-small'>
<?php
echo __("Shared article will appear in the Published feed.");
?>
</div>
<button type="submit"><?php
echo __('Share');
?>
</button>
<button onclick="return window.close()"><?php
echo __('Cancel');
?>
</button>
</div>
</form>
</td></tr></table>
</body></html>
<?php
}
} else {
$return = urlencode($_SERVER["REQUEST_URI"]);
?>
<form action="public.php?return=<?php
echo $return;
?>
"
method="POST" id="loginForm" name="loginForm">
<input type="hidden" name="op" value="login">
<table height='100%' width='100%'><tr><td colspan='2'>
<h1><?php
echo __("Not logged in");
?>
</h1></td></tr>
<tr><td align="right"><?php
echo __("Login:");
?>
</td>
<td align="right"><input name="login"
value="<?php
echo $_SESSION["fake_login"];
?>
"></td></tr>
<tr><td align="right"><?php
echo __("Password:");
?>
</td>
<td align="right"><input type="password" name="password"
value="<?php
echo $_SESSION["fake_password"];
?>
"></td></tr>
<tr><td align="right"><?php
echo __("Language:");
?>
</td>
<td align="right">
<?php
print_select_hash("language", $_COOKIE["ttrss_lang"], get_translations(), "style='width : 100%''");
?>
</td></tr>
<tr><td colspan='2'>
<button type="submit">
<?php
echo __('Log in');
?>
</button>
<button onclick="return window.close()">
<?php
echo __('Cancel');
?>
</button>
</td></tr>
</table>
</form>
<?php
}
}
示例8: __n
function __n($singular, $plural, $count, $domain = 'default')
{
$translations =& get_translations($domain);
return $translations->translate_plural($singular, $plural, $count);
}
示例9: dir
//Open directory
$path = $csd . "/../assets/data/";
$dir = dir($path);
//List files in directory
while (($file = $dir->read()) !== false) {
//Make sure it's a .txt file
if (strlen($file) < 5 or $file == ".DS_Store") {
continue;
}
$yaml .= file_get_contents($path . $file);
$yaml .= "\n";
}
$dir->close();
$parsed = Spyc::YAMLLoad($yaml);
if (!empty($parsed['translations_url']) && strlen($parsed['translations_url']) > 0) {
$parsed['translations'] = get_translations($parsed['translations_url']);
}
// if(!empty($parsed['linkedData'])){
// foreach ($parsed['linkedData'] as $key => $link) {
// $parsed[$key] = get_spreadsheetData($link, $key);
// }
// }
$_SESSION = $parsed;
$_SESSION['prototype'] = $csd;
}
// Handle datachanges
$sessiondata = "";
if (!empty($_POST['session'])) {
foreach ($_POST['session'] as $key => $postSession) {
setSessionVar($key, $postSession);
$sessiondata .= print_r($postSession, true);
示例10: get_country_id
<?php
include BASE_PATH . 'app/utils/initialize.php';
$country_id = get_country_id($first);
echo $twig->render('index.html', array('data' => $data, 'utils' => $utils, 'countries' => get_countries($first), 'articles' => get_articles($country_id), 'authors' => get_unique_authors($country_id), 'translations' => get_translations($country_id)));
?>