CakeFest 2024: The Official CakePHP Conference

Locale::getDisplayLanguage

locale_get_display_language

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

Locale::getDisplayLanguage -- locale_get_display_languageGirdi yerelindeki anadil kodunun yerelleştirilmiş ismini döndürür

Açıklama

Nesne yönelimli kullanım

public static Locale::getDisplayLanguage(string $hedef_yerel, ?string $adlandırma_yereli = null): string|false

Yordamsal kullanım

locale_get_display_language(string $hedef_yerel, ?string $adlandırma_yereli = null): string|false

Girdi yerelindeki anadil kodunun yerelleştirilmiş ismini döndürür. adlandırma_yereli null ise öntanımlı yerel kullanılır.

Bağımsız Değişkenler

hedef_yerel

Anadil adı döndürülecek yerel.

adlandırma_yereli

İsteğe bağlı olarak anadil isminin gösteriminde kullanılacak yerel.

Dönen Değerler

hedef_yerel ile belirtilen yerelin anadil kodunun adlandırma_yereli ile belirtilen yereldeki ismi döner, başarısızlık durumunda false döner.

Sürüm Bilgisi

Sürüm: Açıklama
8.0.0 adlandırma_yereli artık null olabiliyor.

Örnekler

Örnek 1 - locale_get_display_language() örneği

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

Örnek 2 - Nesne yönelimli kullanım örneği

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

Yukarıdaki örneğin çıktısı:

Slovenian;
slovène;
Slovence

Ayrıca Bakınız

add a note

User Contributed Notes 2 notes

up
1
jake at qzdesign dot co dot uk
4 years ago
If `$locale` is invalid, the return value is actually the value of `$locale`, not `NULL` or `FALSE` as you might expect.

(If `$in_locale` is invalid, but `$locale` is valid, the return value is the language name in the default locale.)
up
-10
heitor dot siller at gmail dot com
12 years ago
To display special characters correctly in a web browser, it's a good idea to decode the result data with utf8_decode:

<?php

echo utf8_decode(Locale::getDisplayLanguage('sl-Latn-IT-nedis', 'fr'));

echo
utf8_decode(Locale::getDisplayLanguage('sl-Latn-IT-nedis', 'pt-BR'));

?>
To Top