2020-05-22 17:33:54 -07:00
|
|
|
|
using MatterHackers.Agg.Font;
|
|
|
|
|
|
using MatterHackers.Agg.Platform;
|
|
|
|
|
|
using MatterHackers.Agg.UI;
|
2016-06-03 18:11:51 -07:00
|
|
|
|
using MatterHackers.VectorMath;
|
2020-05-22 17:33:54 -07:00
|
|
|
|
using System;
|
2014-03-20 13:57:17 -07:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
|
|
namespace MatterHackers.MatterControl
|
|
|
|
|
|
{
|
2018-10-17 20:31:31 -07:00
|
|
|
|
public class LanguageSelector : MHDropDownList
|
2015-04-08 15:20:10 -07:00
|
|
|
|
{
|
|
|
|
|
|
private Dictionary<string, string> languageDict;
|
|
|
|
|
|
|
2018-04-12 08:42:10 -07:00
|
|
|
|
public LanguageSelector(ThemeConfig theme)
|
2018-10-17 20:31:31 -07:00
|
|
|
|
: base("Default", theme)
|
2015-04-08 15:20:10 -07:00
|
|
|
|
{
|
|
|
|
|
|
this.MinimumSize = new Vector2(this.LocalBounds.Width, this.LocalBounds.Height);
|
|
|
|
|
|
CreateLanguageDict();
|
|
|
|
|
|
|
|
|
|
|
|
foreach (KeyValuePair<string, string> entry in languageDict)
|
|
|
|
|
|
{
|
|
|
|
|
|
AddItem(entry.Key, entry.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-04-18 14:38:09 -07:00
|
|
|
|
string languageCode = UserSettings.Instance.get(UserSettingsKey.Language);
|
2015-04-08 15:20:10 -07:00
|
|
|
|
foreach (KeyValuePair<string, string> entry in languageDict)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (languageCode == entry.Value)
|
|
|
|
|
|
{
|
|
|
|
|
|
SelectedLabel = entry.Key;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void CreateLanguageDict()
|
|
|
|
|
|
{
|
2017-01-04 10:25:19 -08:00
|
|
|
|
languageDict = new Dictionary<string, string>
|
|
|
|
|
|
{
|
|
|
|
|
|
["Default"] = "EN",
|
|
|
|
|
|
["English"] = "EN",
|
|
|
|
|
|
["Čeština"] = "CS",
|
2020-05-22 17:33:54 -07:00
|
|
|
|
["Chinese "] = "ZH",
|
2017-01-04 10:25:19 -08:00
|
|
|
|
["Dansk"] = "DA",
|
2018-03-19 14:07:01 -07:00
|
|
|
|
["Deutsch"] = "DE",
|
2017-01-04 10:25:19 -08:00
|
|
|
|
["Español"] = "ES",
|
2018-03-19 14:07:01 -07:00
|
|
|
|
["ελληνικά"] = "EL",
|
2017-01-04 10:25:19 -08:00
|
|
|
|
["Français"] = "FR",
|
|
|
|
|
|
["Italiano"] = "IT",
|
2020-05-22 17:33:54 -07:00
|
|
|
|
["Japanese"] = "JA",
|
2017-01-04 10:25:19 -08:00
|
|
|
|
["Norsk"] = "NO",
|
|
|
|
|
|
["Polski"] = "PL",
|
2018-11-12 15:02:47 -08:00
|
|
|
|
//["Português"] = "CR",
|
2017-01-04 10:25:19 -08:00
|
|
|
|
["Русский"] = "RU",
|
|
|
|
|
|
["Română"] = "RO",
|
|
|
|
|
|
["Türkçe"] = "TR",
|
|
|
|
|
|
["Vlaams"] = "NL",
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2016-01-06 16:54:23 -08:00
|
|
|
|
#if DEBUG
|
|
|
|
|
|
languageDict["L10N"] = "L10N";
|
|
|
|
|
|
#endif
|
2015-04-08 15:20:10 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|