NeoIQ Localize

GitHub Actions

With the github action, you can easily translate your code by just pushing your code to the repository, the github action will then translate your new keys, either create a pull request or commit your changes. This saves you a lot of time and effort while maintaining high quality translations.


Installation

To use the NeoIQ Localize GitHub Action in your repository, you'll need to:

  1. Set up your repository secrets with your NeoIQ Localize credentials
  2. Create a workflow file in your repository

Setting up Repository Secrets

Add the following secrets in your repository settings (Settings > Secrets and variables > Actions):

  • NEOIQ_LOCALIZE_API_KEY: Your NeoIQ Localize API key
  • NEOIQ_LOCALIZE_PROJECT_ID: Your NeoIQ Localize project ID

You can find these values in your NeoIQ Localize dashboard under Project Settings.

Environment Variables

The GitHub Action uses the following environment variables:

  • NEOIQ_LOCALIZE_API_KEY (Required): Your NeoIQ Localize API key for authentication
  • NEOIQ_LOCALIZE_PROJECT_ID (Required): Your NeoIQ Localize project ID
  • GITHUB_TOKEN (Required): Automatically provided by GitHub, used for creating PRs

Example Workflow

Create a new file .github/workflows/neoiq-localize.yml in your repository with the following content:

.github/workflows/release.yml
name: Deploy Website
 
on:
  push:
    branches:
      - '**'
    paths:
      - apps/web/**
 
jobs:
  translate:
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pull-requests: write
    steps:
      - uses: actions/checkout@v4
      
      - name: NeoIQ Localize Action
        uses: neoiq-inc/localize@v1
        env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          api-key: ${{ secrets.NEOIQ_LOCALIZE_API_KEY }}
          project-id: ${{ secrets.NEOIQ_LOCALIZE_PROJECT_ID }}

This workflow will:

  • Run on pushes to the main branch
  • Run on pull requests to the main branch
  • Can be triggered manually from the Actions tab
  • Checkout your code and run the NeoIQ Localize translation process
  • Create a pull request with any new translations (configurable)

Working Directory Option

The working-directory option allows you to specify where your translation files are located. This is particularly useful in monorepos where your translations may be in a specific package or app directory. For example:

Pull Request Option (coming soon)

The create-pull-request option controls whether the action creates a pull request with the changes or commits them directly to the branch:

.github/workflows/neoiq-localize.yml
with:
  create-pull-request: true # create a pull request with the changes

When set to true, the action will:

  • Create a new branch with the changes
  • Create a pull request for review
  • Add appropriate labels and description

When set to false (default), the action will:

  • Commit the changes directly to the current branch
  • Push the changes without creating a pull request

Using with Vercel

If you're using Vercel for deployments, you can combine this GitHub Action with our Vercel build validation to ensure your translations are always synchronized before deployment. This prevents deployments with missing or outdated translations.

How is this guide?

Edit on GitHub

Last updated on

On this page