private void butDownload_Click(object sender, System.EventArgs e)
        {
            string    remoteUri           = "http://www.open-dent.com/cultures/";
            string    fileName            = CultureInfo.CurrentCulture.Name + ".sql";//eg. en-US.sql
            string    myStringWebResource = null;
            WebClient myWebClient         = new WebClient();

            myStringWebResource = remoteUri + fileName;
            try{
                myWebClient.DownloadFile(myStringWebResource, fileName);
            }
            catch {
                MessageBox.Show("Either you do not have internet access, or no translations are available for " + CultureInfo.CurrentCulture.DisplayName);
                return;
            }
            ClassConvertDatabase ConvertDB = new ClassConvertDatabase();

            try{
                ConvertDB.ExecuteFile(fileName);
            }
            catch {
                MessageBox.Show("Translations not installed properly.");
                return;
            }
            LanguageForeigns.Refresh(CultureInfo.CurrentCulture);
            MessageBox.Show("Done");
        }
Beispiel #2
0
        private void butDownload_Click(object sender, System.EventArgs e)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                MessageBox.Show("Not allowed when using client web.");
                return;
            }
            string    remoteUri           = "http://www.opendental.com/cultures/";
            string    fileName            = CultureInfo.CurrentCulture.Name + ".txt";//eg. en-US.txt
            string    myStringWebResource = null;
            WebClient myWebClient         = new WebClient();

            myStringWebResource = remoteUri + fileName;
            try{
                myWebClient.DownloadFile(myStringWebResource, fileName);
            }
            catch {
                MessageBox.Show("Either you do not have internet access, or no translations are available for " + CultureInfo.CurrentCulture.DisplayName);
                return;
            }
            //ClassConvertDatabase ConvertDB=new ClassConvertDatabase();
            try{
                //ConvertDB.ExecuteFile(fileName);
                string content = File.ReadAllText(fileName).Trim();
                Lans.LoadTranslationsFromTextFile(content);
            }
            catch {
                MessageBox.Show("Translations not installed properly.");
                return;
            }
            LanguageForeigns.Refresh(CultureInfo.CurrentCulture.Name, CultureInfo.CurrentCulture.TwoLetterISOLanguageName);
            MessageBox.Show("Done");
        }
        private void FillGrid()
        {
            LanList     = Lan.GetListForCat(ClassType);
            ListForType = LanguageForeigns.GetListForType(ClassType);
            LanguageForeigns.Refresh(CultureInfo.CurrentCulture);
            gridLan.BeginUpdate();
            gridLan.Columns.Clear();
            ODGridColumn column = new ODGridColumn("English", 220);

            gridLan.Columns.Add(column);
            column = new ODGridColumn(CultureInfo.CurrentCulture.DisplayName, 220);
            gridLan.Columns.Add(column);
            column = new ODGridColumn("Other " + CultureInfo.CurrentCulture.Parent.DisplayName + " Translation", 220);
            gridLan.Columns.Add(column);
            column = new ODGridColumn(CultureInfo.CurrentCulture.DisplayName + " Comments", 220);
            gridLan.Columns.Add(column);
            //gridLan.Columns[1].Heading=;
            //gridLan.Columns[2].Heading="Other "+CultureInfo.CurrentCulture.Parent.DisplayName+" Translation";
            //gridLan.Columns[3].Heading=CultureInfo.CurrentCulture.DisplayName+" Comments";
            gridLan.Rows.Clear();
            UI.ODGridRow    row;
            LanguageForeign lanForeign;
            LanguageForeign lanForeignOther;

            for (int i = 0; i < LanList.Length; i++)
            {
                row = new OpenDental.UI.ODGridRow();
                row.Cells.Add(LanList[i].English);
                lanForeign      = LanguageForeigns.GetForCulture(ListForType, LanList[i].English, CultureInfo.CurrentCulture.Name);
                lanForeignOther = LanguageForeigns.GetOther(ListForType, LanList[i].English, CultureInfo.CurrentCulture.Name);
                if (lanForeign == null)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(lanForeign.Translation);
                }
                if (lanForeignOther == null)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(lanForeignOther.Translation);
                }
                if (lanForeign == null)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(lanForeign.Comments);
                }
                gridLan.Rows.Add(row);
            }
            gridLan.EndUpdate();
        }