Skip to main content

Command-line interface (CLI)

Build, test, and manage your Recontent integration directly from the command line.

info

Visit the GitHub repository to report bugs or suggest improvements.

Installation

This CLI is available through Homebrew or can be downloaded from the latest release page for operating systems not compatible with Homebrew.

To install the Recontent CLI with Homebrew, run:

brew tap recontentapp/recontent
brew install recontent

Using in GitHub Actions

This CLI is available as a GitHub Action for you to use in a continuous integration or continuous deployment pipeline.

name: Build website
on:
push:
branches: [master]
jobs:
continuous_integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Recontent CLI
uses: recontentapp/setup-action@v1

- name: Pull translations
env:
RECONTENT_API_KEY: <api_key>
run: recontent export phrases -p <project_id> -f "i18n/{{.LanguageLocale}}.{{.FormatExtension}}"

Authentication

Requests made to the public API are authenticated using an API key. API keys are specific to your workspace & can be created from your workspace settings.

To use your API key, make sure to add it as an environment variable named RECONTENT_API_KEY.

export RECONTENT_API_KEY=my-key

Available commands

recontent get

For a given resource, list items in a formatted table.

Supported resources include projects & languages.

# List projects
recontent get projects

# List languages
recontent get languages

# List languages within a project
recontent get languages -p <project_id>

recontent export

Export phrases & translations to the file system. You can configure the file format & folder structure to use.

# Export phrases & translations in all languages as JSON files
# Possible outputs include json|json_nested|yaml|yaml_nested
recontent export phrases -p <project_id> -o json

# Export phrases & translations for a specific language within a revision
recontent export phrases -p <project_id> -l <language_id> -r <revision_id>

# Export phrases & translations in all languages with a custom file structure
# Possible format variables include LanguageLocale|LanguageName|FormatExtension
recontent export phrases -p <project_id> -f "i18n/{{.LanguageLocale}}.{{.FormatExtension}}"