MessageFormatter::getLocale

msgfmt_get_locale

(PHP 5 >= 5.3.0, PHP 7, PECL intl >= 1.0.0)

MessageFormatter::getLocale -- msgfmt_get_localeGet the locale for which the formatter was created

说明

面向对象风格

public MessageFormatter::getLocale ( void ) : string

过程化风格

msgfmt_get_locale ( NumberFormatter $formatter ) : string

Get the locale for which the formatter was created.

参数

formatter

The formatter resource

返回值

The locale name

范例

Example #1 msgfmt_get_locale() example

<?php
$fmt 
msgfmt_create('en_US'"Number {0,number}");
echo 
msgfmt_get_locale($fmt);
?>

Example #2 OO example

<?php
$fmt 
= new MessageFormatter('en_US'"Number {0,number}");
echo 
$fmt->getLocale();
?>

以上例程会输出:

en_US

参见

相关文章
php map creates a new map using a callable to determine which pairs to includephp sequence creates a new sequence using a callable to determine which values to includephp mysqlnd qc 函数 installs a callback which decides whether a statement is cachedphp svn 函数 returns the revision in which path under fsroot was createdphp intlcalendar get time of the day at which weekend begins or endsphp intldateformatter get copy of formatterʼs calendar objectphp intldateformatter get the locale used by formatterphp locale searches the language tag list for the best match to the languagephp memcached check if the instance was recently createdphp messageformatter constructs a new message formatterphp messageformatter get the locale for which the formatter was createdphp messageformatter get the pattern used by the formatterphp messageformatter set the pattern used by the formatterphp mongodb driver monitoring commandfailedevent returns the server on which the command was executedphp mongodb driver monitoring commandstartedevent returns the database on which the command was executedphp mongodb driver monitoring commandstartedevent returns the server on which the command was executedphp mongodb driver monitoring commandsucceededevent returns the server on which the command was executedphp numberformatter get formatter localephp solrquery sets the factor by which the regex fragmenter can stray from the ideal fragment sizephp splobjectstorage returns the index at which the iterator currently is
关注编程学问公众号