Esempio n. 1
0
        /// <summary>
        /// Display all string in the current language
        /// </summary>
        void BuildListString()
        {
            StringListBox.BeginUpdate();
            StringListBox.Items.Clear();

            if (CurrentLanguageBox.SelectedIndex == -1)
            {
                StringListBox.EndUpdate();
                return;
            }

            Language language = StringTable.GetLanguage(CurrentLanguageBox.SelectedItem as string);

            foreach (KeyValuePair <int, string> kvp in language.Strings)
            {
                ListViewItem item = new ListViewItem(kvp.Key.ToString());
                item.SubItems.Add(kvp.Value);
                StringListBox.Items.Add(item);
            }

            // Compare the current language and the default language
            if (DefaultLanguageBox.SelectedItem != null && DefaultLanguageBox.SelectedItem as string != StringTable.LanguageName)
            {
                Language deflang = StringTable.GetLanguage(DefaultLanguageBox.SelectedItem as string);


                foreach (KeyValuePair <int, string> kvp in deflang.Strings)
                {
                    // If current language already contains this string, skip it
                    if (!string.IsNullOrEmpty(language.GetString(kvp.Key)))
                    {
                        continue;
                    }

                    // Else add to the listview
                    ListViewItem item = new ListViewItem(kvp.Key.ToString());
                    item.ForeColor = Color.Red;

                    item.SubItems.Add(kvp.Value);
                    StringListBox.Items.Add(item);
                }
            }

            StringListBox.EndUpdate();
            StringListBox.Sort();
        }