Locale::getDisplayVariant

locale_get_display_variant

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

Locale::getDisplayVariant -- locale_get_display_variant入力ロケールの変化形の表示名を、適切に地域化して返す

説明

オブジェクト指向型

publicstaticLocale::getDisplayVariant(string$locale, ?string$displayLocale = null): string|false

手続き型

locale_get_display_variant(string$locale, ?string$displayLocale = null): string|false

入力ロケールの変化形の表示名を、適切に地域化して返します。 null の場合はデフォルトのロケールを使用します。

パラメータ

locale

表示変化形を返したいロケール。

displayLocale

オプションのフォーマットロケール。 変化形の表示に使用します。

戻り値

locale に対応する変化形の表示名を、 displayLocale にあわせた形式で返します。 失敗した場合に false を返します

変更履歴

バージョン説明
8.0.0displayLocale は、nullable になりました。

例1 locale_get_display_variant() の例

<?php
echo locale_get_display_variant('sl-Latn-IT-nedis', 'en');
echo
";\n";
echo
locale_get_display_variant('sl-Latn-IT-nedis', 'fr');
echo
";\n";
echo
locale_get_display_variant('sl-Latn-IT-nedis', 'de');
?>

例2 オブジェクト指向の例

<?php
echo Locale::getDisplayVariant('sl-Latn-IT-nedis', 'en');
echo
";\n";
echo
Locale::getDisplayVariant('sl-Latn-IT-nedis', 'fr');
echo
";\n";
echo
Locale::getDisplayVariant('sl-Latn-IT-nedis', 'de');
?>

上の例の出力は以下となります。

Natisone dialect; dialecte de Natisone; NEDIS

参考

To Top