I have an app that is localized using angular-i18n to which I want to add a language switch button. This is working, however, the available languages are hard-coded, i.e. I have to specify the languages in code that the app was translated to.
Is there a way to get a list of all available locales (or in other words: is it possible to get the names of all the folders in the dist
directory at runtime?)
Thanks for any answers!
I know this doesn't answer your question but...
I highly recommend Transoloco for Angular, instead of
angular-i18n
:https://ngneat.github.io/transloco/
You can inject the
TransoloService
and callgetAvailableLangs
from their language API:https://ngneat.github.io/transloco/docs/language-api#getavailablelangs