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.
To use the Languine GitHub Action in your repository, you'll need to:
Add the following secrets in your repository settings (Settings > Secrets and variables > Actions):
LANGUINE_API_KEY
: Your Languine API keyLANGUINE_PROJECT_ID
: Your Languine project IDYou can find these values in your Languine dashboard under Project Settings.
The GitHub Action uses the following environment variables:
LANGUINE_API_KEY
(Required): Your Languine API key for authenticationLANGUINE_PROJECT_ID
(Required): Your Languine project IDGITHUB_TOKEN
(Required): Automatically provided by GitHub, used for creating PRsCreate a new file .github/workflows/languine.yml in your repository with the following content:
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: Languine Action uses: languine-ai/languine@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: api-key: ${{ secrets.LANGUINE_API_KEY }} project-id: ${{ secrets.LANGUINE_PROJECT_ID }}
This workflow will:
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:
The create-pull-request
option controls whether the action creates a pull request with the changes or commits them directly to the branch:
with: create-pull-request: true # create a pull request with the changes
When set to true
, the action will:
When set to false
(default), the action will:
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.