views:

123

answers:

1

I have an ASP.NET3.5 (C#) ASPX page that is internationalized in 10 different languages.

The page is very complex in its structured with dozens of nested views driven by a state machine pattern.

EDIT: I am using the meta:resourcekey syntax in every asp control, which allows to use declarative syntax for Implicit Resource expressions.

I have been asked to "brand" the page based on some query string parameter. Branding will mean not just loading different CSS files, but also having different text blurbs (in all languages).

Is there an easy way to "swap" resx files without having to get resources manually for each of the hundreds of literals and images that I have on this page?

In other words, let's say I have the following RESX files:

brand1_myPage.aspx.en-US.resx
brand1_myPage.aspx.de-DE.resx
brand1_myPage.aspx.fr-FR.resx

brand2_myPage.aspx.en-US.resx
brand2_myPage.aspx.de-DE.resx
brand2_myPage.aspx.fr-FR.resx

myPage.aspx will be looking for resx files named myPage.xx-XX.resx.

Is there a way to load instead either the brand1xxx.resx files or the brand2xxx.resx based on some value?

Thanks in advance.

A: 

If you reference resources in your code like this: Resources.brand1_myPage.WelcomeMessage then it may be difficult.

But you can also retrieve resources programmatically: GetGlobalResourceObject ("brand1_myPage", "WelcomeMessage"). Here you have some room for manipulation with the resource file name.

Developer Art
I am not using neither `GetGlobalResourceObject` nor `GetLocalResourceObject`. Every ASP control has a built in `meta:resource` property that automatically loads from the associated RESX file.As an example, if I have the following ASP tag:`<asp:Literal ID="someLit" runat="server" meta:resourceKey="someLitResource">`and then in my 10 different RESX files I have `someLitResource.Text` defined, the content in the current language is automatically loaded already.
Francesco Gallarotti