+ return GetGlobalResourceObject (classKey, resourceKey, Thread.CurrentThread.CurrentUICulture);
+ }
+
+ static bool EnsureProviderFactory ()
+ {
+ if (resource_providers == null)
+ resource_providers = new Dictionary <string, IResourceProvider> ();
+
+ if (provider_factory != null)
+ return true;
+
+ GlobalizationSection gs = WebConfigurationManager.GetSection ("system.web/globalization") as GlobalizationSection;
+
+ if (gs == null)
+ return false;
+
+ String rsfTypeName = gs.ResourceProviderFactoryType;
+ if (String.IsNullOrEmpty (rsfTypeName))
+ return false;
+
+ Type rsfType = HttpApplication.LoadType (rsfTypeName, true);
+ ResourceProviderFactory rpf = Activator.CreateInstance (rsfType) as ResourceProviderFactory;
+
+ if (rpf == null)
+ return false;
+
+ provider_factory = rpf;
+ return true;
+ }
+
+ internal static IResourceProvider GetResourceProvider (string key, bool isLocal)
+ {
+ if (!EnsureProviderFactory ())
+ return null;
+
+ IResourceProvider rp = null;
+ if (!resource_providers.TryGetValue (key, out rp)) {
+ if (isLocal)
+ rp = provider_factory.CreateLocalResourceProvider (key);
+ else
+ rp = provider_factory.CreateGlobalResourceProvider (key);
+ if (rp == null)
+ return null;
+ resource_providers.Add (key, rp);
+ }
+
+ return rp;