示例#1
0
        public static string GetString(string resourceName)
        {
            if (_resource == null)
            {
                _resource = new ApplicationResourceManager(ApplicationName, Assembly.GetExecutingAssembly());
            }

            return(_resource.GetString(resourceName));
        }
示例#2
0
        /// <summary>
        /// Get the localized string for a particular culture
        /// </summary>
        /// <param name="culture">The culture for which the string is desired</param>
        /// <param name="name">The resource name</param>
        /// <returns>The localized resource</returns>
        public string GetString(CultureInfo culture, string name)
        {
            ApplicationResourceManager loader = GetLoader();
            string localized = null;

            if (null != loader)
            {
                localized = loader.Resources.GetString(name, culture ?? Config.Localization);
            }

            return(localized);
        }
示例#3
0
        /// <summary>
        /// Return the static loader instance
        /// </summary>
        /// <returns></returns>
        private ApplicationResourceManager GetLoader()
        {
            if (null == _loader)
            {
                lock (_lock)
                {
                    if (null == _loader)
                    {
                        _loader = new ApplicationResourceManager(_applicationName, _assembly);
                    }
                }
            }

            return(_loader);
        }