Hi,
my SwiftUI app is localized by using translation files (German, English).
In one of my views I have to present a text received by a webservice. The webservice provides the text in German and English.
What is the best practice to show the correct string?
First idea: Check the current locale, if it is German than show the German text, else show the English one. Is this the best way to implement this?
Second idea: Is there a possibility to use NSLocalizedString without a language file and to provide the translations programmatically? In this case I wouldn't have to check the locale on myself. therefore I would prefer this...
Thanks in advance!
Mark
Example for getting locale: let languagePrefix = Locale.preferredLanguages[0].prefix(2)