/// <summary>
        ///     The execute method.
        /// </summary>
        /// <returns>
        ///     The <see cref="bool" />.
        /// </returns>
        public override bool Execute()
        {
            int  skip       = 0;
            int  count      = 100;
            int  totalcount = 0;
            bool hascontent = true;

            TranslationServiceFacade.UserTranslation[] usertranslations = new TranslationServiceFacade.UserTranslation[100];
            usertranslations.Initialize();

            using (TmxWriter TmxDocument = new TmxWriter(this.TmxDocument.ValueString, this.sourceLanguage.ValueString, this.targetLanguage.ValueString, false))
            {
                do
                {
                    usertranslations = TranslationServiceFacade.GetUserTranslations(this.sourceLanguage.ValueString, this.targetLanguage.ValueString, skip, count);
                    skip            += count;
                    foreach (var usertrans in usertranslations)
                    {
                        if (usertrans.OriginalText == null)
                        {
                            hascontent = false;
                            break;
                        }
                        TmxDocument.TmxWriteSegment(usertrans.OriginalText, usertrans.TranslatedText, usertrans.From, usertrans.To, TmxWriter.TUError.good);
                        totalcount++;
                    }
                    Logger.WriteLine(LogLevel.None, "{0} translation units written.", totalcount);
                } while (hascontent);
            }


            return(true);
        }
예제 #2
0
        /// <summary>
        ///     The execute method.
        /// </summary>
        /// <returns>
        ///     The <see cref="bool" />.
        /// </returns>
        public override bool Execute()
        {
            int skip = 0;
            int count = 100;
            int totalcount = 0;
            bool hascontent = true;

            TranslationServiceFacade.UserTranslation[] usertranslations = new TranslationServiceFacade.UserTranslation[100];
            usertranslations.Initialize();

            using (TmxWriter TmxDocument = new TmxWriter(this.TmxDocument.ValueString, this.sourceLanguage.ValueString, this.targetLanguage.ValueString))
            {
                do
                {
                    usertranslations = TranslationServiceFacade.GetUserTranslations(this.sourceLanguage.ValueString, this.targetLanguage.ValueString, skip, count);
                    skip += count;
                    foreach (var usertrans in usertranslations)
                    {
                        if (usertrans.OriginalText == null)
                        {
                            hascontent = false;
                            break;
                        }
                        TmxDocument.TmxWriteSegment(usertrans.OriginalText, usertrans.TranslatedText, usertrans.From, usertrans.To, TmxWriter.TUError.good);
                        totalcount++;
                    }
                    Logger.WriteLine(LogLevel.None, "{0} translation units written.", totalcount);
                } while (hascontent);
            }

            return true;
        }