K
K
Konstantin Chuykov2018-09-23 04:55:20
iOS
Konstantin Chuykov, 2018-09-23 04:55:20

How to get list of available languages ​​from Localizations project?

Good afternoon.
I created localization strings for the application in swift 4.
5ba6f20ddcf43062181948.png
Now I want to display UIAlertControllerStyle.actionSheet with a list of these languages.
Please tell me how to do this, I can’t find an implementation anywhere on the network, and manually creating let availableLanguages ​​= ["ru" : "Russian", "en" : "English"] is not convenient if more languages ​​​​are added later.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2018-09-23
@chuikoffru

let availableLanguages = Bundle.main.localizations as [String]
list of all available languages
let availableLanguages = Bundle.main.preferredLocalizations as [String]
list of available languages ​​based on system settings

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question