1.0.4 • Published 10 months ago

localize-ts v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

LOCALIZE-TS

npm version npm downloads

LOCALIZE-TS is a tool used to convert JSON translations into TypeScript definitions. This helps in maintaining type safety and consistency across your localization files.

Installation

You can install LOCALIZE-TS globally or as a dev dependency in your project.

Using npm

npm install -g localize-ts
# or as a dev dependency
npm install --save-dev localize-ts

Using yarn

yarn global add localize-ts
# or as a dev dependency
yarn add --dev localize-ts

Using pnpm

pnpm add -g localize-ts
# or as a dev dependency
pnpm add -D localize-ts

Usage Example

Input JSON (input.json)

{
    "title": "LOCALIZE-TS",
    "description": "This is a {{description}} to show how to use {{package}}",
    "greetings": "Welcome {{name}}!"
}

Output TypeScript (output.ts)

// GENERATED BY LOCALIZE-TS

export interface Translations {
 title: string;
 description: { description: string; package: string };
 greetings: { name: string };
}

Command

To generate the TypeScript definitions, run the following command:

localize-ts -f input.json -o output.ts

This will read the input.json file and generate the TypeScript definitions in output.ts.

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago