Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
i18nexus-cli
Advanced tools
A command line interface for accessing and managing translations through the i18nexus API
i18nexus is a translation management web application designed for use with i18next, next-intl, and react-intl. Learn more with these quick tutorials:
npm install -g i18nexus-cli
The commands below have options that can be set with environment variables. Since the majority of our users are using this package in the context of their web application, this package will load the .env
file in the current working directory to check for i18nexus variables. If you would prefer not to load your .env
file, you can run export I18NEXUS_NO_DOT_ENV=true
.
i18nexus pull -k <PROJECT_API_KEY>
The above snippet will download all of your latest translations to your current directory. Your translation files will be downloaded in a file structure based on the convention of your i18n library.
If your i18nexus project is set to i18next
:
.
└── public
└── locales
├── en
| └── common.json
└── de
└── common.json
If your i18nexus project is set to i18next
and the CLI detects you're using Next.js + App Router:
.
└── locales
├── en
| └── common.json
└── de
└── common.json
If your i18nexus project is set to next-intl
:
.
└── messages
└── en.json
└── de.json
If your i18nexus project is set to react-intl
:
.
└── messages
└── locales
├── en
| └── common.json
└── de
└── common.json
If you wish to download your files to a different directory, you can use the --path
option to specify your download destination. See all options below:
Option | Default value |
---|---|
--api-key or -k | |
--path or -p | (See above) |
--ver or -v | latest |
--confirmed | false |
--clean | false |
--api-key
Your project API key (Can also be set using environment variable I18NEXUS_API_KEY
)
--path
The path to the destination folder in which translation files will be downloaded
--ver
The version of your project's translations to be downloaded (Can also be set using environment variable I18NEXUS_VERSION
)
--confirmed
Downloads only translations that have been confirmed in i18nexus
--clean
Before download, clears your destination folder specified in --path. As a safety precaution, this only deletes folders with names that match a simple language code regex. You should still ensure you are not storing any files in your destination folder that you do not want deleted.
The following commands require a Personal Access Token (PAT) because they write data to your i18nexus project. PATs are created in your i18nexus account dashboard.
REMEMBER: Keep these tokens a secret and do NOT publish them to any public code repositories such as Github. They should never be client facing. Treat each token as if it is your i18nexus password.
i18nexus add-string
or i18nexus a
i18nexus a -K 'welcome_msg' -v 'Welcome to my app!' -ns 'common' -k <PROJECT_API_KEY> -t <YOUR_PERSONAL_ACCESS_TOKEN>
The above snippet will create a new string in your i18nexus project in your common
namespace.
Translations for the string will be automatically generated and machine translated for all of your project's languages, just as if you added the string manually in the i18nexus web application.
Option | Required? |
---|---|
--api-key or -k | ✔ |
--pat or -t | ✔ |
--namespace or -ns | ✔ |
--key or -K | ✔ |
--value or -v | ✔ |
--details or -d | |
--ai-instructions or -ai |
--api-key
Your project API key (Can also be set using environment variable I18NEXUS_API_KEY
)
--pat
A personal access token that you have generated in your i18nexus account (Can also be set using environment variable I18NEXUS_PERSONAL_ACCESS_TOKEN
)
--namespace
The namespace in which to create the string
--key
The key of the string to create
--value
The value of the string to create
--details
The details of the string to create (optional)
--ai-instructions
Instructions or context for AI machine translator (optional)
i18nexus update-string <namespace> <key>
or i18nexus u <namespace> <key>
i18nexus u common welcome_msg -v 'Welcome' -k <PROJECT_API_KEY> -t <YOUR_PERSONAL_ACCESS_TOKEN>
The above snippet will update a the value of the string with key welcome_msg
in your common
namespace to Welcome
.
The first 2 arguments are the namespace and the key of the string you wish to update.
You can then update the key, value, details, and/or namespace by using the command options:
Option | Required? |
---|---|
--api-key or -k | ✔ |
--pat or -t | ✔ |
--namespace or -ns | |
--key or -K | |
--value or -v | |
--details or -d | |
--ai-instructions or -ai | |
--reset-confirmed | |
--retain-confirmed |
--api-key
Your project API key (Can also be set using environment variable I18NEXUS_API_KEY
)
--pat
A personal access token that you have generated in your i18nexus account (Can also be set using environment variable I18NEXUS_PERSONAL_ACCESS_TOKEN
)
--namespace
The new namespace of the string
--key
The new key of the string
--value
The new value of the string
--details
The new details of the string
--ai-instructions
Instructions or context for AI machine translator
--reset-confirmed
Confirmed translations of this string will be reset with machine translations of the new value
--retain-confirmed
Confirmed translations of this string will be retained
i18nexus delete-string <namespace> <key>
or i18nexus d <namespace> <key>
i18nexus d common welcome_msg -k <PROJECT_API_KEY> -t <YOUR_PERSONAL_ACCESS_TOKEN>
The above snippet will delete the string welcome_msg
from your common
namespace, along with its associated translations.
Option | Required? |
---|---|
--api-key or -k | ✔ |
--pat or -t | ✔ |
--api-key
Your project API key (Can also be set using environment variable I18NEXUS_API_KEY
)
--pat
A personal access token that you have generated in your i18nexus account (Can also be set using environment variable I18NEXUS_PERSONAL_ACCESS_TOKEN
)
i18nexus import <filePath>
i18nexus import ./en.json -ns common -k <PROJECT_API_KEY> -t <YOUR_PERSONAL_ACCESS_TOKEN>
The above snippet will read the contents of ./en.json
and import them into the base language of your i18nexus project.
This is the equivalent of using the Import tool in the i18nexus web application. However, this CLI command only allows for uploading a JSON file for your base language.
Option | Required? |
---|---|
--api-key or -k | ✔ |
--pat or -t | ✔ |
--overwrite |
--api-key
Your project API key (Can also be set using environment variable I18NEXUS_API_KEY
)
--pat
A personal access token that you have generated in your i18nexus account (Can also be set using environment variable I18NEXUS_PERSONAL_ACCESS_TOKEN
)
--overwrite
If any keys already exist in the target namespace, overwrite the values with the imported values.
i18nexus add-namespace <namespaceTitle>
i18nexus add-namespace common -k <PROJECT_API_KEY> -t <YOUR_PERSONAL_ACCESS_TOKEN>
The above snippet will create a new namespace in your i18nexus project with the title common
.
Option | Required? |
---|---|
--api-key or -k | ✔ |
--pat or -t | ✔ |
--api-key
Your project API key (Can also be set using environment variable I18NEXUS_API_KEY
)
--pat
A personal access token that you have generated in your i18nexus account (Can also be set using environment variable I18NEXUS_PERSONAL_ACCESS_TOKEN
)
FAQs
Command line interface (CLI) for accessing the i18nexus API
The npm package i18nexus-cli receives a total of 7,143 weekly downloads. As such, i18nexus-cli popularity was classified as popular.
We found that i18nexus-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.