示例#1
0
        /// <summary>
        /// Makes a change to a locale table.
        /// </summary>
        /// <param name="change">The locale change to make.</param>
        /// <param name="table">The locale table to make the change on.</param>
        public static void MakeLocaleChange(LocaleChange change, LocaleTable table)
        {
            if (change.Index < 0 || change.Index >= table.Strings.Count)
                throw new ArgumentException("Locale changes cannot be applied beyond the boundaries of the locale table");

            table.Strings[change.Index].Value = change.NewValue;
        }
示例#2
0
        /// <summary>
        /// Load a language into the listview
        /// </summary>
        private void LoadLanguage()
        {
            using (var reader = _streamManager.OpenRead())
                _currentLocaleTable = _currentLanguage.LoadStrings(reader);

            _locales = new List<LocaleEntry>();
            _localeView = CollectionViewSource.GetDefaultView(_locales);
            _localeView.Filter = LocaleFilter;

            for (int i = 0; i < _currentLocaleTable.Strings.Count; i++)
            {
                Locale locale = _currentLocaleTable.Strings[i];
                string stringId = _cache.StringIDs.GetString(locale.ID);
                if (stringId == null)
                    stringId = locale.ID.ToString();

                string localeStr = ReplaceSymbols(locale.Value);
                _locales.Add(new LocaleEntry(i, stringId, localeStr));
            }

            LoadGroups();

            Dispatcher.Invoke(new Action( delegate { lvLocales.DataContext = _localeView; }));
        }
示例#3
0
 /// <summary>
 /// Makes changes to a language's locales.
 /// </summary>
 /// <param name="changes">The changes to make to the language.</param>
 /// <param name="table">The locale table to make the changes on.</param>
 public static void MakeLocaleChanges(IEnumerable<LocaleChange> changes, LocaleTable table)
 {
     foreach (var change in changes)
         MakeLocaleChange(change, table);
 }