Fetch a native language string from the i18n class via a passed locale
in the format "XX_xx". In the event a match cannot be found in any framework
resource, an empty string is returned.
public static locale_native_name ( string $locale ) : string | ||
$locale | string | e.g. "pt_BR" |
Результат | string | The native language string for that locale e.g. "português (Brazil)" |
/** * Retrieves information about this object in the specified locale * * @param string $locale The locale information to request, or null to use the default locale * @return ArrayData Mapped list of locale properties */ public function LocaleInformation($locale = null) { // Check locale if (empty($locale)) { $locale = Fluent::default_locale(); } // Check linking mode $linkingMode = 'link'; if ($this->owner->hasMethod('canViewInLocale') && !$this->owner->canViewInLocale($locale)) { $linkingMode = 'invalid'; } elseif ($locale === Fluent::current_locale()) { $linkingMode = 'current'; } // Check link $link = $this->owner->LocaleLink($locale); // Store basic locale information $data = array('Locale' => $locale, 'LocaleRFC1766' => i18n::convert_rfc1766($locale), 'Alias' => Fluent::alias($locale), 'Title' => i18n::get_locale_name($locale), 'LanguageNative' => Fluent::locale_native_name($locale), 'Link' => $link, 'AbsoluteLink' => $link ? Director::absoluteURL($link) : null, 'LinkingMode' => $linkingMode); return new ArrayData($data); }