本文整理汇总了PHP中_locale_get_predefined_list函数的典型用法代码示例。如果您正苦于以下问题:PHP _locale_get_predefined_list函数的具体用法?PHP _locale_get_predefined_list怎么用?PHP _locale_get_predefined_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_locale_get_predefined_list函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hpoFormater
/**
* Formata uma consulta SQL em um vetor para header PO
* @param resource $linha
* @param bolean $reset - reinicia a data
* @return multitype:NULL string unknown
*/
function hpoFormater($linha, $reset = false)
{
static $udate = NULL;
global $language;
if ($reset == true) {
$udate = NULL;
}
if (!$udate) {
$udate = $linha['ultima_alter'];
}
$udate = $udate > $linha['ultima_alter'] ? $udate : $linha['ultima_alter'];
$team = _locale_get_predefined_list();
$arg = array('Project-Id-Version' => $linha['version'], 'POT-Creation-Date' => $linha['pot'], 'PO-Revision-Date' => $udate, 'Last-Translator' => $linha['ultimo_tradutor'], 'Language' => $linha['language'], 'Language-Team' => $team[$linha['language']][0], 'MIME-Version' => '1.0', 'Content-Type' => 'text/plain; charset=utf-8', 'Content-Transfer-Encoding' => $language['language']->encoding . 'bit', 'Plural-Forms' => "nplurals=" . $language['language']->plurals . "; plural=" . $language['language']->formula . ";");
return $arg;
}
示例2: install_select_locale_form
/**
* Form API array definition for language selection.
*/
function install_select_locale_form(&$form_state, $locales)
{
include_once './includes/locale.inc';
$languages = _locale_get_predefined_list();
foreach ($locales as $locale) {
// Try to use verbose locale name
$name = $locale->name;
if (isset($languages[$name])) {
$name = $languages[$name][0] . (isset($languages[$name][1]) ? ' ' . st('(@language)', array('@language' => $languages[$name][1])) : '');
}
$form['locale'][$locale->name] = array('#type' => 'radio', '#return_value' => $locale->name, '#default_value' => $locale->name == 'en' ? TRUE : FALSE, '#title' => $name . ($locale->name == 'en' ? ' ' . st('(built-in)') : ''), '#parents' => array('locale'));
}
$form['submit'] = array('#type' => 'submit', '#value' => st('Select language'));
return $form;
}
示例3: install_select_locale_form
/**
* Form API array definition for language selection.
*/
function install_select_locale_form($form, &$form_state, $locales, $profilename = 'standard')
{
include_once DRUPAL_ROOT . '/includes/iso.inc';
$languages = _locale_get_predefined_list();
foreach ($locales as $locale) {
// Try to use verbose locale name
$name = $locale->name;
if (isset($languages[$name])) {
$name = $languages[$name][0] . (isset($languages[$name][1]) ? ' ' . st('(@language)', array('@language' => $languages[$name][1])) : '');
}
$form['locale'][$locale->name] = array('#type' => 'radio', '#return_value' => $locale->name, '#default_value' => $locale->name == 'en' ? 'en' : '', '#title' => $name . ($locale->name == 'en' ? ' ' . st('(built-in)') : ''), '#parents' => array('locale'));
}
if ($profilename == 'standard') {
$form['help'] = array('#markup' => '<p><a href="install.php?profile=' . $profilename . '&localize=true">' . st('Learn how to install Drupal in other languages') . '</a></p>');
}
$form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions')));
$form['actions']['submit'] = array('#type' => 'submit', '#value' => st('Save and continue'));
return $form;
}
示例4: languageCreate
/**
* {@inheritdoc}
*/
public function languageCreate(\stdClass $language)
{
if (!module_exists('locale')) {
throw new \Exception(sprintf("%s::%s line %s: This driver requires the 'locale' module be enabled in order to create languages", get_class($this), __FUNCTION__, __LINE__));
}
include_once DRUPAL_ROOT . '/includes/iso.inc';
include_once DRUPAL_ROOT . '/includes/locale.inc';
// Get all predefined languages, regardless if they are enabled or not.
$predefined_languages = _locale_get_predefined_list();
// If the language code is not valid then throw an InvalidArgumentException.
if (!isset($predefined_languages[$language->langcode])) {
throw new InvalidArgumentException("There is no predefined language with langcode '{$language->langcode}'.");
}
// Enable a language only if it has not been enabled already.
$enabled_languages = locale_language_list();
if (!isset($enabled_languages[$language->langcode])) {
locale_add_language($language->langcode);
return $language;
}
return FALSE;
}
示例5: removeLanguageNegotiationSuffix
/**
* Remove language negotiation suffix from the end of the URL, if any.
*
* @param string $url
* Requested URL.
*
* @return string
* Sanitized URL.
*/
protected function removeLanguageNegotiationSuffix($url)
{
include_once DRUPAL_ROOT . '/includes/iso.inc';
$languages = implode('|_', array_keys(_locale_get_predefined_list()));
$sanitized_url = preg_replace("/(_{$languages})\$/i", '', $url);
if ($sanitized_url == $url) {
$this->setDebugHeader('Language suffix not found');
}
return $sanitized_url;
}
示例6: languageCreate
/**
* {@inheritdoc}
*/
public function languageCreate(\stdClass $language)
{
include_once DRUPAL_ROOT . '/includes/iso.inc';
include_once DRUPAL_ROOT . '/includes/locale.inc';
// Get all predefined languages, regardless if they are enabled or not.
$predefined_languages = _locale_get_predefined_list();
// If the language code is not valid then throw an InvalidArgumentException.
if (!isset($predefined_languages[$language->langcode])) {
throw new InvalidArgumentException("There is no predefined language with langcode '{$language->langcode}'.");
}
// Enable a language only if it has not been enabled already.
$enabled_languages = locale_language_list();
if (!isset($enabled_languages[$language->langcode])) {
locale_add_language($language->langcode);
return $language;
}
return FALSE;
}
示例7: getLanguageURL
/**
* Extrai o prefixo e refaz a query
* @param array $query - Comum $_GET[q]
* @return string array [novo array,prefixo]
*/
function getLanguageURL($query)
{
$args = explode('/', $query);
$a = array_intersect($args, array_keys(_locale_get_predefined_list()));
if ($a) {
$prefix = $args[key($a)];
unset($args[key($a)]);
}
$out[0] = implode('/', $args);
$out[1] = $prefix;
return $out;
}
示例8: foreach
<?php
$files = `pacman -Qql drupal | egrep '(bootstrap|iso).inc'`;
foreach (preg_split("/\\s+/", $files) as $file) {
if (!empty($file)) {
require $file;
}
}
echo '( ';
foreach (_locale_get_predefined_list() as $key => $names) {
echo "[{$key}]=\"{$names['0']}\" ";
}
echo ')';
示例9: GetLanguage
private function GetLanguage()
{
//negociar a tradução o GET sempre tem prioridade.
if ($this->perfil->MEMBER_ID > 0 && isset($languages[$this->perfil->language])) {
$this->cfg['language_default'] = $this->cfg['language'][$this->perfil->language];
} elseif (isset($this->cfg['language'][$this->cfg['country_lng']])) {
$this->cfg['language_default'] = $this->cfg['language'][$this->cfg['country_lng']];
}
if (isset($_GET['q'])) {
$args = explode('/', $_GET['q']);
if (array_key_exists($args[0], _locale_get_predefined_list())) {
$prefix = array_shift($args);
if ($this->cfg['language'][$prefix]) {
$this->cfg['language_default'] = $this->cfg['language'][$prefix];
} else {
$this->cfg['language_default'] = language_default();
}
$_GET['q'] = implode('/', $args);
}
}
if (!$this->language['language_default']) {
$this->cfg['language_default'] = language_default();
}
}