コード例 #1
0
        private static string TranslateParagraphBlock(ParagraphBlock paragraphBlock, int nestLevel)
        {
            string paragraphBlockText;

            (var plainInlineText, var shouldBeTranslate) = GetTextToTranslate(paragraphBlock.Inline);
            if (shouldBeTranslate)
            {
                var result = TranslatorClient.Translate(plainInlineText, "ja", "en");
                paragraphBlockText = result.Result;
            }
            else
            {
                paragraphBlockText = plainInlineText;
            }

            return(GetIndentWhitespaces(nestLevel) + paragraphBlockText);
        }
コード例 #2
0
        private static string TranslateHeadingBlock(HeadingBlock headingBlock, int nestLevel)
        {
            var headingLevelMarkText = new string('#', headingBlock.Level);

            string headingBlockText;

            (var plainInlineText, var shouldBeTranslate) = GetTextToTranslate(headingBlock.Inline);
            if (shouldBeTranslate)
            {
                var result = TranslatorClient.Translate(plainInlineText, "ja", "en");
                headingBlockText = string.Format("{0} {1}", headingLevelMarkText, result.Result);
            }
            else
            {
                headingBlockText = string.Format("{0} {1}", headingLevelMarkText, plainInlineText);
            }

            return(GetIndentWhitespaces(nestLevel) + headingBlockText);
        }