Native Locale Names | Laravel Lang

Laravel Lang Help

Native Locale Names

Installation

To install, run the console command:

composer require laravel-lang/native-locale-names

Usage

Localized Names

use LaravelLang\NativeLocaleNames\LocaleNames; use LaravelLang\LocaleList\Locale; return LocaleNames::get('bn'); // or return LocaleNames::get(Locale::Bengali)

Result:

[ 'af' => 'আফ্রিকান', 'ak' => 'আকান', 'am' => 'আমহারিক', 'ar' => 'আরবী', 'as' => 'অসমীয়া', 'az' => 'আজারবাইজানী', 'be' => 'বেলারুশিয়', 'bg' => 'বুলগেরিয়', 'bho' => 'ভোজপুরি', 'bm' => 'বামবারা', 'bn' => 'বাংলা', 'bs' => 'বসনীয়', 'ca' => 'কাতালান', 'ceb' => 'চেবুয়ানো', 'ckb' => 'মধ্য কুর্দিশ', 'cs' => 'চেক', 'cy' => 'ওয়েলশ', 'da' => 'ডেনিশ', 'de' => 'জার্মান', 'de_CH' => 'জার্মান (সুইজারল্যান্ড)', 'doi' => 'ডোগরি', 'ee' => 'ইউয়ি', 'el' => 'গ্রিক', 'en' => 'ইংরেজি', 'eo' => 'এস্পেরান্তো', 'es' => 'স্প্যানিশ', 'et' => 'এস্তোনীয়', 'eu' => 'বাস্ক', 'fa' => 'ফার্সি', 'fi' => 'ফিনিশ', 'fil' => 'ফিলিপিনো', 'fr' => 'ফরাসি', 'fy' => 'পশ্চিম ফ্রিসিয়ান', 'ga' => 'আইরিশ', 'gd' => 'স্কটিশ-গ্যেলিক', 'gl' => 'গ্যালিশিয়', 'gu' => 'গুজরাটি', 'ha' => 'হাউসা', 'haw' => 'হাওয়াইয়ান', 'he' => 'হিব্রু', 'hi' => 'হিন্দি', 'hr' => 'ক্রোয়েশীয়', 'hu' => 'হাঙ্গেরীয়', 'hy' => 'আর্মেনিয়', 'id' => 'ইন্দোনেশীয়', 'ig' => 'ইগ্‌বো', 'is' => 'আইসল্যান্ডীয়', 'it' => 'ইতালিয়', 'ja' => 'জাপানি', 'ka' => 'জর্জিয়ান', 'kk' => 'কাজাখ', 'km' => 'খমের', 'kn' => 'কন্নড়', 'ko' => 'কোরিয়ান', 'ku' => 'কুর্দিশ', 'ky' => 'কির্গিজ', 'lb' => 'লুক্সেমবার্গীয়', 'lg' => 'গান্ডা', 'ln' => 'লিঙ্গালা', 'lo' => 'লাও', 'lt' => 'লিথুয়েনীয়', 'lv' => 'লাত্‌ভীয়', 'mai' => 'মৈথিলি', 'mg' => 'মালাগাসি', 'mi' => 'মাওরি', 'mk' => 'ম্যাসিডোনীয়', 'ml' => 'মালায়ালাম', 'mn' => 'মঙ্গোলিয়', 'mni_Mtei' => 'মণিপুরী', 'mr' => 'মারাঠি', 'ms' => 'মালয়', 'mt' => 'মল্টিয়', 'my' => 'বর্মি', 'nb' => 'নরওয়েজিয়ান বোকমাল', 'ne' => 'নেপালী', 'nl' => 'ওলন্দাজ', 'nn' => 'নরওয়েজিয়ান নিনর্স্ক', 'oc' => 'অক্সিটান', 'om' => 'অরোমো', 'or' => 'ওড়িয়া', 'pa' => 'পাঞ্জাবী', 'pl' => 'পোলিশ', 'ps' => 'পাশতু', 'pt' => 'পর্তুগীজ', 'pt_BR' => 'পর্তুগীজ (ব্রাজিল)', 'qu' => 'কেচুয়া', 'ro' => 'রোমানীয়', 'ru' => 'রুশ', 'rw' => 'কিনয়ারোয়ান্ডা', 'sa' => 'সংস্কৃত', 'sc' => 'সার্ডিনিয়ান', 'sd' => 'সিন্ধি', 'si' => 'সিংহলী', 'sk' => 'স্লোভাক', 'sl' => 'স্লোভেনীয়', 'sn' => 'শোনা', 'so' => 'সোমালি', 'sq' => 'আলবেনীয়', 'sr_Cyrl' => 'সার্বীয়', 'sr_Latn' => 'সার্বীয়', 'sr_Latn_ME' => 'সার্বীয় (মন্টিনিগ্রো)', 'su' => 'সুদানী', 'sv' => 'সুইডিশ', 'sw' => 'সোয়াহিলি', 'ta' => 'তামিল', 'te' => 'তেলুগু', 'tg' => 'তাজিক', 'th' => 'থাই', 'ti' => 'তিগরিনিয়া', 'tk' => 'তুর্কমেনী', 'tl' => 'তাগালগ', 'tr' => 'তুর্কী', 'tt' => 'তাতার', 'ug' => 'উইঘুর', 'uk' => 'ইউক্রেনীয়', 'ur' => 'উর্দু', 'uz_Cyrl' => 'উজবেক', 'uz_Latn' => 'উজবেক', 'vi' => 'ভিয়েতনামী', 'xh' => 'জোসা', 'yi' => 'ইদ্দিশ', 'yo' => 'ইওরুবা', 'zh_CN' => 'চীনা (চীন)', 'zh_HK' => 'চীনা (হংকং এসএআর চীনা)', 'zh_TW' => 'চীনা (তাইওয়ান)', 'zu' => 'জুলু', ]

Native Names

You can also get a list of localized names if you call the get method without passing parameters. The same thing will happen if you pass an incorrect or empty value to the parameter.

use LaravelLang\NativeLocaleNames\LocaleNames; return LocaleNames::get(); // or return LocaleNames::get(''); // or return LocaleNames::get(null); // or return LocaleNames::get('foo');

Result:

[ 'af' => 'Afrikaans', 'ak' => 'Akan', 'am' => 'አማርኛ', 'ar' => 'العربية', 'as' => 'অসমীয়া', 'az' => 'Azərbaycan', 'be' => 'Беларуская', 'bg' => 'Български', 'bho' => 'भोजपुरी', 'bm' => 'Bamanakan', 'bn' => 'বাংলা', 'bs' => 'Bosanski', 'ca' => 'Català', 'ceb' => 'Cebuano', 'ckb' => 'کوردیی ناوەندی', 'cs' => 'Čeština', 'cy' => 'Cymraeg', 'da' => 'Dansk', 'de' => 'Deutsch', 'de_CH' => 'Deutsch (Schweiz)', 'doi' => 'डोगरी', 'ee' => 'Eʋegbe', 'el' => 'Ελληνικά', 'en' => 'English', 'eo' => 'Esperanto', 'es' => 'Español', 'et' => 'Eesti', 'eu' => 'Euskara', 'fa' => 'فارسی', 'fi' => 'Suomi', 'fil' => 'Filipino', 'fr' => 'Français', 'fy' => 'Frysk', 'ga' => 'Gaeilge', 'gd' => 'Gàidhlig', 'gl' => 'Galego', 'gu' => 'ગુજરાતી', 'ha' => 'Hausa', 'haw' => 'ʻŌlelo Hawaiʻi', 'he' => 'עברית', 'hi' => 'हिन्दी', 'hr' => 'Hrvatski', 'hu' => 'Magyar', 'hy' => 'Հայերեն', 'id' => 'Indonesia', 'ig' => 'Igbo', 'is' => 'Íslenska', 'it' => 'Italiano', 'ja' => '日本語', 'ka' => 'ქართული', 'kk' => 'Қазақ Тілі', 'km' => 'ខ្មែរ', 'kn' => 'ಕನ್ನಡ', 'ko' => '한국어', 'ku' => 'Kurdî', 'ky' => 'Кыргызча', 'lb' => 'Lëtzebuergesch', 'lg' => 'Luganda', 'ln' => 'Lingála', 'lo' => 'ລາວ', 'lt' => 'Lietuvių', 'lv' => 'Latviešu', 'mai' => 'मैथिली', 'mg' => 'Malagasy', 'mi' => 'Māori', 'mk' => 'Македонски', 'ml' => 'മലയാളം', 'mn' => 'Монгол', 'mni_Mtei' => 'Manipuri', 'mr' => 'मराठी', 'ms' => 'Melayu', 'mt' => 'Malti', 'my' => 'မြန်မာ', 'nb' => 'Norsk Bokmål', 'ne' => 'नेपाली', 'nl' => 'Nederlands', 'nn' => 'Norsk Nynorsk', 'oc' => 'Occitan', 'om' => 'Oromoo', 'or' => 'ଓଡ଼ିଆ', 'pa' => 'ਪੰਜਾਬੀ', 'pl' => 'Polski', 'ps' => 'پښتو', 'pt' => 'Português', 'pt_BR' => 'Português (Brasil)', 'qu' => 'Runasimi', 'ro' => 'Română', 'ru' => 'Русский', 'rw' => 'Kinyarwanda', 'sa' => 'संस्कृत भाषा', 'sc' => 'Sardu', 'sd' => 'سنڌي', 'si' => 'සිංහල', 'sk' => 'Slovenčina', 'sl' => 'Slovenščina', 'sn' => 'Chishona', 'so' => 'Soomaali', 'sq' => 'Shqip', 'sr_Cyrl' => 'Српски', 'sr_Latn' => 'Serbian', 'sr_Latn_ME' => 'Serbian (Montenegro)', 'su' => 'Basa Sunda', 'sv' => 'Svenska', 'sw' => 'Kiswahili', 'ta' => 'தமிழ்', 'te' => 'తెలుగు', 'tg' => 'Тоҷикӣ', 'th' => 'ไทย', 'ti' => 'ትግርኛ', 'tk' => 'Türkmen Dili', 'tl' => 'Tagalog', 'tr' => 'Türkçe', 'tt' => 'Татар', 'ug' => 'ئۇيغۇرچە', 'uk' => 'Українська', 'ur' => 'اردو', 'uz_Cyrl' => 'Uzbek', 'uz_Latn' => 'O‘zbek', 'vi' => 'Tiếng Việt', 'xh' => 'Isixhosa', 'yi' => 'ייִדיש', 'yo' => 'Èdè Yorùbá', 'zh_CN' => '中文 (中国)', 'zh_HK' => '中文 (中国香港特别行政区)', 'zh_TW' => '中文 (台湾)', 'zu' => 'Isizulu', ]

Sorting

To get the result sorted by key or value, pass SortBy to the enum parameter.

By default, sorting by values is applied.

Sort by keys

use LaravelLang\NativeLocaleNames\LocaleNames; use LaravelLang\NativeLocaleNames\Enums\SortBy; return LocaleNames::get('en', SortBy::Key);

Result:

[ 'af' => 'Afrikaans', 'ak' => 'Akan', 'am' => 'Amharic', 'ar' => 'Arabic', 'as' => 'Assamese', 'az' => 'Azerbaijani', 'be' => 'Belarusian', 'bg' => 'Bulgarian', 'bho' => 'Bhojpuri', 'bm' => 'Bambara', 'bn' => 'Bangla', 'bs' => 'Bosnian', 'ca' => 'Catalan', 'ceb' => 'Cebuano', 'ckb' => 'Central Kurdish', 'cs' => 'Czech', 'cy' => 'Welsh', 'da' => 'Danish', 'de' => 'German', 'de_CH' => 'German (Switzerland)', 'doi' => 'Dogri', 'ee' => 'Ewe', 'el' => 'Greek', 'en' => 'English', 'eo' => 'Esperanto', 'es' => 'Spanish', 'et' => 'Estonian', 'eu' => 'Basque', 'fa' => 'Persian', 'fi' => 'Finnish', 'fil' => 'Filipino', 'fr' => 'French', 'fy' => 'Western Frisian', 'ga' => 'Irish', 'gd' => 'Scottish Gaelic', 'gl' => 'Galician', 'gu' => 'Gujarati', 'ha' => 'Hausa', 'haw' => 'Hawaiian', 'he' => 'Hebrew', 'hi' => 'Hindi', 'hr' => 'Croatian', 'hu' => 'Hungarian', 'hy' => 'Armenian', 'id' => 'Indonesian', 'ig' => 'Igbo', 'is' => 'Icelandic', 'it' => 'Italian', 'ja' => 'Japanese', 'ka' => 'Georgian', 'kk' => 'Kazakh', 'km' => 'Khmer', 'kn' => 'Kannada', 'ko' => 'Korean', 'ku' => 'Kurdish', 'ky' => 'Kyrgyz', 'lb' => 'Luxembourgish', 'lg' => 'Ganda', 'ln' => 'Lingala', 'lo' => 'Lao', 'lt' => 'Lithuanian', 'lv' => 'Latvian', 'mai' => 'Maithili', 'mg' => 'Malagasy', 'mi' => 'Māori', 'mk' => 'Macedonian', 'ml' => 'Malayalam', 'mn' => 'Mongolian', 'mni_Mtei' => 'Manipuri', 'mr' => 'Marathi', 'ms' => 'Malay', 'mt' => 'Maltese', 'my' => 'Burmese', 'nb' => 'Norwegian Bokmål', 'ne' => 'Nepali', 'nl' => 'Dutch', 'nn' => 'Norwegian Nynorsk', 'oc' => 'Occitan', 'om' => 'Oromo', 'or' => 'Odia', 'pa' => 'Punjabi', 'pl' => 'Polish', 'ps' => 'Pashto', 'pt' => 'Portuguese', 'pt_BR' => 'Portuguese (Brazil)', 'qu' => 'Quechua', 'ro' => 'Romanian', 'ru' => 'Russian', 'rw' => 'Kinyarwanda', 'sa' => 'Sanskrit', 'sc' => 'Sardinian', 'sd' => 'Sindhi', 'si' => 'Sinhala', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'sn' => 'Shona', 'so' => 'Somali', 'sq' => 'Albanian', 'sr_Cyrl' => 'Serbian', 'sr_Latn' => 'Serbian', 'sr_Latn_ME' => 'Serbian (Montenegro)', 'su' => 'Sundanese', 'sv' => 'Swedish', 'sw' => 'Swahili', 'ta' => 'Tamil', 'te' => 'Telugu', 'tg' => 'Tajik', 'th' => 'Thai', 'ti' => 'Tigrinya', 'tk' => 'Turkmen', 'tl' => 'Tagalog', 'tr' => 'Turkish', 'tt' => 'Tatar', 'ug' => 'Uyghur', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'uz_Cyrl' => 'Uzbek', 'uz_Latn' => 'Uzbek', 'vi' => 'Vietnamese', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'zh_CN' => 'Chinese (China)', 'zh_HK' => 'Chinese (Hong Kong Sar China)', 'zh_TW' => 'Chinese (Taiwan)', 'zu' => 'Zulu', ]

Sort by values

use LaravelLang\NativeLocaleNames\LocaleNames; use LaravelLang\NativeLocaleNames\Enums\SortBy; return LocaleNames::get('en', SortBy::Value); // or return LocaleNames::get('en');

Result:

[ 'af' => 'Afrikaans', 'ak' => 'Akan', 'sq' => 'Albanian', 'am' => 'Amharic', 'ar' => 'Arabic', 'hy' => 'Armenian', 'as' => 'Assamese', 'az' => 'Azerbaijani', 'bm' => 'Bambara', 'bn' => 'Bangla', 'eu' => 'Basque', 'be' => 'Belarusian', 'bho' => 'Bhojpuri', 'bs' => 'Bosnian', 'bg' => 'Bulgarian', 'my' => 'Burmese', 'ca' => 'Catalan', 'ceb' => 'Cebuano', 'ckb' => 'Central Kurdish', 'zh_CN' => 'Chinese (China)', 'zh_HK' => 'Chinese (Hong Kong Sar China)', 'zh_TW' => 'Chinese (Taiwan)', 'hr' => 'Croatian', 'cs' => 'Czech', 'da' => 'Danish', 'doi' => 'Dogri', 'nl' => 'Dutch', 'en' => 'English', 'eo' => 'Esperanto', 'et' => 'Estonian', 'ee' => 'Ewe', 'fil' => 'Filipino', 'fi' => 'Finnish', 'fr' => 'French', 'gl' => 'Galician', 'lg' => 'Ganda', 'ka' => 'Georgian', 'de' => 'German', 'de_CH' => 'German (Switzerland)', 'el' => 'Greek', 'gu' => 'Gujarati', 'ha' => 'Hausa', 'haw' => 'Hawaiian', 'he' => 'Hebrew', 'hi' => 'Hindi', 'hu' => 'Hungarian', 'is' => 'Icelandic', 'ig' => 'Igbo', 'id' => 'Indonesian', 'ga' => 'Irish', 'it' => 'Italian', 'ja' => 'Japanese', 'kn' => 'Kannada', 'kk' => 'Kazakh', 'km' => 'Khmer', 'rw' => 'Kinyarwanda', 'ko' => 'Korean', 'ku' => 'Kurdish', 'ky' => 'Kyrgyz', 'lo' => 'Lao', 'lv' => 'Latvian', 'ln' => 'Lingala', 'lt' => 'Lithuanian', 'lb' => 'Luxembourgish', 'mk' => 'Macedonian', 'mai' => 'Maithili', 'mg' => 'Malagasy', 'ms' => 'Malay', 'ml' => 'Malayalam', 'mt' => 'Maltese', 'mni_Mtei' => 'Manipuri', 'mr' => 'Marathi', 'mn' => 'Mongolian', 'mi' => 'Māori', 'ne' => 'Nepali', 'nb' => 'Norwegian Bokmål', 'nn' => 'Norwegian Nynorsk', 'oc' => 'Occitan', 'or' => 'Odia', 'om' => 'Oromo', 'ps' => 'Pashto', 'fa' => 'Persian', 'pl' => 'Polish', 'pt' => 'Portuguese', 'pt_BR' => 'Portuguese (Brazil)', 'pa' => 'Punjabi', 'qu' => 'Quechua', 'ro' => 'Romanian', 'ru' => 'Russian', 'sa' => 'Sanskrit', 'sc' => 'Sardinian', 'gd' => 'Scottish Gaelic', 'sr_Cyrl' => 'Serbian', 'sr_Latn' => 'Serbian', 'sr_Latn_ME' => 'Serbian (Montenegro)', 'sn' => 'Shona', 'sd' => 'Sindhi', 'si' => 'Sinhala', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'so' => 'Somali', 'es' => 'Spanish', 'su' => 'Sundanese', 'sw' => 'Swahili', 'sv' => 'Swedish', 'tl' => 'Tagalog', 'tg' => 'Tajik', 'ta' => 'Tamil', 'tt' => 'Tatar', 'te' => 'Telugu', 'th' => 'Thai', 'ti' => 'Tigrinya', 'tr' => 'Turkish', 'tk' => 'Turkmen', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'ug' => 'Uyghur', 'uz_Cyrl' => 'Uzbek', 'uz_Latn' => 'Uzbek', 'vi' => 'Vietnamese', 'cy' => 'Welsh', 'fy' => 'Western Frisian', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'zu' => 'Zulu', ]

Compatibility

PHP

Package

Status

8.1, 8.2, 8.3

^2.0

supported

8.1, 8.2, 8.3

^1.0

not supported

Last modified: 06 June 2024