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

i18nhero

v0.0.2

Published

CLI tool for interacting with locales hosted on i18nhero.com

Downloads

214

Readme

@i18nhero/cli

This tool allows you to manage your i18nhero locale files directly from command line.

i18nhero 0.0.2
CLI tool for interacting with locales hosted on i18nhero.com

Usage: i18nhero <COMMAND>

Commands:
  init         Initialize a new i18nhero config
  pull         Download locale files from i18nhero
  push         Upload locale files to i18nhero
  completions  Generate shell completions
  login        Login to i18nhero
  logout       Logout from i18nhero
  help         Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

Install

The best way to install the i18nhero cli is using a package manager like Homebrew, Cargo or npm.

Linux & MacOS

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/i18nhero/cli/releases/latest/download/i18nhero-installer.sh | sh

Windows

powershell -ExecutionPolicy ByPass -c "irm https://github.com/i18nhero/cli/releases/latest/download/i18nhero-installer.ps1 | iex"

Homebrew

Install using Homebrew.

brew install i18nhero/tap/cli

Cargo

Install using Cargo.

cargo install i18nhero --locked

If you do not have Cargo installed, you need to install it first.

npm/npx

You can install i18nhero using npm:

npm install -g i18nhero

i18nhero --help

or run it directly using npx:

npx i18nhero --help

Getting started

Once installed you can setup your project by running i18nhero init.

You will then be prompted for your i18nhero api key, which can be generated at https://i18nhero.com/settings/api.

$ i18nhero init
You are not authenticated to i18nhero!
✔ Do you want to login now? · yes
? What is your api key? (https://i18nhero.com/settings/api) ›

After authenticating you can select the desired organization:

$ i18nhero init
You are not authenticated to i18nhero!
✔ Do you want to login now? · yes
✔ What is your api key? (https://i18nhero.com/settings/api) · ************************************
You are now signed in to i18nhero!
? Organization ›
❯ i18nhero
  demo-organization-1
  demo-organization-2

Then you will be asked which project you wish to setup.

$ i18nhero init
You are not authenticated to i18nhero!
✔ Do you want to login now? · yes
✔ What is your api key? (https://i18nhero.com/settings/api) · ************************************
You are now signed in to i18nhero!
✔ Organization · i18nhero
? Project ›
❯  @i18nhero/i18nhero.com
   @i18nhero/cli

You can now download your locale files by running the i18nhero pull command and upload your locale files using the i18nhero push command.

Configuration

This CLI can be configured by creating a file called i18nhero.config.json in the root of your project.

{
  "project_id": "ID-OF-PROJECT",
  "output": {
    "path": "lang",
    "format": "json",
    "keep_empty_fields": false,
    "flat": false,
  },
}

project_id

Used to define the linked project.

output

Configuration for downloading and uploading locale files.

path

Defines where locale files should be downloaded to, and uploaded from.

format

Defines the file format used when uploading and downloading locale files.

keep_empty_fields

Defines whether identifiers that are missing translations should be downloaded.

flat

Defines whether the locale files should be a flat string <-> string map or a multi layered map.

A point (.) in the identifier name is used to define multi-layered keys when flat is set to false.

The identifier pages.dashboard.title will be expanded to the following:

{
  "pages": {
    "dashboard": {
      "title": ""
    }
  }
}

Shell completions

Shell completions can be generated using i18nhero completions <SHELL>.

Generate shell completions

Usage: i18nhero completions <SHELL>

Arguments:
  <SHELL>  [possible values: bash, elvish, fish, powershell, zsh]

Options:
  -h, --help     Print help
  -V, --version  Print version

Bash

Add the following to your .bashrc.

eval "$(i18nhero completions bash)"

Bash

Add the following to your .zshrc.

eval "$(i18nhero completions zsh)"

Fish

Add the following to ~/.config/fish/config.fish.

i18nhero completions fish | source

PowerShell

Add the following to your PowerShell configuration (Can be found by running $PROFILE).

Invoke-Expression (&i18nhero completions powershell)

Elvish

Add the following to ~/.elvish/rc.elv.

eval (i18nhero completions elvish)

Command reference

Init

i18nhero init is used to setup a new i18nhero config.

Initialize a new i18nhero config

Usage: i18nhero init [OPTIONS]

Options:
      --overwrite  Overwrite existing config
  -h, --help       Print help
  -V, --version    Print version

Pull

i18nhero pull is used to download locale files from i18nhero.com

Download locale files from i18nhero

Usage: i18nhero pull [OPTIONS]

Options:
      --allow-dirty
          Allow overwriting files that are not staged in VCS.

          Currently only applicable for projects that use git.

      --api-key <API_KEY>
          Use for authentication instead of global auth config

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

Push

The push command is used for pushing (uploading) locales to i18nhero.com.

Upload locale files to i18nhero

Usage: i18nhero push [OPTIONS]

Options:
      --api-key <API_KEY>  Use for authentication instead of global auth config
  -h, --help               Print help
  -V, --version            Print version

Login

The i18nhero login command is used for authenticating to i18nhero.

Login to i18nhero

Usage: i18nhero login

Options:
  -h, --help     Print help
  -V, --version  Print version

Logout

Logout from i18nhero

Usage: i18nhero logout

Options:
  -h, --help     Print help
  -V, --version  Print version

Completions

The i18nhero login command is used for generating shell completions for this tool.

Generate shell completions

Usage: i18nhero completions <SHELL>

Arguments:
  <SHELL>  [possible values: bash, elvish, fish, powershell, zsh]

Options:
  -h, --help     Print help
  -V, --version  Print version