Streamline your translation workflow with our powerful command-line interface. Perfect for CI/CD pipelines and automated deployments.
Authenticate with your Locsy account
Remove stored authentication credentials
Display current user information
name: Locsy Translation
on:
push:
branches: [main]
paths: ['src/locales/en.json']
jobs:
translate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install Locsy CLI
run: npm install -g @locsy/cli
- name: Translate files
env:
LOCSY_API_KEY: ${{ secrets.LOCSY_API_KEY }}
LOCSY_PROJECT: ${{ secrets.LOCSY_PROJECT }}
run: |
locsy translate src/locales/en.json \
--to es,fr,de \
--project $LOCSY_PROJECT
- name: Commit translations
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add src/locales/
git commit -m "Update translations" || exit 0
git pushCreate a .locsyrc.json file to set project defaults:
{
"project": "my-app-project-id",
"defaultLanguages": ["es", "fr", "de"],
"sourceFile": "src/locales/en.json",
"outputDir": "src/locales",
"format": "nested",
"glossary": true,
"context": "Web application UI"
}Environment Variables:
# Set API key via environment variable export LOCSY_API_KEY="your-api-key-here" # Optional: Set default project export LOCSY_PROJECT="your-project-id"
Install the Locsy CLI today and streamline your localization workflow