Bug 11158 - Resource (resx) files are not loaded when using Visual studio for iOS
Summary: Resource (resx) files are not loaded when using Visual studio for iOS
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 1.0.x
Hardware: PC Mac OS
: Normal major
Target Milestone: 3.1
Assignee: Adrian Alonso
URL:
Depends on:
Blocks:
 
Reported: 2013-03-14 11:18 UTC by Prashant Cholachagudda
Modified: 2014-06-09 08:50 UTC (History)
15 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Reproduction (36.27 KB, application/zip)
2013-03-15 05:45 UTC, Daniel Hilgarth
Details
Additional test case, using PCL (13.72 KB, application/zip)
2014-02-07 14:30 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Prashant Cholachagudda 2013-03-14 11:18:28 UTC
The resource strings does not load from localised resource files (resx), when using Visual studio for iOS

For example:
If you set `Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("de-DE");` it's expected that resources to be loaded from Resources.de.resx file. But always english resources are used in the app.

It works as expected when using Xamarin Studio for development.
Comment 1 Marek Habersack 2013-03-14 16:42:25 UTC
It might be a problem with satellite assemblies not being copied to the build server.
Comment 3 Daniel Hilgarth 2013-03-15 05:34:07 UTC
What additional info do you need?
Comment 4 Marek Habersack 2013-03-15 05:41:27 UTC
Daniel, I think it would be great if you could attach a simple sample project which fails to work for you. That way Jose will be able to fix the issue much faster.
Comment 5 Daniel Hilgarth 2013-03-15 05:45:47 UTC
Created attachment 3624 [details]
Reproduction
Comment 6 Daniel Hilgarth 2013-03-15 05:47:12 UTC
I thought that info flows through internal channels - I attached a full repro to my support request to Prashant. Nevertheless, please find attached my sample project. Below is the support request I sent:

Localization of resource files in Visual Studio:

No matter what the CurrentUICulture is, the App always uses the string from the default resource file.
Please find attached a small solution that contains two projects:

1. An iOS project that has two resx files and a view controller that tries to use the German resource but it always displays the English text.

2. A console project that has the same resx files and performs the same action as the iOS project. It correctly uses the German text.


As Prashant wrote in the bug request: Running this project from within XS on the Mac produces the expected result but running it from within VS on Windows doesn't.
Comment 10 Jose Miguel Torres 2013-03-19 07:52:35 UTC
TESTING NOTES: (with Daniel's Reproduction attached solution)
Besides of the DE resources I have been trying this commit out with more than one resources. In my case I tested locally both DE (German) and ES (Spanish) cultures. All the satellites assemblies are being grabbed and uploaded to Mac build host. By executing the app in the emulator I can observe the String localized string being displayed successfully.
Comment 11 Brendan Zagaeski (Xamarin Team, assistant) 2014-02-07 14:23:32 UTC
Hi,

It looks like the test case for this bug (the `ResourceTest1` project) has gone back to displaying "Hello world" when compiled using Visual Studio in the recent versions of XamarinVS.iOS,

Tested in XamarinVS.iOS versions:
1.8.365
1.10.39
1.99.396


In my testing, I noticed that I had to manually delete the app off the phone in order to ensure consistent results. For example, if I ran the app using Xamarin Studio, and then cleaned, rebuilt, and ran the app from Visual Studio, it would still show the correct "Hallo Welt" text. But if I then deleted the app from the phone, and redeployed from VS, it would show "Hello world".
Comment 12 Brendan Zagaeski (Xamarin Team, assistant) 2014-02-07 14:30:25 UTC
Created attachment 6001 [details]
Additional test case, using PCL

Here's an additional test case that I think shows the same problem. In this solution, the resource files are contained in a PCL rather than in the app project itself.


When built and run from Xamarin Studio, the project shows the following in the console output:
> Hello Hola

With Visual Studio, the console output instead shows:
> Hello Hello
Comment 16 narayanp 2014-04-14 02:21:56 UTC
I have checked this issue with following builds:

VS 2013/2012/2010
Xamarin for VS 2.0.19(X.iOS 2.0.19)
X.iOS on Mac 7.2.1.212


I have tried this Issue with attached project and I am still seeing text in English for iOS application using VS. This is screencast for the same: http://www.screencast.com/t/X0fb2mbqAv. However this is working using Xamarin Studio.

Hence reopening this issue
Comment 17 Adrian Alonso 2014-04-14 11:13:47 UTC
Just cherry-picked the commits to the mtvs-2.0 branch:

Commit: adce4d53e9
Wrench: 5d01b8c92f
Comment 18 narayanp 2014-05-01 06:01:25 UTC
I have checked this Issue with following builds:

VS 2013/2012
Xamarin for Windows 2.0.74
Xamarin.iOS 7.2.3-21

I am still getting text in English using VS. This is the screencast for the same: http://www.screencast.com/t/97jkKEwb91U 

Hence reopening this this
Comment 19 Alexandre Pepin 2014-05-07 18:30:29 UTC
I have the same problem with my project. If I execute with Xamarin Studio on the Mac, the texts are localized, but if i execute with Visual Studio, the texts are all in english.

Visual Studio 2012 with Xamarin.iOS 1.12.275.0
Comment 23 Prashant manu 2014-06-09 08:50:28 UTC
With VS when attached Project 'ResourceTest' is built and run, project shows text 'Hello Welt' and 'de-DE'

With VS when attached project Case59588 is built and run, project shows text 'Hello Hola' in console output.
Screencast: http://screencast.com/t/kXRofmse

Environment Info:
All VS
Xamarin 3.1.187.0 (172e5c004e0ff647f7bd378ab5298508e97c84cd)
Xam.iOS 7.2.99.420