Esempio n. 1
0
        public Form1()
        {
            // Setup translation data
            Tx.UseFileSystemWatcher = true;
            Tx.LoadDirectory("lang");
            Tx.PrimaryCulture = "de";

            InitializeComponent();

            // Adopt UI font
            Font = SystemFonts.MessageBoxFont;

            // Statically set a control's text once
            //IntroLabel.Text = Tx.T("intro");

            // Add a custom control property binding to a text key
            //TxDictionaryBinding.AddBinding(IntroLabel, "Text", "intro");

            // Add translation dictionary bindings for all controls
            TxDictionaryBinding.AddTextBindings(this);

            // Fill the languages drop-down and select the current language
            string currentCulture = Tx.GetCultureName();

            foreach (CultureInfo ci in Tx.AvailableCultures)
            {
                CultureLabel cl = new CultureLabel(ci.Name, Tx.U(ci.NativeName));
                LanguageCombo.Items.Add(cl);
                if (ci.Name == currentCulture)
                {
                    LanguageCombo.SelectedItem = cl;
                }
            }
            isLoading = false;
        }
Esempio n. 2
0
        public CultureTextViewModel(string cultureName, TextKeyViewModel textKeyVM)
        {
            this.cultureName = cultureName;

            TextKeyVM      = textKeyVM;
            LastOfLanguage = true;               // Change value once to set the brush value

            BackgroundBrush = cultureName == TextKeyVM.MainWindowVM.PrimaryCulture ?
                              new SolidColorBrush(Color.FromArgb(20, 0, 192, 0)) :
                              new SolidColorBrush(Color.FromArgb(20, 0, 192, 0));

            if (App.Settings.View.NativeCultureNames)
            {
                cultureNativeName = Tx.U(CultureInfo.GetCultureInfo(cultureName).NativeName);
            }
            else
            {
                cultureNativeName = Tx.U(CultureInfo.GetCultureInfo(cultureName).DisplayName);
            }
        }
Esempio n. 3
0
 public override string ToString()
 {
     return(Tx.U(App.Settings.View.NativeCultureNames ? CultureInfo.NativeName : CultureInfo.DisplayName) +
            " [" + CultureInfo.IetfLanguageTag + "]");
 }