예제 #1
0
        /// <summary>Performs the translation using options selected in the open window.</summary>
        public static void Perform()
        {
            if (Translating)
            {
                return;
            }

            // Get settings:
            string sourcePath = SourcePath;

            // Create the info object:
            TranslationInfo info = new TranslationInfo(SourceLanguage, TargetLanguage);

            // Add a group to translate:
            int state = info.AddGroupFromFile(TargetPath, sourcePath);

            if (state != 1)
            {
                if (state == 2)
                {
                    LatestError = "Translate source file not found: " + sourcePath;
                }
                else
                {
                    LatestError = "Translation file '" + sourcePath + "' contained no variables!";
                }

                return;
            }

            // We're good to go!
            Translating   = true;
            LatestMessage = null;
            LatestError   = null;

            // Hook up it's callback:
            info.OnComplete = OnTranslationDone;

            // Start translating:
            info.Translate();
        }