Open thinkpozzitive opened 8 years ago
This is not possible yet, unfortunately, but definitely a good idea. We should implement that. Thanks!
Honestly, I don't see much use of this library without this feature. Not all applications have the resources for all languages
@farshid1 and @thinkpozzitive I agree that having the ability to restrict the list of languages may be really helpful. But if we added that, it could only ever be a manual restriction.
The reason for this is that there's no way to get the list of your app's languages automatically. You can get a list of available languages or even resource folders, but that usually includes the operating system's languages, which renders the information useless for our purposes.
There's one workaround, of course: You could select a single string from your app's resources and load it with every single language, one after another, changing the app's language between each pair of queries. After comparing the results with the string from the default language, you would know which languages have a string that differs and thus are actively supported in your app. But this solution is, obviously, ugly and slow.
Adding a manual restriction, where you define the available languages in code, may be possible, on the other hand. But perhaps you don't like this approach's downside of having to define the list of languages in code again. What do you think?
I agree with @farshid1 and @thinkpozzitive , this feature is absolutrly needed. Defining the list by hand isn't a big deal at all.
Voting for this as well, my app is translated to about 12 languages, so I have no use in any other not translated language.
How can I restrict the list of available languages to only the languages for which I have values-* xml files?
Currently the list contains all languages, but I'd like to give my users the option of switching the app language to only a list of predefined languages that I have translations for.
Thank you.