JSONTranslator 2.0.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package JSONTranslator --version 2.0.0.3
NuGet\Install-Package JSONTranslator -Version 2.0.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="JSONTranslator" Version="2.0.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JSONTranslator --version 2.0.0.3
#r "nuget: JSONTranslator, 2.0.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install JSONTranslator as a Cake Addin
#addin nuget:?package=JSONTranslator&version=2.0.0.3

// Install JSONTranslator as a Cake Tool
#tool nuget:?package=JSONTranslator&version=2.0.0.3

Release Status

Build status

alternate text is missing from this package README image

Develop Build Status

Build status

JSON Document Translator

This is a .Net Core 2 console application that accepts a JSON file, calls the Microsoft Text Translator API in Azure and writes translated files to disk.

Installation

To install via nuget package manager

Install-Package JSONTranslator

To install via .Net Core CLi

dotnet add package JSONTranslator

Required Parameters:

  • --sourcePath this is the path on disk to the JSON file that needs to be translated
  • --key this is one of the Ocp-Apim-Subscription-Key from Azure for Translator Text API
  • --languages this is a space seperated list of languages that you want to translate the source into. See Microsoft Text Translator API for a complete list of supported languages

Optional Parameters:

  • --sourceLanguage this is the original language of the document. if it is omitted english (en) will be used

Runing the Translator

dotnet run --key "abc123" --languages de fr es --sourcePath "c:\projects\myProject\originalMessage.json" --sourceLanguage en

Document format

Minified JSON files are not currently supported. The JSON file can be a single object or contain subobjects. New in version 2 you are no longer required to have language specified in your document. You can now set the source language through the command line. Below are examples of different valid schemas that have been translated into Spanish.

Schema 1

{
    "Language" : "english",
    "Messages": {
        "anniversary.rollupMultipleEmployees": "Employees have Anniversaries on",
        "anniversary.rollupSingleEmployee": "Employee has an Anniversary on",
        "anniversary.singleHas": "has a",
        "anniversary.singleWorkAnniversary": "Year Work Anniversary on"
    }
}

outputs as

{
    "Language ":"Inglés",
    "Messages": {
        "anniversary.rollupMultipleEmployees":"Los empleados tienen aniversarios",
        "anniversary.rollupSingleEmployee":"Empleado tiene un aniversario",
        "anniversary.singleHas":"tiene un",
        "anniversary.singleWorkAnniversary":"Aniversario de trabajo en"
    }
}

Schema 2

{
    "Language" : "english",
    "anniversary.rollupMultipleEmployees": "Employees have Anniversaries on",
    "anniversary.rollupSingleEmployee": "Employee has an Anniversary on",
    "anniversary.singleHas": "has a",
    "anniversary.singleWorkAnniversary": "Year Work Anniversary on"
}

outputs as

{
    "Language ":"Inglés",
    "anniversary.rollupMultipleEmployees":"Los empleados tienen aniversarios",
    "anniversary.rollupSingleEmployee":"Empleado tiene un aniversario",
    "anniversary.singleHas":"tiene un",
    "anniversary.singleWorkAnniversary":"Aniversario de trabajo en"
}

Schema 3

{
    "Messages": {
        "anniversary.rollupMultipleEmployees": "Employees have Anniversaries on",
        "anniversary.rollupSingleEmployee": "Employee has an Anniversary on",
        "subObject2" : {
            "lookup" : "message"
        }
    }
}

outputs as

{
    "Messages": {
    "anniversary.rollupMultipleEmployees":"Los empleados tienen aniversarios",
    "anniversary.rollupSingleEmployee":"Empleado tiene un aniversario",
        "subObject2" : {
            "lookup ":"Mensaje"
        }
    }
}

Output

Folder

The translated files will be output to the same folder as the source input file.

File Names

There will be one translated file for each new language. If the original file name does not contain the language (ie labels.json) then each new file will be appended with the language. For example if the original file was labels.json and the languages are Spanish and French, the output files will be labels.es.json and labels.fr.json. Additionally, if the original filename was only the language (ie en.json) then the output filenames will be the languages. So if the input file was en.json and the languages were German and Polish then the new files will be de.json and pl.json.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  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 netcoreapp2.0 is compatible.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.0.1 845 12/9/2018
2.0.0.3 666 11/29/2018
2.0.0.2 688 11/4/2018
2.0.0.1 676 11/4/2018

Initial Release