Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# pedro 3/4/2009 4:57 PM (edited 3/4/2009 5:02 PM)
Hi,
I do can to read the resource files in my module depending on the current language ??


Hola, Alguien me puede decir como debo hacer para leer los archivos de recursos (.resx) desde mi modulo dependiendo del idioma actual??
# juanwoang 3/17/2009 5:42 PM
Hi, sorry because of english only :(
# Constructor 3/17/2009 7:11 PM (edited 3/17/2009 8:06 PM)
In the (or one of) 'ascx.cs' files of your module.

if (this._Module.Section.Node.Culture == {?})
{
Do something...
}
else
{
Do something else...
}

or use a switch statement.
# martijnb 3/18/2009 9:03 AM
pedroHi,
I do can to read the resource files in my module depending on the current language ??

In Module controls you can just call GetText("MY_RESOURCE_KEY" ).

In the module controller class you'll need to create a ResourceManager instance to access the resources.
string baseName = "MyModule.Web.Resources.Strings";
ResourceManager resMan  = new ResourceManager(baseName, this.GetType().Assembly);

string myText = resMan.GetString("MY_RESOURCE_KEY", Thread.CurrentThread.CurrentUICulture);