Localize themed label

T

Trapulo

Hello,
I've this problem. I need to create a web app, where some text are localized
in many languages. That's ok: I can use "App_Localresources" and related
features, and all works. Now, I need also to create different "skins" of
this application. This is also ok: I can use themes and all works, so I have
logos, etc. that change based on active skin.

The problem is that now I need to create personal messages for each skin, in
each languages. If I have a label, for example, I need to write text
specific for each skin, on each language. Every skin has different texts,
and sure every text may be different for each language. I not want manage
all this work with a database and specific code, because I want that the web
layer will be as flexible as possible, without application layers above it.

Is there any way I can have this goal using only asp.net features?

thanks
 
S

Steven Cheng[MSFT]

Hi Trapulo,

Thank you for posting.

As for the Theme & Localization page resource, based on my research, they
could not be used together to provide the functionality you expect.
Actually, Theme is applied at runtime at the page's initlization time,
while the localization page resource( applied through "meta:ResourceKey"
attribute) is generated as some code which will be called later in page's
lifecycle. e.g:

<asp:TextBox ID="TextBox1" runat="server"
meta:resourcekey="TextBox1Resource1"></asp:TextBox>

will cause the asp.net runtime dynamically generate the following code in
dynamic compiled page class:

box1.ToolTip =
Convert.ToString(base.GetLocalResourceObject("TextBox1Resource1.ToolTip"),
CultureInfo.CurrentCulture);
box1.Text =
Convert.ToString(base.GetLocalResourceObject("TextBox1Resource1.Text"),
CultureInfo.CurrentCulture);

So the Theme can not provide such dynamic functionality on localization
resource locating. IMO, if you do need to provide different localization
resource for different Theme , and apply them onto page, controls
flexiblely, you can not avoid using custom code to read the resource from
local page resource and assign them to certain control's certain property.
However, if you want to make it flexible, you can consider define some
custom webcontrol class dervied from the built-in one(such as Label
control) and add those custom localization code(such as read specific
resource from the resource file according to the current Page Theme) in the
custom control's override funciton(such as PreRender event )...

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top