PHP code example of deepskylog / multilingual-language-list
1. Go to this page and download the library: Download deepskylog/multilingual-language-list library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
deepskylog / multilingual-language-list example snippets
'providers' => [
// ...
DeepskyLog\Languages\LanguagesServiceProvider::class,
// ...
],
'Languages' => DeepskyLog\Languages\LanguagesFacade::class,
Languages::lookup();
// returns
{
"ab": "Abkhazian",
...
"zu": "Zulu"
}
Languages::lookup(['en', 'fr', 'de']);
// returns
{
"en": "English",
"fr": "French",
"de": "German"
}
Languages::lookup(['en', 'fr', 'de'], 'fr');
// returns
{
"de": "allemand",
"en": "anglais",
"fr": "français"
}
Languages::lookup(['en', 'fr', 'de'], 'fr', true);
// returns
{
"allemand": "de",
"anglais": "en",
"français": "fr"
}
Languages::lookup(['en', 'fr', 'de', 'bs'], 'bs_Cyrl');
// returns
{
"bs": "босански",
"en": "енглески",
"de": "немачки",
"fr": "француски"
}
Languages::keyValue();
// returns
[
{"key": "ab", "value": "Abkhazian"},
{"key": "aa", "value": "Afar"},
...
{"key": "za", "value": "Zhuang"},
{"key": "zu", "value": "Zulu"}
]
Languages::keyValue('minor');
// returns
[
{"key": "ab", "value": "Abkhazian"},
{"key": "ace", "value": "Achinese"},
{"key": "ach", "value": "Acoli"},
...
{"key": "gbz", "value": "Zoroastrian Dari"},
{"key": "zu", "value": "Zulu"},
{"key": "zun", "value": "Zuni"}
]
Languages::keyValue(['en', 'ja', 'zh'], 'zh', 'label', 'text');
// returns
[
{"label": "ja", "text": "日文"},
{"label": "en", "text": "英文"},
{"label": "zh", "text": "中文"}
]
Languages::lookup(['en', 'fr', 'de', 'ja', 'ru', 'zh'], 'mixed');
// returns
{
"en": "English",
"fr": "français",
"de": "Deutsch",
"ja": "日本語",
"ru": "русский",
"zh": "中文",
}
Languages::keyValue(['en', 'fr', 'de', 'ja', 'ru', 'zh'], 'mixed');
// returns
[
{"key" => "en", "value" => "English"},
{"key" => "fr", "value" => "français"},
{"key" => "de", "value" => "Deutsch"},
{"key" => "ja", "value" => "日本語"},
{"key" => "ru", "value" => "русский"},
{"key" => "zh", "value" => "中文"}
]