Localized ressources
Last Post 04/20/2010 6:04 AM by jumatthey. 12 Replies.
Author Messages
jumatthey
Nuke Ace
Nuke Ace
Posts:42


--
01/29/2010 8:23 AM  
Hello,

I would like to add localized ressources on a page like this :

<%$ Resources:MyRessource, String1 %>

I have put the Myssource.lng-LNG.resx file in the App_GlobalRessources folder.

But this doesn't work. I have an error on the page I want to display. How can I add customized labels on a page using the <%$ Resources:MyRessource, String1 %> tag ??

Thank you for information

JM
jumatthey
Nuke Ace
Nuke Ace
Posts:42


--
02/01/2010 10:46 AM  
up
Joseph Craig
DNN MVP
Posts:11667


--
02/01/2010 6:56 PM  
Use the TEXT skin object.

You will find additional documentation here.

Joe Craig, Patapsco Research Group
Complete DNN Support
jumatthey
Nuke Ace
Nuke Ace
Posts:42


--
02/02/2010 2:15 AM  
Thank you.

Could you please provide me with an example ? This would be very useful for me.

Thank you very much
jumatthey
Nuke Ace
Nuke Ace
Posts:42


--
02/02/2010 3:05 AM  
I have set up a test TEXT tag so :

<dnn:text runat="server" id="mytext1" text="String1" resourcekey="test" replacetokens="true"> < dnn:TEXT runat="server" ID="mytext1" Text="String1" ResourceKey="test" ReplaceTokens="true" / >

Now I have put a test.resx in the App_GlobalResources folder but it seems my text isn't translated. What am I doing wrong ? I have also put this line in my ressource file : name:String 1 value:Ceci est un test

It seems there is no link with my ressource file. Where should I put it insted of App_GlobalResources ?

Thank you for information.
Joseph Craig
DNN MVP
Posts:11667


--
02/02/2010 8:59 AM  
DotNetNuke does not automatically translate text.  You need to have "language packs" installed for each language.  The language pack include resource files for a specific language.  So, you will need to add test.resx files for each of the languages that you support.

You will need to follow the structure and naming conventions for each of the languages.

Joe Craig, Patapsco Research Group
Complete DNN Support
jumatthey
Nuke Ace
Nuke Ace
Posts:42


--
02/02/2010 9:28 AM  
I would like just one label to be localized. How do I do this ? Which token do I use ? Can you provide me with a code sample please ?
Joseph Craig
DNN MVP
Posts:11667


--
02/02/2010 9:41 AM  
I am hardly expert in localization issues.  But, it appears that the German DNN group is one place to go for help (www.dnn-usergroup.de).

What you will need to do, based on a quick look, is provide a resource file for each language.  Inside of the resource file, you will translate your text.  If you've installed the correct language packs and also the localization skin object so that you can switch languages, DotNetNuke will pull the localized string from the appropriate resource file.  You'll need to name the resource files appropriately, too.  Once you have installed a language pack, you can see how that is done.

To me, it looks like you duplicate the resource files, and append language indicators to the file names. That's at least a place to begin.

Joe Craig, Patapsco Research Group
Complete DNN Support
jumatthey
Nuke Ace
Nuke Ace
Posts:42


--
02/02/2010 9:58 AM  
Thank you for you reply.

This is exactly what I have done already. I have built a custom module called gridview.ascx in the Desktop Modules directory. From there I have a App_LocalResources folder in my module folder and then three ressource files named after each language that is : gridview.ascx.resx, gridview.ascx.fr-FR.resx, gridview.ascx.de-DE.resx.

Then I have a test1 line in each of my resource file.

Then on my ascx page I try to call from these files with this tag :

< dnn:TEXT runat="server" ID="mytext1" ResourceKey="test1" Visible="true" / >

I have put "test1" in the ResourceKey label so I think it should call this line from the ressource files, depending on current selected local. And yes I have installed all the necessary language and I can switch from one another through flags on top of the page. All my pages are actually successfully localized, except for this custom module I have build.

It seems I dont know how to use the appropriate tag to call from the ressource files, tho I have put them in the App_LocalResources folder in my module folder. This is how it is done with the other built-in modules.

Seems I am doing something wrong here, which is I can't call from the ressource file.

Thank you for support

JM
Joseph Craig
DNN MVP
Posts:11667


--
02/03/2010 9:21 AM  
If you look at the Minimal Extropy skin, you will find this:

         < dnn:TEXT runat="server" id="dnnTEXT" CssClass="breadcrumb_text" Text="You are here >" ResourceKey="Breadcrumb" / >

The TEXT skin object is documented here.  It has several attributes.  They include:


  • Text  -- The text to display if there is no text available from a resource file. This is also the name of the key in the resource file that will be used
  • resourceKey -- The name of the resource file (*.resx) to use.

In your example, the resource file would be test1.*.resx.  You didn't include Text as an attribute, so the skin object doesn't know which key to use.


-------
As I said, I'm not an expert here, but this is where I would look.

Joe Craig, Patapsco Research Group
Complete DNN Support
jumatthey
Nuke Ace
Nuke Ace
Posts:42


--
02/16/2010 3:57 AM  
Still looking for a way to localize my labels. This way -> <%$ Resources:MyRessourceFile, Key %>

That is without breaking up DNN and generating errors.

If anyone has any experience with this, thanks for letting me know.

Regards

JM
hassangas2003
Nuke Newbie
Nuke Newbie
Posts:3


--
04/20/2010 12:23 AM  
Hi JM
May by the posts for Joseph Craig it more more more clear,and this man he have more experience in this field.
plz try this:
in html file:
<asp:Label ID="Test1" runat=server Text="Test" Resources=Test1>" >
in local recources:

this is test1:


Thanks
jumatthey
Nuke Ace
Nuke Ace
Posts:42


--
04/20/2010 6:04 AM  
I found a way thru C# code. You can localize your content directly under C#

protected string GetLocalResource(string key)
{
return DotNetNuke.Services.Localization.Localization.GetString(key, this.LocalResourceFile).ToString();
}
yourstuff.Text = GetLocalResource("key");

This way you have to name your ressource file after the ascx file for example yourfile.ascx.lng-LNG.resx in the current App_LocalResources folder.


---