meta info
Title: Use Microsoft Translation For Localization
Keywords: localization, asp.net-core, translate, online, microsoft, service
Description: Learn how to use mymemory translation service for localization of Asp.Net Core web apps with XLocalizer.Translate.
Author: Ziya Mollamahmut
Date: 12-Nov-2020
Image: https://github.com/LazZiya/Docs/raw/master/XLocalizer/v1.0/images/xlocalizer-logo.png
Image-alt: XLocalizer Logo
Version: v1.0
Use Microsoft Translate For Localization
By Ziya Mollamahmut
This nuget containes two services, you can use any of them depending on your requirements:
See GitHub repo
Install
PM > Install-Package XLocalizer.Translate.MicrosoftTranslate
MicrosoftTranslateService
This service is directly connected to Microsoft Azure Translate Api's, and it offers free usage, but it requires a subscription!
{
"XLocalizer.Translate" : {
"Microsoft" : {
"Key" : " ..." ,
"Location" : " global"
}
}
}
Right click on the project name and select Manage User Secrets
services . AddHttpClient < ITranslator , MicrosoftTranslateService > ( ) ;
services . AddRazorPages ( )
. AddXLocalizer < LocSource , MicrosoftTranslateService > ( ops =>
{
// ...
ops . AutoTranslate = true ;
} ) ;
MicrosoftTranslateServiceRapidApi
This service is connected to RapidApi, and it requires a RapidApi key and a subscription to any paid or free plan.
{
"XLocalizer.Translate" : {
"RapidApiKey" : " ..." ,
}
}
Right click on the project name and select Manage User Secrets
services . AddHttpClient < ITranslator , MicrosoftTranslateServiceRapidApi > ( ) ;
services . AddRazorPages ( )
. AddXLocalizer < LocSource , MicrosoftTranslateServiceRapidApi > ( ops =>
{
// ...
ops . AutoTranslate = true ;
} ) ;