Esempio n. 1
0
        public static LocalizationProviderProxy RegisterProvider(
            LocalizationProviderProxy instance)
        {
            Validate.ArgumentNotNull(parameter: instance, parameterName: nameof(instance));
            lock (providersLock) {
                if (_registeredProviders.ContainsKey(key: instance.RegisteredName))
                {
                    throw new LocalizationManagerException(message: StringResource.Get(id: "ProviderAlreadyRegistered"));
                }
                _registeredProviders.Add(key: instance.RegisteredName, value: instance);
            }

            return(instance);
        }
Esempio n. 2
0
        public static LocalizationProviderProxy GetInstance(string proxyName)
        {
            LocalizationProviderProxy localizationProviderProxy = null;

            lock (providersLock) {
                if (_registeredProviders.ContainsKey(key: proxyName))
                {
                    _registeredProviders.TryGetValue(key: proxyName, value: out localizationProviderProxy);
                }
                else
                {
                    localizationProviderProxy = proxyName == string.Empty ? new LocalizationProviderProxy(provider: new NonLocalizingProvider(), proxyName: string.Empty) : throw new LocalizationManagerException(message: StringResource.Get(id: "ProviderNotRegistered"));
                }
            }

            return(localizationProviderProxy);
        }