Crates.io | i18nhero |
lib.rs | i18nhero |
version | 0.0.2 |
source | src |
created_at | 2024-10-25 20:52:59.186088 |
updated_at | 2024-11-12 00:20:20.875672 |
description | CLI tool for interacting with locales hosted on i18nhero.com |
homepage | https://i18nhero.com |
repository | https://github.com/i18nhero/cli |
max_upload_size | |
id | 1423163 |
size | 137,647 |
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
The best way to install the i18nhero cli is using a package manager like Homebrew, Cargo or npm.
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/i18nhero/cli/releases/latest/download/i18nhero-installer.sh | sh
powershell -ExecutionPolicy ByPass -c "irm https://github.com/i18nhero/cli/releases/latest/download/i18nhero-installer.ps1 | iex"
Install using Homebrew.
brew install i18nhero/tap/cli
Install using Cargo.
cargo install i18nhero --locked
If you do not have Cargo installed, you need to install it first.
You can install i18nhero using npm:
npm install -g i18nhero
i18nhero --help
or run it directly using npx:
npx i18nhero --help
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.
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,
},
}
Used to define the linked project.
Configuration for downloading and uploading locale files.
Defines where locale files should be downloaded to, and uploaded from.
Defines the file format used when uploading and downloading locale files.
Defines whether identifiers that are missing translations should be downloaded.
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 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
Add the following to your .bashrc
.
eval "$(i18nhero completions bash)"
Add the following to your .zshrc
.
eval "$(i18nhero completions zsh)"
Add the following to ~/.config/fish/config.fish
.
i18nhero completions fish | source
Add the following to your PowerShell configuration (Can be found by running $PROFILE
).
Invoke-Expression (&i18nhero completions powershell)
Add the following to ~/.elvish/rc.elv
.
eval (i18nhero completions elvish)
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
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
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
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 from i18nhero
Usage: i18nhero logout
Options:
-h, --help Print help
-V, --version Print version
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