Groups | Blog | Home
all groups > dotnet internationalization > december 2004 >

dotnet internationalization : How to interfere with Invariant Behavior ?


Cypher|||
12/12/2004 6:54:08 PM
Hi fellows and gurus...

I am developing a localized website.
I implemented some classes to handle localization.
I have an Invariant resource and as many localized resource as needed.
When an entry is not present in the localized resource, it falls back on the
Invariant (neutral) resource. Nothing amazing, just the default Framework
behavior actually.
So far so good.

Now, I would like to append a link in my localized controls when this
fallback happens.
I have no idea how to do this. The code below don't work (the appended HTML
is never displayed), as the fallbak process always happens...
##
<code>
public class LclLabel: Label
{
override protected void Render (HtmlTextWriter writer)
{

//If localized resource available, just return it or return Invariant Text
+"help us" picto.
//Text = (ResourceFactory.RManager.GetString(Text)!=null)?
ResourceFactory.RManager.GetString(Text): Text+"&nbsp;<a
href='/contact.aspx?term="+Text+"'><img src=/img/oco_help.gif alt='help us
translate this in your language' border=0></a>";
if(ResourceFactory.RManager.GetString(Text)!=null){//RManager is made as a
singleton in another class.
Text = ResourceFactory.RManager.GetString(Text);
}else{
Text =
ResourceFactory.RManager.GetString(Text,CultureInfo.InvariantCulture)+"&nbsp
;<a href='/contact.aspx?term="+Text+"'><img src=/img/oco_help.gif alt='help
us translate this in your language' border=0></a>";
}
base.Render(writer);
}
}

</code>
##

Is there a way to do what I want ?
Any tip much appreciated.

Thanks


Mihai N.
12/13/2004 2:12:52 AM
[quoted text, click to view]
Why not just put that in the invariant resources ?
Ie:

English:
welcome=Welcome

Invariant:
welcome=Welcome&nbsp;<a href='/contact.aspx'><img src=/img/oco_help.gif
alt='help us translate this in your language' border=0></a>


--
Mihai
-------------------------
Cypher|||
12/13/2004 9:35:18 PM
Hi.

That's a solution I thought of.
I hope there is a better way.

Time will show.

Thank you anyway.

BTW : here is the website (online for a few hours only, still at beta
stage).
http://123roommate.com/home/







[quoted text, click to view]

AddThis Social Bookmark Button