TomsToolbox.JsonToResX
1.0.4
dotnet tool install --global TomsToolbox.JsonToResX --version 1.0.4
dotnet new tool-manifest
dotnet tool install --local TomsToolbox.JsonToResX --version 1.0.4
#tool dotnet:?package=TomsToolbox.JsonToResX&version=1.0.4
nuke :add-package TomsToolbox.JsonToResX --version 1.0.4
JsonToResX
A DotNet command line tool to convert .json resrouces files used in angular to .resx files and vice versa.
Intention of this tool
In Angular applications, it is common to use .json files for localization. However, in .NET applications, the standard is to use .resx files. This tool allows you to convert between these two formats easily, so you can work with localization in both environments without hassle.
For example, you can use it to convert your Angular localization files into .resx files to be able to use comfortable localization tools like ResXResourceManager, that support automatic translations and many checks and verifications, and then convert the .resx files back to .json files for use in your Angular application.
Conventions
In .json files, the keys are commonly delimited by dots, e.g. app.title, app.subtitle, while in .resx files the keys are usually delimited by underscores, e.g. app_title, app_subtitle.
This tool will convert the keys accordingly, so you work in both environments seamlessly.
The Angular translations loader replaces placeholders like {{name}} with the actual values at runtime.
However, in .resx files, ResXResourceManager expects named placeholders in the format ${name}.
This tool will convert the placeholders accordingly, so you can take advantage of the placeholder validation features provided by ResXResourceManager.
Sample
Input (Test.json)
{
"app.title": "My Application",
"app.subtitle": "Welcome to my application",
"app.greeting": "Hello {{name}}"
}
Output (Test.resx)
<?xml version="1.0" encoding="utf-8"?>
<root>
...
<data name="app_title" xml:space="preserve">
<value>My Application</value>
</data>
<data name="app_subtitle" xml:space="preserve">
<value>Welcome to my application</value>
</data>
<data name="app_greeting" xml:space="preserve">
<value>Hello ${name}</value>
</data>
</root>
Installation
dotnet tool install TomsToolbox.JsonToResX -g
Usage
Usage: JsonToResX [--help] [--version] input output
JsonToResX
Arguments:
0: input (Required)
1: output (Required)
Options:
-h, --help Show help message
--version Show version
Example
dotnet tool install TomsToolbox.JsonToResX -g
JsonToResX Resources.json Resources.resx
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.