Washington A. Ramos
Washington A. Ramos

Reputation: 924

Is it possible to use other .resw files for localization other than Resources.resw in UWP?

I'm building an app which I'd like to localize to english and my native language, and it will have many, many strings to localize. Implementation of localization is not a problem, my problem is organization. Is it possible to use different files, like "Informations.resw","Recipes.resw", "UI.resw" and so on to organize things better? If yes, how can I do it?

Upvotes: 1

Views: 470

Answers (1)

Jay Zuo
Jay Zuo

Reputation: 15758

Is it possible to use different files, like "Informations.resw", "Recipes.resw", "UI.resw" and so on to organize things better? If yes, how can I do it?

Yes, this is possible. To achieve what you want, you can add multiple resource files in Strings folder per language like the following:
enter image description here

And then you can refer to the resources in XAML like:

<TextBlock x:Uid="/UI/Greeting" />

Or in code like:

var resourceLoader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView("Informations");
var str = resourceLoader.GetString("XXInfo");

For more information, please see How to load string resources.

Upvotes: 4

Related Questions