MessageFormatter::getLocale

(PHP 5 >= 5.3.0, PHP 7, PECL intl >= 1.0.0)
Get the locale for which the formatter was created.
public string MessageFormatter::getLocale ( void )

Object oriented style

Procedural style

string msgfmt_get_locale ( NumberFormatter $formatter )

Get the locale for which the formatter was created.

Parameters:
formatter

The formatter resource

Returns:

The locale name

Examples:
msgfmt_get_locale() example
1
2
3
4
<?php
$fmt = msgfmt_create('en_US'"Number {0,number}");
echo msgfmt_get_locale($fmt);
?>
OO example
1
2
3
4
<?php
$fmt new MessageFormatter('en_US'"Number {0,number}");
echo $fmt->getLocale();
?>
See also:

msgfmt_create() -

doc_php
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.