首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Microsoft将页面内容转换为其他语言

使用Microsoft将页面内容转换为其他语言
EN

Stack Overflow用户
提问于 2017-11-28 07:53:27
回答 2查看 465关注 0票数 0

我们要求将一页或更确切地说是整页的内容翻译成其他语文,例如从英文翻译成西班牙文,

我试着使用现有的OOTB进行翻译,但是它不起作用,只有OOTB选项被翻译,而不是页面上的内容。

是否需要使用Microsoft来完成同样的任务?

代码语言:javascript
复制
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint;
using Microsoft.Office.Client.TranslationServices;
using System.Security;

namespace testTranslate
{
    class Program
    {
        static void Main(string[] args)

        {
            ClientContext clientContext = new ClientContext("https://xyz.sharepoint.com/sites/abc/");
            string username = "abc@xyz.onmicrosoft.com", pssword = "";
            var securePassword = new SecureString();
            foreach (char c in pssword)
            {
                securePassword.AppendChar(c);
            }
            var onlineCredentials = new SharePointOnlineCredentials(username, securePassword);
            clientContext.Credentials = onlineCredentials;
            string jobID;
            string culture = "en";
            string name = "translationJob1";
            string inputFile = "https://xyz.sharepoint.com/sites/abc/SitePages/testTranslate.aspx";
            string outputFile = "https://xyz.sharepoint.com/sites/abc/SitePages/testTranslateEnglish.aspx";
            TranslationJob job = new TranslationJob(clientContext, culture);
            job.AddFile(inputFile, outputFile);
            job.Name = name;
            job.Start();
            clientContext.Load(job);
            clientContext.ExecuteQuery();
            //To retrieve the translation job ID.
            jobID = job.JobId.ToString();

            //IEnumerable<string> supportedLanguages = TranslationJob.EnumerateSupportedLanguages(clientContext);
            //clientContext.ExecuteQuery();
            //foreach (string item in supportedLanguages)
            //{
            //    Console.Write(item + ", ");
            //}
            Console.WriteLine("Script completed,press any key to exit");
            Console.ReadKey();

        }
    }
}

谢谢

帕鲁

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-12-01 21:13:47

SharePoint提供免费的机器翻译服务,该服务由提供。在Microsoft翻译器SharePoint的https://www.microsoft.com/en-us/translator/sharepoint.aspx网页上了解更多信息

如果您对使用Translator Text API感兴趣,请按照https://www.microsoft.com/en-us/translator/getstarted.aspx入门网页中的步骤操作。您可以通过订阅免费的每月订阅层来测试API。

票数 0
EN

Stack Overflow用户

发布于 2017-12-05 17:21:30

不是SharePoint专家,但您可能需要添加代码来翻译实际的文档。下面链接到使用Microsoft Translator API的完整文档翻译工具:

https://github.com/MicrosoftTranslator/DocumentTranslator

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47526534

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档