npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@cli107/transverto

v1.2.3

Published

Generate automatically translations for your i18n json translate files

Downloads

14

Readme

CLI transverto

Label management command.

NPM version GitHub license

Usage

npm install @cli107/transverto --save-dev
ctv --help

Commands

ctv cache

Cache management command.

USAGE
  $ ctv cache [-c]

FLAGS
  -c, --clear

DESCRIPTION
  Cache management command.
  Cache dir: C:\Users\User\AppData\Local\ctv

EXAMPLES
  $ ctv cache

  $ ctv cache --help

See code: src/commands/cache.ts

ctv export:csv [LANGCODE]

Export translations to file.

USAGE
  $ ctv export:csv [LANGCODE] [-d <value>] [--eol cr|crlf|lf] [-i <value>] [-o <value>] [--withBOM]

ARGUMENTS
  LANGCODE  The language code. If not specified, all available translations are exported.

FLAGS
  -d, --delimiter=<value>   [default: ,] delimiter of columns.
  -i, --include=<value>     include language code
  -o, --outputFile=<value>  [default: dist/output.csv] Path to save the file
      --eol=<option>        [default: lf]
                            <options: cr|crlf|lf>
      --withBOM             [default: false] with BOM character

DESCRIPTION
  Export translations to file.

EXAMPLES
  $ ctv export:csv

  $ ctv export:csv en

  $ ctv export:csv en --include=uk

  $ ctv export:csv en --outputFile=dist/output.csv

  $ ctv export:csv --delimiter=,

  $ ctv export:csv --eol=lf

See code: src/commands/export/csv.ts

ctv help [COMMANDS]

Display help for ctv.

USAGE
  $ ctv help [COMMANDS] [-n]

ARGUMENTS
  COMMANDS  Command to show help for.

FLAGS
  -n, --nested-commands  Include all nested commands in the output.

DESCRIPTION
  Display help for ctv.

See code: @oclif/plugin-help

ctv init

Create a default configuration file

USAGE
  $ ctv init [-f]

FLAGS
  -f, --force  overwrite an existing file

DESCRIPTION
  Create a default configuration file

EXAMPLES
  $ ctv init

  $ ctv init --help

  $ ctv init --force

See code: src/commands/init.ts

ctv label [ADD] [DELETE] [GET] [REPLACE] [SYNC]

Label management command.

USAGE
  $ ctv label [ADD] [DELETE] [GET] [REPLACE] [SYNC]

ARGUMENTS
  ADD      Adds a new label.
  DELETE   Deletes a label.
  GET      Retrieves the labels.
  REPLACE  Replaces a label with the given value.
  SYNC     A command to update labels synchronously.

DESCRIPTION
  Label management command.

See code: src/commands/label/index.ts

ctv label:add [LABEL]

Add a new label

USAGE
  $ ctv label:add [LABEL] [-f <value>] [--noAutoTranslate] [--silent] [-t <value>]

ARGUMENTS
  LABEL  A label key

FLAGS
  -f, --fromLangCode=<value>  The language code of source text.
  -t, --translation=<value>   Translation
  --noAutoTranslate
  --silent

DESCRIPTION
  Add a new label

EXAMPLES
  $ ctv label:add "hello.world" -f="en"

  $ ctv label:add "hello.world" -f en -t "Hello World!"

  $ ctv label:add "hello.world" -fen -t "Hello World!"

  $ ctv label:add "hello.world" -t "Hello World!"

See code: src/commands/label/add.ts

ctv label:delete LABEL

Delete the specified label.

USAGE
  $ ctv label:delete LABEL [-r]

ARGUMENTS
  LABEL  A label key

FLAGS
  -r, --noReport

DESCRIPTION
  Delete the specified label.

EXAMPLES
  $ ctv label:delete hello

  $ ctv label:delete hello.world

See code: src/commands/label/delete.ts

ctv label:get [LABEL]

Display a list of translations for the specified label

USAGE
  $ ctv label:get [LABEL] [--json] [-f <value>]

ARGUMENTS
  LABEL  A label key

FLAGS
  -f, --fromLangCode=<value>  The language code of source text.

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Display a list of translations for the specified label

EXAMPLES
  $ ctv label:get

  $ ctv label:get hello.world

  $ ctv label:get hello.world -f="en"

  $ ctv label:get hello.world -fen

See code: src/commands/label/get.ts

ctv label:replace LABEL

Replace the label

USAGE
  $ ctv label:replace LABEL -t <value> [-f <value>]

ARGUMENTS
  LABEL  A label key

FLAGS
  -f, --langCode=<value>     The language code of source text.
  -t, --translation=<value>  (required) The translation text.

DESCRIPTION
  Replace the label

EXAMPLES
  $ ctv label:replace --help

  $ ctv label:replace hello.world -t="Hello world!!!"

  $ ctv label:replace hello.world -t="Hello world!!!" -fen

See code: src/commands/label/replace.ts

ctv label:sync

Synchronizing tags in translation files...

USAGE
  $ ctv label:sync [--autoTranslate] [-r] [-s]

FLAGS
  -r, --noReport
  -s, --silent
  --autoTranslate

DESCRIPTION
  Synchronizing tags in translation files...

EXAMPLES
  $ ctv label:sync

  $ ctv label:sync "hello.world" -f="en"

See code: src/commands/label/sync.ts


Example config file .ctv.config.json

{
  "basePath": "dist/i18n",
  "basePathEnum": "dist/i18n/language.ts",
  "bing": {
    "userAgent": "..."
  },
  "engine": "bing",
  "engineUseCache": false,
  "labelValidation": "^[a-z0-9\\.\\-\\_]{3,100}$",
  "languages": [
    "en"
  ],
  "nameEnum": "LanguageLabel",
  "userAgent": "..."
}

Example automatically generated file en.json

{
  "hello": {
    "world": "Hello World!",
    "world_2": "Hello World 2!",
    "world_3": "Hello World 3!"
  }
}

Example automatically generated file language.ts

export enum ELanguageLabel {
  EN = 'en',
}

export type TLanguageLabel = 'hello.world'
  | 'hello.world_2'
  | 'hello.world_3';

export type TLanguageLabelOrString  = TLanguageLabel | string;
export type TLanguageLabelOrNever  = TLanguageLabel | never;