public ConcurrentDictionary <string, LocalizatedFormat> ConstructLocalization(
            IEnumerable <string> myFiles, CultureInfo currentCulture, JsonLocalizationOptions options)
        {
            _options = options;

            foreach (string file in myFiles)
            {
                ConcurrentDictionary <string, JsonLocalizationFormat> tempLocalization =
                    LocalisationModeHelpers.ReadAndDeserializeFile <string, JsonLocalizationFormat>(file,
                                                                                                    options.FileEncoding);

                if (tempLocalization == null)
                {
                    continue;
                }

                foreach (KeyValuePair <string, JsonLocalizationFormat> temp in tempLocalization)
                {
                    LocalizatedFormat localizedValue = GetLocalizedValue(currentCulture, temp);
                    AddOrUpdateLocalizedValue <JsonLocalizationFormat>(localizedValue, temp);
                }
            }

            return(localization);
        }
Example #2
0
        private void AddValueToLocalization(JsonLocalizationOptions options, string file, bool isParent)
        {
            ConcurrentDictionary <string, string> tempLocalization =
                LocalisationModeHelpers.ReadAndDeserializeFile <string, string>(file, options.FileEncoding);

            if (tempLocalization == null)
            {
                return;
            }

            foreach (var temp in tempLocalization)
            {
                LocalizatedFormat localizedValue = GetLocalizedValue(temp, isParent);

                AddOrUpdateLocalizedValue(localizedValue, temp);
            }
        }