Ejemplo 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;
        }
Ejemplo n.º 2
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;
        }