private void LoadLanguages()
    {
     CultureTypes type;
      if(cbRegional.Checked)
        type = CultureTypes.AllCultures;
      else
        type = CultureTypes.NeutralCultures;

      _languages = new List<LanguageInfo>();
      foreach (CultureInfo culture in CultureInfo.GetCultures(type))
      {
        if (!_existingLanguages.ContainsKey(culture.Name))
        {
          LanguageInfo info = new LanguageInfo(culture);
          _languages.Add(info);
        }
      }
      
      _languages.Sort();
      lbLanguageList.Items.Clear();
      foreach (LanguageInfo info in _languages)
      {
        lbLanguageList.Items.Add(info.ToString());
      }
    }
Beispiel #2
0
        private void cbLanguages_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cbLanguages.SelectedIndex != 0 && cbLanguages.SelectedIndex != _currentLanguage)
            {
                if (CheckSave())
                {
                    LanguageInfo info = _languageList[cbLanguages.SelectedIndex - 1];
                    _targetStrings = LoadStrings(_stringPath, info.Name);

                    BuildMissingList();
                    ColourMissingSections();
                    SetTargetSection();
                    BuildEditList();
                    DrawTargetList();
                    btnSave.Enabled  = false;
                    _modifiedSection = false;
                    _currentLanguage = cbLanguages.SelectedIndex;
                }
            }
            cbLanguages.SelectedIndex = _currentLanguage;
        }
    private void LoadDefaultStrings()
    {
      _strings = new LocalisationStrings(_stringPath);
      _defaultStrings = LoadStrings(_stringPath, "en");

      // Get Available language list
      _languageList = new List<LanguageInfo>();
      foreach (CultureInfo language in _strings.GetAvailableLanguages())
      {
        if (language.Name != "en")
        {
          LanguageInfo langInfo = new LanguageInfo(language);
          _languageList.Add(langInfo);

        }
      }

      DrawLanguageList(null);

      // Build section trees
      treeSections.Nodes.Clear();
     
      tvSections.Nodes.Clear();
      foreach (StringSection section in _defaultStrings.Sections)
      {
        treeSections.Nodes.Add(section.SectionName);
        tvSections.Nodes.Add(section.SectionName);
      }
    }
 private void btnOk_Click(object sender, EventArgs e)
 {
   if (lbLanguageList.SelectedItem == null)
   {
     this.DialogResult = DialogResult.Cancel;
   }
   else
   {
     _selected = _languages[lbLanguageList.SelectedIndex];
     this.DialogResult = DialogResult.OK;
   }
 }