Esempio n. 1
0
 public virtual void Extend(ILocalizationDictionaryProvider dictionaryProvider)
 {
     foreach (var dictionary in dictionaryProvider.Dictionaries.Values)
     {
         Extend(dictionary);
     }
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="name"></param>
        /// <param name="dictionaryProvider"></param>
        public DictionaryBasedLocalizationSource(string name, ILocalizationDictionaryProvider dictionaryProvider)
        {
            Check.NotNullOrEmpty(name, nameof(name));
            Check.NotNull(dictionaryProvider, nameof(dictionaryProvider));

            Name = name;
            DictionaryProvider = dictionaryProvider;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="name"></param>
        /// <param name="dictionaryProvider"></param>
        public DictionaryBasedLocalizationSource(string name, ILocalizationDictionaryProvider dictionaryProvider)
        {
            if (name.IsNullOrEmpty())
            {
                throw new ArgumentNullException("name");
            }
            Name = name;

            if (dictionaryProvider == null)
            {
                throw new ArgumentNullException("dictionaryProvider");
            }
            _dictionaryProvider = dictionaryProvider;
        }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="name"></param>
        /// <param name="dictionaryProvider"></param>
        public DictionaryBasedLocalizationSource(string name, ILocalizationDictionaryProvider dictionaryProvider)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (dictionaryProvider == null)
            {
                throw new ArgumentNullException(nameof(dictionaryProvider));
            }

            Name = name;
            DictionaryProvider = dictionaryProvider;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <param name="dictionaryProvider"></param>
        public DictionaryBasedLocalizationSource(string name, ILocalizationDictionaryProvider dictionaryProvider)
        {
            if (name.IsNullOrEmpty())
            {
                throw new ArgumentNullException("name");                
            }

            Name = name;

            if (dictionaryProvider == null)
            {
                throw new ArgumentNullException("dictionaryProvider");
            }

            _dictionaryProvider = dictionaryProvider;
        }
Esempio n. 6
0
        public LocalizationResource(
            [NotNull] Type resourceType,
            [NotNull] string defaultCultureName,
            [NotNull] ILocalizationDictionaryProvider dictionaryProvider)
        {
            Check.NotNull(resourceType, nameof(resourceType));
            Check.NotNull(defaultCultureName, nameof(defaultCultureName));
            Check.NotNull(dictionaryProvider, nameof(dictionaryProvider));

            ResourceType       = resourceType;
            DefaultCultureName = defaultCultureName;
            DictionaryProvider = dictionaryProvider;

            BaseResourceTypes = new List <Type>();
            Extensions        = new List <ILocalizationDictionaryProvider>();

            AddBaseResourceTypes();
        }
        public LocalizationManager(ILocalizationManagerSettings settings,
                                   ILocalizationDictionaryProvider localizationDictionaryProvider,
                                   ILanguageProvider languageProvider,
                                   ILocalizationDictionaryParser localizationDictionaryParser)
        {
            _settings = settings ?? new LocalizationManagerSettings();
            _localizationDictionaryProvider = localizationDictionaryProvider ??
                                              new DefaultResourcesLocalizationDictionaryProvider(_settings,
                                                                                                 localizationDictionaryParser, languageProvider);

            _unknownKeyService = new UnknownKeyService(_settings.UnknownKeyPolitics, _settings.DefaultString);
            try
            {
                _dictionary = _localizationDictionaryProvider.LoadDictionary();
            }
            catch (DataException e)
            {
                if (_settings.TestMode)
                {
                    Debug.LogError($"{PackagePrefix} {e.Message}");
                }
            }
        }
Esempio n. 8
0
 /// <summary>
 /// Creates a new <see cref="LocalizationSourceExtensionInfo"/> object.
 /// </summary>
 /// <param name="sourceName">Source name</param>
 /// <param name="dictionaryProvider">Extension dictionaries</param>
 public LocalizationSourceExtensionInfo(string sourceName, ILocalizationDictionaryProvider dictionaryProvider)
 {
     SourceName         = sourceName;
     DictionaryProvider = dictionaryProvider;
 }
Esempio n. 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MultiTenantLocalizationDictionaryProvider"/> class.
 /// </summary>
 public MultiTenantLocalizationDictionaryProvider(ILocalizationDictionaryProvider internalProvider, IIocManager iocManager)
 {
     _internalProvider = internalProvider;
     _iocManager       = iocManager;
     _dictionaries     = new ConcurrentDictionary <string, ILocalizationDictionary>();
 }
Esempio n. 10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="name"></param>
 /// <param name="dictionaryProvider"></param>
 public DictionaryBasedLocalizationSource(string name, ILocalizationDictionaryProvider dictionaryProvider)
 {
     Name = name;
     DictionaryProvider = dictionaryProvider;
 }
 /// <summary>
 /// Construct function
 /// </summary>
 /// <param name="name">The name of default language file</param>
 /// <param name="dictionaryProvider">DictionaryProvide</param>
 public DictionaryBasedLocalizationSource(string name, ILocalizationDictionaryProvider dictionaryProvider)
 {
     Name = name;
     _dictionaries = new Dictionary<string, ILocalizationDictionary>();
     _dictionaryProvider = dictionaryProvider;
 }
Esempio n. 12
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="name"></param>
 /// <param name="dictionaryProvider"></param>
 public DictionaryBasedLocalizationSource(string name, ILocalizationDictionaryProvider dictionaryProvider)
 {
     Name                = name;
     _dictionaries       = new Dictionary <string, ILocalizationDictionary>();
     _dictionaryProvider = dictionaryProvider;
 }
 /// <summary>
 /// Creates a new <see cref="LocalizationSourceExtensionInfo"/> object.
 /// </summary>
 /// <param name="sourceName">Source name</param>
 /// <param name="dictionaryProvider">Extension dictionaries</param>
 public LocalizationSourceExtensionInfo(string sourceName, ILocalizationDictionaryProvider dictionaryProvider)
 {
     SourceName = sourceName;
     DictionaryProvider = dictionaryProvider;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MultiTenantLocalizationDictionaryProvider"/> class.
 /// </summary>
 public MultiTenantLocalizationDictionaryProvider(ILocalizationDictionaryProvider internalProvider, IIocManager iocManager)
 {
     _internalProvider = internalProvider;
     _iocManager = iocManager;
     _dictionaries = new ConcurrentDictionary<string, ILocalizationDictionary>();
 }
Esempio n. 15
0
 public DefaultLocalizationSource(string sourceName, ILocalizationDictionaryProvider dictionaryProvider, ILocalizationConfiguration localizationConfiguration)
 {
     _localizationConfiguration = localizationConfiguration;
     Name = sourceName;
     DictionaryProvider = dictionaryProvider;
 }