Man those little problems that should never be problems can be annoying – I just solved another one and would like to share.
In short: make sure your resource files have build action “PRIResource”
MSDN has great guides on Translating UI Resources in XAML apps, but this little detail is not mentioned. Perfectly natural since creating a resource file will set this build action automatically, but when this has fallen away it can be tricky to find.
This post of course also applies to Windows 8.1, and since Windows Phone 8.1 now practically is Windows 8.1, this also applies to Phone! Don’t forget to check out our extensive series on Windows Phone 8.1 for developers.
Problem & Solution
So how did the problem manifest itself?
I have a plain old Windows 8-app and added Swedish and English support by creating a “sv” and “en” folder respectively.
But changing the primary language of my machine did not affect the language at all – I kept getting the Swedish texts, never the English.
And renaming the resource folder to eg “jp” would give empty localized strings in the UI – not pick up the English ones at all.
Luckily the solution was easy – the “PRIResource” build action was not set for the English Resources.resw-file, it had build action “none”.
Samples for Windows 8.0
A side effect of searching for this problem was that I found another nugget: The archive.org Way Back Machine
The app I’m working on is still Windows 8.0 and has to stay that way due to customer reasons, and when searching for this problem I found the Application resources and localization sample. But the sample is for Windows 8.1, and I wanted to mimic my environment as much as I could. So, by giving the sample URL to the WayBackMachine gave a calendar with previous versions of the site and I could easily download the samples for Win8.0.