Localization and satellite assemblies
-
Hi, I am currently building a web application whereby translation is being catered by resource files. For some reasons, it is required that each web page in the site have it own resource files. Thus, for a given page, page say "PageTest", there will be two resource files "PageTest.en-gb.resx" and "PageTest.fr-fr.resx" (provided that only two languages are defined for the time being). This process extends to all pages in the site. I store all the resource files in single folder such that i have : Resources\Page1Test.en-gb.resx Resources\Page1Test.fr-fr.resx Resources\Page2Test.en-gb.resx Resources\Page2Test.fr-fr.resx etc.... Visual Studio nicely builds two DLL (satellite assemblies) in the bin folder of my application as follows : bin\en-gb\Web.Resources.DLL --> This folder contains all resources files in english (ie. Resources\Page1Test.en-gb.resx , Resources\Page2Test.en-gb.resx etc..) bin\fr-fr\Web.Resources.DLL --> This folder contains all resources files in french (ie. Resources\Page1Test.fr-fr.resx , Resources\Page2Test.fr-fr.resx) So far so good. The problem here is that i have no idea how to reference a specific resource found in a specific resource file of the satellite assembly. Clearly speaking, How can i distinguish between en-gb\Web.Resources.DLL --> Page1Test."Resource_key" and en-gb\Web.Resources.DLL --> Page2Test."Resource_key" where "Resource_key" is a simple key to retrieve a string? Can you please help me on this point? Thank you.
-
Hi, I am currently building a web application whereby translation is being catered by resource files. For some reasons, it is required that each web page in the site have it own resource files. Thus, for a given page, page say "PageTest", there will be two resource files "PageTest.en-gb.resx" and "PageTest.fr-fr.resx" (provided that only two languages are defined for the time being). This process extends to all pages in the site. I store all the resource files in single folder such that i have : Resources\Page1Test.en-gb.resx Resources\Page1Test.fr-fr.resx Resources\Page2Test.en-gb.resx Resources\Page2Test.fr-fr.resx etc.... Visual Studio nicely builds two DLL (satellite assemblies) in the bin folder of my application as follows : bin\en-gb\Web.Resources.DLL --> This folder contains all resources files in english (ie. Resources\Page1Test.en-gb.resx , Resources\Page2Test.en-gb.resx etc..) bin\fr-fr\Web.Resources.DLL --> This folder contains all resources files in french (ie. Resources\Page1Test.fr-fr.resx , Resources\Page2Test.fr-fr.resx) So far so good. The problem here is that i have no idea how to reference a specific resource found in a specific resource file of the satellite assembly. Clearly speaking, How can i distinguish between en-gb\Web.Resources.DLL --> Page1Test."Resource_key" and en-gb\Web.Resources.DLL --> Page2Test."Resource_key" where "Resource_key" is a simple key to retrieve a string? Can you please help me on this point? Thank you.
" i have no idea how to reference a specific resource found in a specific resource file of the satellite assembly." You don't need to. The framework will access the proper resource file for the language being used, all you need to do is reference the resource key.
only two letters away from being an asset
-
" i have no idea how to reference a specific resource found in a specific resource file of the satellite assembly." You don't need to. The framework will access the proper resource file for the language being used, all you need to do is reference the resource key.
only two letters away from being an asset
Thanks. The thing is that the resource key can be available in different resource files contained in the satellite assembly. I need an access means to ensure that if i want Web.Resources.DLL -> Page1Test.en-gb->"Page title", then i will not get Web.Resources.DLL -> Page2Test.en-gb->"Page title" instead. Can you please help? Thanks
-
Thanks. The thing is that the resource key can be available in different resource files contained in the satellite assembly. I need an access means to ensure that if i want Web.Resources.DLL -> Page1Test.en-gb->"Page title", then i will not get Web.Resources.DLL -> Page2Test.en-gb->"Page title" instead. Can you please help? Thanks
Global resources http://msdn2.microsoft.com/en-us/library/ms227427.aspx[^]
only two letters away from being an asset
-
Global resources http://msdn2.microsoft.com/en-us/library/ms227427.aspx[^]
only two letters away from being an asset
Thanks Mark Nischalke, based on the MSDN link and a bunch of other articles, i managed to access a specific resource, in a specific resource file of a Satellite Assembly. The syntax is as simple as this : ResourceManager _resManager = new ResourceManager([Name of Satellite Assembly]+ "." + [Name of resource file embedded] + "." + [Culture name], Assembly.GetExecutingAssembly().GetSatelliteAssembly(_culture)); Thanks again.