ResourceTranslator.CLI
1.0.1
.NET 5.0
This package targets .NET 5.0. The package is compatible with this framework or higher.
.NET Core 3.1
This package targets .NET Core 3.1. The package is compatible with this framework or higher.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet tool install --global ResourceTranslator.CLI --version 1.0.1
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local ResourceTranslator.CLI --version 1.0.1
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=ResourceTranslator.CLI&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package ResourceTranslator.CLI --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ResourceTranslator.CLI
This tool can translate your resource files with Microsoft Cognitive Service for translations
General
To install it
dotnet tool install --global ResourceTranslator.CLI
The easiest way to run it
resourceTranslator --optionsfile "C:\PathToYourOptions\sampleOptions.json"
The passed options file can look like this for example
{
"FileName": "C:\\dev\\myProject\\src\\Shared\\Resources\\en-US.yml",
"TextTranslationEndpoint": "https://api.cognitive.microsofttranslator.com/",
"ApiKey": "<your cognitive service api key>",
"FileOutputFormat": "{FileName}.{Culture}.{Extension}",
"OutputDir": "C:\\dev\\myProject\\src\\Shared\\Resources",
"TargetCultures": "de-DE, es-ES, it-IT, sv-SE, en-GB",
"SourceCulture": null,
"Region": "germanywestcentral",
"OutputFormat": null,
"OverwriteExistingValuesWithNewTranslations": false,
"AutoSort": true
}
Based on your input options for TargetCultures
this tool creates translations for given input file FileName
Notice!: If a result file already exists only missing translations will be added.
Options
Name | Alias | Sample | Is Required | Description |
---|---|---|---|---|
FileName | f | -f "C:\path\file.json" |
yes | The main input file to translate |
TextTranslationEndpoint | endpoint | -endpoint "https://api.cognitive.microsofttranslator.com/" |
yes | Endpoint for translation service |
ApiKey | key | -key "<your api key>" |
yes | Api key for translation service |
Region | region | -region "germanywestcentral" |
yes | Region where your azure cognitive service is stored |
FileOutputFormat | of | -of "Generated_{FileName}_for_culture_{Culture}.{Extension}" |
no | Format to save out put file |
OutputDir | outdir | -outdir "C:\otherdir\" |
no | Optional path to store result files in. Default is same dir as input file |
TargetCultures | target | -target "de-DE, it-IT" |
yes | Target cultures to generate translations for. Split by , or ; possible |
OutputFormat | format | -format "Json" |
no | Default same as input but if you want to convert yaml to json for example you can specify a format here |
OverwriteExistingValuesWithNewTranslations | overwritevalues | -overwritevalues "True" |
no | If this is true existing target resources will overwridden and not merged |
AutoSort | sort | -sort "True" |
no | If this is true all result files and the input file file sorted automatically Asc |
Notice!: You can combine passing options file and overwrite only some parameters.
In this example all parameters are stored in a sampleOptions.json
but api key and source file will be overwridden by call
resourceTranslator --optionsfile "C:\PathToYourOptions\sampleOptions.json" -key "diferentApiKey" -f "PathToMyFile.json"
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.1 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.