マイクロソフトのAPIを使用して他の言語にページの内容を翻訳します利用可能なOOTBを翻訳することはできますが、それは機能しません。また、OOTBオプションのみが翻訳されますが、ページのコンテンツは翻訳されません。は <p></p>私はバリエーションを使用しようとした、私たちは、英語からスペイン語へのインスタンスの他の言語へのページまたは、むしろ全ページの内容を翻訳する必要があり
Microsoft APIを使用して同じことを達成する方法はありますか?
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 = "[email protected]", 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();
}
}
}
おかげ
Paru
私はこれを試してみましたが、それは他の言語に私のウェブサイトを変換するが、内容は、私が翻訳し、質問に私のコードを追加していませんコンテンツは動作しませんが、何が間違っていないかを確認してください。どちらも間違いを受けないでください。 –
リンクのみの回答は許可されていません。あなた自身の答えを形成するか、これをすべて削除してください。 https://stackoverflow.com/help/how-to-answer – Rob