本文整理汇总了PHP中setLocale函数的典型用法代码示例。如果您正苦于以下问题:PHP setLocale函数的具体用法?PHP setLocale怎么用?PHP setLocale使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setLocale函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
/**
* Locale is enabled and allowed to be changed
*/
if (config('locale.status')) {
if (session()->has('locale') && in_array(session()->get('locale'), array_keys(config('locale.languages')))) {
/**
* Set the Laravel locale
*/
app()->setLocale(session()->get('locale'));
/**
* setLocale for php. Enables ->formatLocalized() with localized values for dates
*/
setLocale(LC_TIME, config('locale.languages')[session()->get('locale')][1]);
/**
* setLocale to use Carbon source locales. Enables diffForHumans() localized
*/
Carbon::setLocale(config('locale.languages')[session()->get('locale')][0]);
/**
* Set the session variable for whether or not the app is using RTL support
* for the current language being selected
* For use in the blade directive in BladeServiceProvider
*/
if (config('locale.languages')[session()->get('locale')][2]) {
session(['lang-rtl' => true]);
} else {
session()->forget('lang-rtl');
}
}
}
return $next($request);
}
开发者ID:blomdahldaniel,项目名称:laravel-5-boilerplate,代码行数:40,代码来源:LocaleMiddleware.php
示例2: boot
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
/**
* Application locale defaults for various components
*
* These will be overridden by LocaleMiddleware if the session local is set
*/
/**
* setLocale for php. Enables ->formatLocalized() with localized values for dates
*/
setLocale(LC_TIME, config('app.locale_php'));
/**
* setLocale to use Carbon source locales. Enables diffForHumans() localized
*/
Carbon::setLocale(config('app.locale'));
/**
* Set the session variable for whether or not the app is using RTL support
* For use in the blade directive in BladeServiceProvider
*/
if (config('locale.languages')[config('app.locale')][2]) {
session(['lang-rtl' => true]);
} else {
session()->forget('lang-rtl');
}
}
开发者ID:blomdahldaniel,项目名称:laravel-5-boilerplate,代码行数:30,代码来源:AppServiceProvider.php
示例3: __construct
/**
* Constructs the Website. Page- and theme-specific logic won't be loaded yet.
*/
function __construct()
{
// We're loaded (included files test for the existance this constant)
define("WEBSITE", "Loaded");
// Site settings and database connection
$this->config = new Config(dirname(dirname(__DIR__)) . '/' . self::CONFIG_FILE);
$this->text = new Text(new Uri($this->getConfig()->get('url_web')), $this->getUriTranslations(Config::DEFAULT_LANGUAGE), $this->getUrlJavaScripts());
// Connect to database, read settings
try {
$dataSource = "mysql:dbname={$this->config->get(Config::OPTION_DATABASE_NAME)};host={$this->config->get(Config::OPTION_DATABASE_HOST)}";
$this->databaseObject = new TablePrefixedPDO($dataSource, $this->config->get(Config::OPTION_DATABASE_USER), $this->config->get(Config::OPTION_DATABASE_PASSWORD), ["table_prefix" => $this->config->get(Config::OPTION_DATABASE_TABLE_PREFIX)]);
$this->databaseObject->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->databaseObject->prefixTables(["categories", "users", "links", "artikel", "comments", "menus", "widgets", "documents", "settings", "gebruikers", "reacties", "categorie"]);
$this->config->readFromDatabase($this->databaseObject);
} catch (PDOException $e) {
// No database connection - safe to ignore this error, as the page
// renderer will start the installation procedure, based on the lack
// of settings
$this->text->addError($this->text->tReplaced("install.no_database_connection", $e->getMessage()));
}
// Set updated properties of Text object, now that settings are read
// from the database
$this->text->setTranslationsDirectory($this->getUriTranslations($this->config->get("language")));
$this->text->setUrlRewrite($this->config->get("url_rewrite"));
// Init other objects
if ($this->databaseObject == null) {
$this->authenticationObject = new Authentication($this, null);
} else {
$this->authenticationObject = new Authentication($this, new UserRepository($this->databaseObject));
}
$this->themesObject = new ThemeManager($this);
// Locales
setLocale(LC_ALL, explode("|", $this->text->t("main.locales")));
}
开发者ID:rutgerkok,项目名称:rCMS,代码行数:37,代码来源:Website.php
示例4: it_is_able_to_detect_language_code_based_on_environment_settings
function it_is_able_to_detect_language_code_based_on_environment_settings()
{
$previousLocale = setlocale(LC_ALL, 0);
setLocale(LC_TIME, 'de_DE.UTF-8');
$this->detectLanguage()->shouldContain('de');
setlocale(LC_ALL, $previousLocale);
}
开发者ID:technodelight,项目名称:php-time-ago,代码行数:7,代码来源:TranslationLoaderSpec.php
示例5: replaceAccentedCharacters
public static function replaceAccentedCharacters($string)
{
$currentLocale = setlocale(LC_ALL, NULL);
setlocale(LC_ALL, 'en_US.UTF8');
$cleanedString = iconv('UTF-8', 'ASCII//TRANSLIT', $string);
setLocale(LC_ALL, $currentLocale);
return $cleanedString;
}
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:8,代码来源:MRManagement.php
示例6: formatMoney
public function formatMoney($price = 0.0, $currency = 'USD')
{
$def = "en_US";
//get the locale from the currency code
$c = array("USD" => "en_US", "EUR" => "de_DE", "AUS" => "en_AU", "GBP" => "en_GB", "BRZ" => "pt_BR", "CAD" => "en_CA");
$cLocale = $c[$currency];
setLocale(LC_MONETARY, $cLocale);
$s = money_format("%#1n", $price);
setLocale(LC_MONETARY, "en_US");
return $s;
}
开发者ID:josephbergdoll,项目名称:berrics,代码行数:11,代码来源:StoreHelper.php
示例7: replaceAccentedCharacters
public static function replaceAccentedCharacters($string)
{
if (function_exists('iconv')) {
$currentLocale = setlocale(LC_ALL, NULL);
setlocale(LC_ALL, 'en_US.UTF8');
$cleanedString = iconv('UTF-8', 'ASCII//TRANSLIT', $string);
setLocale(LC_ALL, $currentLocale);
} else {
$cleanedString = strtr($string, 'àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ', 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY');
}
return $cleanedString;
}
开发者ID:srikanthash09,项目名称:codetestdatld,代码行数:12,代码来源:MRTools.php
示例8: setLocale
/**
* Set Locale
*
* Example:
* <code>
* I18Nv2::setLocale('en_GB');
* </code>
*
* @static
* @access public
* @return mixed &type.string; used locale or false on failure
* @param string $locale a valid locale like en_US or de_DE
* @param int $cat the locale category - usually LC_ALL
*/
static function setLocale($locale = null, $cat = LC_ALL)
{
if (!strlen($locale)) {
return setLocale($cat, null);
}
$locales = I18Nv2::getStaticProperty('locales');
// get complete standard locale code (en => en_US)
if (isset($locales[$locale])) {
$locale = $locales[$locale];
}
// get Win32 locale code (en_US => enu)
if (I18Nv2_WIN) {
$windows = I18Nv2::getStaticProperty('windows');
$setlocale = isset($windows[$locale]) ? $windows[$locale] : $locale;
} else {
$setlocale = $locale;
}
$syslocale = setLocale($cat, $setlocale);
// if the locale is not recognized by the system, check if there
// is a fallback locale and try that, otherwise return false
if (!$syslocale) {
$fallbacks =& I18Nv2::getStaticProperty('fallbacks');
if (isset($fallbacks[$locale])) {
// avoid endless recursion with circular fallbacks
$trylocale = $fallbacks[$locale];
unset($fallbacks[$locale]);
if ($retlocale = I18Nv2::setLocale($trylocale, $cat)) {
$fallbacks[$locale] = $trylocale;
return $retlocale;
}
}
return false;
}
$language = substr($locale, 0, 2);
if (I18Nv2_WIN) {
@putEnv('LANG=' . $language);
@putEnv('LANGUAGE=' . $language);
} else {
@putEnv('LANG=' . $locale);
@putEnv('LANGUAGE=' . $locale);
}
// unshift locale stack
$last =& I18Nv2::getStaticProperty('last');
array_unshift($last, array(0 => $locale, 1 => $language, 2 => $syslocale, 'locale' => $locale, 'language' => $language, 'syslocale' => $syslocale));
// fetch locale specific information
$info =& I18Nv2::getStaticProperty('info');
$info = localeConv();
//For some reason Windows can return bogus locale data where frac_digits is 127, in that case just fall back to default english values
if (isset($info['frac_digits']) and $info['frac_digits'] == 127) {
$info = array('decimal_point' => '.', 'thousands_sep' => ',', 'int_curr_symbol' => '', 'currency_symbol' => '$', 'mon_decimal_point' => '.', 'mon_thousands_sep' => ',', 'positive_sign' => '', 'negative_sign' => '-', 'int_frac_digits' => 2, 'frac_digits' => 2, 'p_cs_precedes' => 1, 'p_sep_by_space' => 0, 'n_cs_precedes' => 1, 'n_sep_by_space' => 0, 'p_sign_posn' => 1, 'n_sign_posn' => 1, 'grouping' => array(3, 3), 'mon_grouping' => array(3, 3));
}
return $syslocale;
}
开发者ID:alachaum,项目名称:timetrex,代码行数:67,代码来源:I18Nv2.php
示例9: setLocale
/**
* Set Locale
*
* Example:
* <code>
* I18Nv2::setLocale('en_GB');
* </code>
*
* @static
* @access public
* @return mixed &type.string; used locale or false on failure
* @param string $locale a valid locale like en_US or de_DE
* @param int $cat the locale category - usually LC_ALL
*/
function setLocale($locale = null, $cat = LC_ALL)
{
static $triedFallbacks;
if (!strlen($locale)) {
return setLocale($cat, null);
}
$locales = I18Nv2::getStaticProperty('locales');
// get complete standard locale code (en => en_US)
if (isset($locales[$locale])) {
$locale = $locales[$locale];
}
// get Win32 locale code (en_US => enu)
if (I18Nv2_WIN) {
$windows = I18Nv2::getStaticProperty('windows');
$setlocale = isset($windows[$locale]) ? $windows[$locale] : $locale;
} else {
$setlocale = $locale;
}
if (!isset($triedFallbacks[$locale])) {
$triedFallbacks[$locale] = false;
}
$syslocale = setLocale($cat, $setlocale);
// if the locale is not recognized by the system, check if there
// is a fallback locale and try that, otherwise return false
if (!$syslocale) {
if (!$triedFallbacks[$locale]) {
$triedFallbacks[$locale] = $setlocale;
$fallbacks = I18Nv2::getStaticProperty('fallbacks');
if (isset($fallbacks[$locale])) {
return I18Nv2::setLocale($fallbacks[$locale], $cat);
}
}
return false;
}
$language = substr($locale, 0, 2);
if (I18Nv2_WIN) {
@putEnv('LANG=' . $language);
@putEnv('LANGUAGE=' . $language);
} else {
@putEnv('LANG=' . $locale);
@putEnv('LANGUAGE=' . $locale);
}
// unshift locale stack
$last =& I18Nv2::getStaticProperty('last');
array_unshift($last, array(0 => $locale, 1 => $language, 2 => $syslocale, 'locale' => $locale, 'language' => $language, 'syslocale' => $syslocale));
// fetch locale specific information
$info =& I18Nv2::getStaticProperty('info');
$info = localeConv();
return $syslocale;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:64,代码来源:I18Nv2.php
示例10: handle
public function handle($request, Closure $next)
{
$language = $request->route()->parameter('lang');
App::setLocale($language);
// Not super necessary unless you really want to use
// number_format or even money_format.
if ($language == "en") {
setLocale(LC_ALL, "en_US.UTF-8");
} else {
setLocale(LC_ALL, $language . "_CH.UTF-8");
}
View::share('lang', $language);
return $next($request);
}
开发者ID:HE-Arc,项目名称:demo-laravel-application,代码行数:14,代码来源:Localization.php
示例11: boot
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
/**
* Application locale defaults for various components
*
* These will be overridden by LocaleMiddleware if the session local is set
*/
/**
* setLocale for php. Enables ->formatLocalized() with localized values for dates
*/
setLocale(LC_TIME, config('app.locale_php'));
/**
* setLocale to use Carbon source locales. Enables diffForHumans() localized
*/
Carbon::setLocale(config('app.locale'));
}
开发者ID:boviq,项目名称:boviq,代码行数:21,代码来源:AppServiceProvider.php
示例12: quoted_printable_encode
function quoted_printable_encode($str, $wrap = true)
{
$ret = '';
$l = strLen($str);
$current_locale = setLocale(LC_CTYPE, 0);
setLocale(LC_CTYPE, 'C');
for ($i = 0; $i < $l; ++$i) {
$char = $str[$i];
if (ctype_print($char) && !ctype_cntrl($char) && $char !== '=') {
$ret .= $char;
} else {
$ret .= sPrintF('=%02X', ord($char));
}
}
setLocale(LC_CTYPE, $current_locale);
return $wrap ? wordWrap($ret, 67, " =\n") : $ret;
}
开发者ID:rkania,项目名称:GS3,代码行数:17,代码来源:quoted_printable_encode.php
示例13: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
/**
* Locale is enabled and allowed to be changed
*/
if (config('locale.status')) {
if (session()->has('locale') && in_array(session()->get('locale'), array_keys(config('locale.languages')))) {
/**
* Set the Laravel locale
*/
app()->setLocale(session()->get('locale'));
/**
* setLocale for php. Enables ->formatLocalized() with localized values for dates
*/
setLocale(LC_TIME, config('locale.languages')[session()->get('locale')][1]);
/**
* setLocale to use Carbon source locales. Enables diffForHumans() localized
*/
Carbon::setLocale(config('locale.languages')[session()->get('locale')][0]);
}
}
return $next($request);
}
开发者ID:farrukhcw,项目名称:laravel-5-boilerplate,代码行数:30,代码来源:LocaleMiddleware.php
示例14: submitFormData
/**
* Ajax request to submit data
* @param array $request the request
* @return array ajax format status
*/
public function submitFormData($request)
{
$errors = array();
$db = ezcDbInstance::get();
$request = array_merge(array('ac_object_id' => null, 'gc_id' => null), $request);
$request['wo_id'] = null;
$request['ac_id'] = $request['id'];
if (isset($request['mu_name'])) {
$request['mu_id'] = R3EcoGisHelper::getMunicipalityIdByName($this->do_id, $request['mu_name'], $this->auth->getParam('mu_id'));
}
if ($this->act != 'del') {
$request['ac_green_electricity_purchase'] = forceFloat($request['ac_green_electricity_purchase_mwh'], null, '.') * 1000;
// Convert MWh to kWh
$request['ac_co2_reduction'] = forceFloat($request['ac_co2_reduction_tco2'], null, '.') * 1000;
// Convert tCO2 to kCO2
$tmpGesIdConsumption = array();
$tmpEsIdConsumption = array();
$tmpUdmIdConsumption = array();
$tmpAcExpectedEnergySaving = array();
$tmpAcExpectedEnergySavingMwh = array();
for ($i = 0; $i < count($request['es_id_consumption']); $i++) {
if ($request['udm_id_consumption'][$i] != '' || $request['ac_expected_energy_saving'][$i] != '') {
$tmpGesIdConsumption[] = $request['ges_id_consumption'][$i];
$tmpEsIdConsumption[] = $request['es_id_consumption'][$i];
$tmpUdmIdConsumption[] = $request['udm_id_consumption'][$i];
$tmpAcExpectedEnergySaving[] = $request['ac_expected_energy_saving'][$i];
$tmpAcExpectedEnergySavingMwh[] = $request['ac_expected_energy_saving_mwh'][$i];
}
}
$request['ges_id_consumption'] = $tmpGesIdConsumption;
$request['es_id_consumption'] = $tmpEsIdConsumption;
$request['udm_id_consumption'] = $tmpUdmIdConsumption;
$request['ac_expected_energy_saving'] = $tmpAcExpectedEnergySaving;
$request['ac_expected_energy_saving_mwh'] = $tmpAcExpectedEnergySavingMwh;
$request['esu_id_consumption'] = R3EcoGisHelper::getMultipleEnergySourceUdmID($_SESSION['do_id'], $request['es_id_consumption'], $request['udm_id_consumption'], $request['mu_id']);
$request['esu_id_production'] = R3EcoGisHelper::getEnergySourceUdmID($_SESSION['do_id'], $request['es_id_production'], $request['udm_id_production'], $request['mu_id'], true);
$request['emo_id'] = self::getEnergyMeterObjectByID($request['mu_id'], $request['ac_object_id'], $request['gc_id']);
if (isset($request['mu_name']) && $request['mu_name'] != '' && $request['mu_id'] == '') {
$errors['mu_name'] = array('CUSTOM_ERROR' => _('Il comune immesso non è stato trovato'));
}
if (!isset($request['gc_id_parent']) || $request['gc_id_parent'] == '') {
$errors['gc_id_parent'] = array('CUSTOM_ERROR' => _('Il campo "Macro-settore" è obbligatorio'));
}
$errors = $this->checkFormData($request, $errors);
$selectedRelatedActions = array();
if (isset($request['related_required_action_id'])) {
for ($i = 0; $i < count($request['related_required_action_id']); $i++) {
if ($request['related_required_action_id'][$i] > 0 && in_array($request['related_required_action_id'][$i], $selectedRelatedActions)) {
$errors['related_required_action_' . $i] = array('CUSTOM_ERROR' => _("L'azione ") . $this->getActionName($request['related_required_action_id'][$i]) . _(" è già stata selezionata"));
}
array_push($selectedRelatedActions, $request['related_required_action_id'][$i]);
}
}
if (isset($request['related_action_id'])) {
for ($i = 0; $i < count($request['related_action_id']); $i++) {
if ($request['related_action_id'][$i] > 0 && in_array($request['related_action_id'][$i], $selectedRelatedActions)) {
$errors['related_action_' . $i] = array('CUSTOM_ERROR' => _("L'azione ") . $this->getActionName($request['related_action_id'][$i]) . _(" è già stata selezionata"));
}
array_push($selectedRelatedActions, $request['related_action_id'][$i]);
}
}
if (isset($request['related_excluded_action_id'])) {
for ($i = 0; $i < count($request['related_excluded_action_id']); $i++) {
if ($request['related_excluded_action_id'][$i] > 0 && in_array($request['related_excluded_action_id'][$i], $selectedRelatedActions)) {
$errors['related_required_action_' . $i] = array('CUSTOM_ERROR' => _("L'azione ") . $this->getActionName($request['related_excluded_action_id'][$i]) . _(" è già stata selezionata"));
}
array_push($selectedRelatedActions, $request['related_excluded_action_id'][$i]);
}
}
if (isset($request['enable_benefit_year']) && $request['enable_benefit_year'] == 'T' && isset($request['benefit_year'])) {
$startBenefitYear = (int) substr($request['ac_benefit_start_date'], 0, 4);
$endBenefitYear = (int) substr($request['ac_benefit_end_date'], 0, 4);
$lastBenefitPerc = 0;
for ($i = 0; $i < count($request['benefit_year']); $i++) {
if ($request['benefit_year'][$i] != '' && $request['benefit_year'][$i] < $startBenefitYear) {
$errors['benefit_year_' . $i] = array('CUSTOM_ERROR' => sprintf(_("L'anno del beneficio \"%s\" è antecedente al %s (anno inizio beneficio)"), $request['benefit_year'][$i], $startBenefitYear));
} else {
if ($request['benefit_year'][$i] != '' && $request['benefit_year'][$i] > $endBenefitYear) {
$errors['benefit_year_' . $i] = array('CUSTOM_ERROR' => sprintf(_("L'anno del beneficio \"%s\" è oltre al %s (anno fine beneficio)"), $request['benefit_year'][$i], $endBenefitYear));
}
}
if ($request['benefit_benefit'][$i] != '' && $request['benefit_benefit'][$i] < 0 || $request['benefit_benefit'][$i] != '' && $request['benefit_benefit'][$i] > 100) {
$errors['benefit_benefit_' . $i] = array('CUSTOM_ERROR' => _("Il valore del beneficio deve essere compreso tra 0 e 100"));
}
}
}
}
if (count($errors) > 0) {
return $this->getAjaxErrorResult($errors);
} else {
setLocale(LC_ALL, 'C');
$db->beginTransaction();
$id = $this->applyData($request);
$sql = "DELETE FROM ecogis.action_catalog_energy WHERE ac_id=" . $db->quote($id, PDO::PARAM_INT);
$db->exec($sql);
//.........这里部分代码省略.........
开发者ID:r3-gis,项目名称:EcoGIS,代码行数:101,代码来源:obj.action_catalog.php
示例15: format
/**
* For the number for a certain pattern. The valid patterns are
* 'c', 'd', 'e', 'p' or a custom pattern, such as "#.000" for
* 3 decimal places.
* @param mixed the number to format.
* @param string the format pattern, either, 'c', 'd', 'e', 'p'
* or a custom pattern. E.g. "#.000" will format the number to
* 3 decimal places.
* @param string 3-letter ISO 4217 code. For example, the code
* "USD" represents the US Dollar and "EUR" represents the Euro currency.
* @return string formatted number string
*/
function format($number, $pattern = 'd', $currency = 'USD', $charset = 'UTF-8')
{
$oldLocale = setLocale(LC_NUMERIC, '0');
setlocale(LC_NUMERIC, 'C');
$this->setPattern($pattern);
if (strtolower($pattern) == 'p') {
$number = $number * 100;
}
$string = (string) $number;
$decimal = $this->formatDecimal($string);
$integer = $this->formatInteger(abs($number));
if (strlen($decimal) > 0) {
$result = $integer . $decimal;
} else {
$result = $integer;
}
//get the suffix
if ($number >= 0) {
$suffix = $this->formatInfo->PositivePattern;
} else {
if ($number < 0) {
$suffix = $this->formatInfo->NegativePattern;
} else {
$suffix = array("", "");
}
}
//append and prepend suffix
$result = $suffix[0] . $result . $suffix[1];
//replace currency sign
$symbol = @$this->formatInfo->getCurrencySymbol($currency);
if ($symbol === null) {
$symbol = $currency;
}
$result = str_replace('¤', $symbol, $result);
setlocale(LC_NUMERIC, $oldLocale);
return I18N_toEncoding($result, $charset);
}
开发者ID:Nurudeen,项目名称:prado,代码行数:49,代码来源:NumberFormat.php
示例16: setLocale
public function setLocale($locale)
{
if ($this->isWindows()) {
throw new KurogoConfigurationException("Setting locale in Windows is not supported at this time");
}
// this is platform dependent.
if (!($return = setLocale(LC_TIME, $locale))) {
throw new KurogoConfigurationException("Unknown locale setting {$locale}");
}
$this->locale = $return;
return $this->locale;
}
开发者ID:hxfnd,项目名称:Kurogo-Mobile-Web,代码行数:12,代码来源:Kurogo.php
示例17: getSQLFields
public function getSQLFields($data, array &$fields, array &$values)
{
$oldLocale = getLocale();
setLocale(LC_ALL, 'C');
$db = ezcDbInstance::get();
foreach ($this->fields as $key => $field) {
$default = isset($field['default']) ? $field['default'] : null;
if (isset($field['is_primary_key']) && $field['is_primary_key'] === true) {
continue;
// ignore primary key
}
if (isset($field['calculated']) && $field['calculated'] === true) {
continue;
// ignore primary key
}
if (isset($field['name'])) {
$key = $field['name'];
}
$fields[] = $key;
if (isset($field['value'])) {
$values[] = $db->quote($field['value']);
} else {
if ($field['type'] == 'NOW') {
$values[] = 'now()';
} else {
if ($field['type'] == 'UID') {
$values[] = $this->auth->getUID();
} else {
if (isset($data[$key])) {
$values[] = $this->prepareFieldValue($this->act, $key, $data[$key], $field['type'], isset($field['size']) ? $field['size'] : null, $default);
} else {
$values[] = $this->prepareFieldValue($this->act, $key, null, $field['type'], isset($field['size']) ? $field['size'] : null, $default);
}
}
}
}
}
setLocale(LC_ALL, $oldLocale);
}
开发者ID:r3-gis,项目名称:EcoGIS,代码行数:39,代码来源:obj.base_lookup.php
示例18: function
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
return Redirect::to('/br');
});
Route::get('/{locale}', function ($locale) {
App::setLocale($locale);
return view('home');
});
Route::get('/{locale}/login', function ($locale) {
App:
setLocale($locale);
return view('login');
});
开发者ID:ReeSilva,项目名称:vitae,代码行数:24,代码来源:routes.php
示例19: setLang
/**
* set the locale from the lang code
*
* @param string the lang code
* @param category (@see setlocale). Default LC_ALL
* @return boolean return true on success
* @see localeconv
*/
function setLang($lang, $category = LC_ALL)
{
if (($locale = getLocaleByLang($lang)) === null) {
return false;
}
return setLocale($category, $locale);
}
开发者ID:r3-gis,项目名称:EcoGIS,代码行数:15,代码来源:r3locale.php
示例20: phpinfo
phpinfo();
?>
<?php
}
?>
</div>
<h1><a style="color:inherit" href="<?php
echo URL()->addParam('open', 'locale');
?>
">Locales</a></h1>
<div class="be_contentTextBox">
<?php
if ($_GET['open'] == 'locale') {
?>
active: "<?php
echo setLocale(0, 0);
?>
"
<hr>
available on the system:
<pre><?php
system('locale -a');
?>
</pre>
<?php
}
?>
</div>
</div>
</div>
开发者ID:atifzaidi,项目名称:shwups-cms,代码行数:31,代码来源:index.php
注:本文中的setLocale函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论