I'm trying here to perform a manual translation for that application I'm dealing with. (There's already a functional LocalizationModule but it is working dodgy, and so i can't use <asp:Localize /> tags.

Normally with ResourceManager you are meant to be utilising it as being Namespace.Folder.Resourcename (within an application). Presently I'm converting a current asp.internet "website" (not web application so no namespace here....).

The assets are situated right into a folder title "Locales/assets" which consists of "fr-ca.resx" and "en-us.resx".

And So I used a code with something similar to this :

public static string T(string search)
 {
  System.Resources.ResourceManager resMan = new System.Resources.ResourceManager( "Locales", System.Reflection.Assembly.GetExecutingAssembly(), null );

  var text = resMan.GetString(search, System.Threading.Thread.CurrentThread.CurrentCulture);

  if (text == null)
   return "null";
  else if (text == string.Empty)
   return "empty";
  else
   return text;
 }

and within the page I've something similar to this <%= Locale.T("T_HOME") %>

After I refresh I've this :

Couldn't find any assets right for the required culture or even the neutral culture. Make certain "Locales.assets" was properly embedded or linked into set up "Application_Code.9yopn1f7" at compile time, or that the satellite devices needed are loadable and fully signed. Description: An unhandled exception happened throughout the execution from the current web request. Please evaluate the stack trace for additional details about the mistake and where it came from within the code.

Exception Particulars: System.Assets.MissingManifestResourceException: Couldn't find any assets right for the required culture or even the neutral culture. Make certain "Locales.assets" was properly embedded or linked into set up "Application_Code.9yopn1f7" at compile time, or that the satellite devices needed are loadable and fully signed.

Source Error:

Line 14:
System.Assets.ResourceManager resMan = new System.Assets.ResourceManager( "Locales", System.Reflection.Set up.GetExecutingAssembly(), null ) Line 15: Line 16: var text = resMan.GetString(search, System.Threads.Thread.CurrentThread.CurrentCulture) Line 17: Line 18: if (text == null)

Source File: c:inetpubvhostsgalerieocarre.comsubdomainsdevhttpdocsApp_CodeLocale.cs Line: 16

I even attempted to load the resource with Locales.fr-ca or only fr-ca nothing quite work here.

You may be just searching for The Machine.Internet.Page's base GetLocalResourceObject(),?

see http://msdn.microsoft.com/en-us/library/ms153597.aspx

Marvin Smit's option would be great if you don't have the HTTPContext

const string ASSEMBLY_NAME = "App_GlobalResources";
const string RESOURCE_NAME = "Resources.MetaTagResource";
const string RESOURCE_MANAGER = "ResourceManager";

Assembly assembly = Assembly.Load(ASSEMBLY_NAME);
Type type = assembly.GetType(RESOURCE_NAME);
PropertyInfo propertyInfo = type.GetProperty(RESOURCE_MANAGER);
ResourceManager resourceManager = propertyInfo.GetValue(null, new object[] { }) as ResourceManager;
resourceManager.GetResourceSet(CultureInfo.InvariantCulture, true, true);

But when you can get the HTTPContext only use HttpContext.GetGlobalResourceObject

string title = HttpContext.GetGlobalResourceObject("MetaTagResource", "Title").ToString();
string keywords = HttpContext.GetGlobalResourceObject("MetaTagResource", "keywords").ToString();
string description = HttpContext.GetGlobalResourceObject("MetaTagResource", "Description").ToString();