« IntlCalendar::getLeastMaximum
IntlCalendar::getMaximum »

IntlCalendar::getLocale

(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)

IntlCalendar::getLocale — オブジェクトに関連付けられたロケールを取得する

説明

オブジェクト指向型

public function IntlCalendar::getLocale(int $type): string|false

手続き型

function intlcal_get_locale(IntlCalendar $calendar, int $type): string|false

カレンダーオブジェクトが使っているロケールを返します。

パラメータ

calendar

IntlCalendar クラスのインスタンス。

type

実際のロケール (カレンダーデータの元になったロケール。 Locale::ACTUAL_LOCALE) または有効なロケールを取得するかどうか。 つまり、指定されたロケールに対して ICU が比較的サポートしている、 もっとも特殊なロケールです - 詳細は Locale::VALID_LOCALE を参照ください。 ロケールは実際のロケール、有効なロケール、 指定されたロケールの順に並び、 さらにもっとも一般的なものから、もっとも特殊なものへ並びます。

戻り値

ロケールを表す文字列を返します。 失敗した場合に false を返します.

例

例1 IntlCalendar::getLocale()

<?php
$cal = IntlCalendar::createInstance(IntlTimeZone::getGMT(), 'en_US_CALIFORNIA');
var_dump(
    $cal->getLocale(Locale::ACTUAL_LOCALE),
    $cal->getLocale(Locale::VALID_LOCALE)
);

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

string(2) "en"
string(5) "en_US"

関連キーワード:
ロケール   IntlCalendar   getLocale   Locale   関連   type   calendar   カレンダー   実際   getLeastMaximum   getMaximum   オブジェクト指向   手続き   intlcal   locale   インスタンス   比較的   サポート   詳細   一般的   createInstance   IntlTimeZone   getGMT   dump
関連する関数・ページ:
intlcalendar.getavailablelocales   intlcalendar.getfirstdayofweek   intlcalendar.get   intlcalendar.getmaximum   intlcalendar.getminimum   intlcalendar.isset