Ejemplo n.º 1
0
        public static void UpdateTranslations()
        {
            WinFormsTranslator.LoadAllForms(LoadBanlist);                // populate with every possible control
            WinFormsTranslator.UpdateAll(DefaultLanguage, Languages);    // propagate to others
            WinFormsTranslator.DumpAll(Banlist);                         // dump current to file
            WinFormsTranslator.SetRemovalMode();                         // remove used keys, don't add any
            WinFormsTranslator.LoadAllForms(LoadBanlist);                // de-populate
            WinFormsTranslator.RemoveAll(DefaultLanguage, PurgeBanlist); // remove all lines from above generated files that still remain

            Application.Exit();
        }
Ejemplo n.º 2
0
        private static void UpdateTranslations()
        {
            var assembly = System.Reflection.Assembly.GetExecutingAssembly();
            var types    = assembly.GetTypes();

            // add mode
            WinFormsTranslator.SetRemovalMode(false);
            WinFormsTranslator.LoadSettings <PKHeXSettings>(DefaultLanguage);
            WinFormsTranslator.LoadAllForms(types, LoadBanlist);      // populate with every possible control
            WinFormsTranslator.UpdateAll(DefaultLanguage, Languages); // propagate to others
            WinFormsTranslator.DumpAll(Banlist);                      // dump current to file

            // de-populate
            WinFormsTranslator.SetRemovalMode(); // remove used keys, don't add any
            WinFormsTranslator.LoadSettings <PKHeXSettings>(DefaultLanguage, false);
            WinFormsTranslator.LoadAllForms(types, LoadBanlist);
            WinFormsTranslator.RemoveAll(DefaultLanguage, PurgeBanlist); // remove all lines from above generated files that still remain

            // Move translated files from the debug exe loc to their project location
            var files = Directory.GetFiles(Application.StartupPath);
            var dir   = GetResourcePath("PKHeX.WinForms", "Resources", "text");

            foreach (var f in files)
            {
                var fn = Path.GetFileName(f);
                if (!fn.EndsWith(".txt"))
                {
                    continue;
                }
                if (!fn.StartsWith("lang_"))
                {
                    continue;
                }

                var loc = Path.Combine(dir, fn);
                if (File.Exists(loc))
                {
                    File.Delete(loc);
                }
                File.Move(f, loc);
                // if net framework support is ever removed, use the new overload instead of the stuff above:
                // File.Move(f, loc, true);
            }

            Application.Exit();
        }
Ejemplo n.º 3
0
        private static void UpdateTranslations()
        {
            WinFormsTranslator.SetRemovalMode(false);                    // add mode
            WinFormsTranslator.LoadAllForms(LoadBanlist);                // populate with every possible control
            WinFormsTranslator.UpdateAll(DefaultLanguage, Languages);    // propagate to others
            WinFormsTranslator.DumpAll(Banlist);                         // dump current to file
            WinFormsTranslator.SetRemovalMode();                         // remove used keys, don't add any
            WinFormsTranslator.LoadAllForms(LoadBanlist);                // de-populate
            WinFormsTranslator.RemoveAll(DefaultLanguage, PurgeBanlist); // remove all lines from above generated files that stil remain

            // Move translated files from the debug exe loc to their project location
            var files = Directory.GetFiles(Application.StartupPath);
            var dir   = GetResourcePath();

            foreach (var f in files)
            {
                var fn = Path.GetFileName(f);
                if (!fn.EndsWith(".txt"))
                {
                    continue;
                }
                if (!fn.StartsWith("lang_"))
                {
                    continue;
                }

                string lang = fn.Substring(5, fn.Length - (5 + 4));
                var    loc  = GetFileLocationInText("lang", dir, lang);
                if (File.Exists(f))
                {
                    File.Delete(loc);
                }
                File.Move(f, loc);
            }

            Application.Exit();
        }