0

I have the task to create a dropdown list of languages in different languages. The dropdown isn't problem. But I don't know how to collect all languages (found this answer in StackOverflow List of all country languages for dropdown select menu HTML FORM), but I need to translate these languages in French, German, Swedish, Danish, Dutch languages.

Maybe, someone knows libraries or something else.

Stack of the project: Laravel and Vue.js.

Thanks for helping.

1 Answers1

0

I found some interesting packages which might help:

meikidd/iso-639-1

You can read in the documentation there is:

ISO6391.getAllNativeNames() //['Afaraf','аҧсуа бызшәа', ... ,'isiZulu' ]

petercoles/Multilingual-Language-List

You need to read the documentation and to see if that fits your needs.

In your case you will need something mentioned in docs:

$languageKeys = Languages::lookup('major')->keys()->toArray();
// returns ['ab', ... 'zu']
$mixedLanguages = Languages::lookup($languageKeys, 'mixed');
// returns
{
  "af": "Afrikaans",
  "ak": "Akan",
  "sq": "shqip",
  "am": "አማርኛ",
  "ar": "العربية",
  "hy": "հայերեն",
  "as": "অসমীয়া",
  ...
  "zu": "isiZulu"
}

I haven't tested these packages but they seem ok to me.

I hope this will help you a little.

Good luck!

mare96
  • 3,749
  • 1
  • 16
  • 28