Skip to content

matheusjardimb/i18next-resources-validator-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

i18next Resource Validator Action

GitHub Super-Linter CI release npm version

GitHub Action for validating i18next resources. Avoid issues with your translations.

This toll checks for:

  • Missing translations in all supported languages
  • Mal-formed or missing string params (WIP)
  • Sort your strings to reduce conflicts (WIP)

Usage

This tool only takes the path of the folder containing the .json files to be checked as a param.

GitHub actions

Create a file .github/workflows/i18n-validator.yml with:

name: Validate json files containing i18n strings

on: [ push ]

jobs:
  dependency_check_job:
    runs-on: ubuntu-latest
    name: Check for issues at i18n files
    steps:
      - uses: actions/checkout@v4
      - uses: matheusjardimb/i18next-resources-validator@latest
        with:
          # Assuming the .json files are located at '/i18n/' folder in your project 
          resources_path:
            ${{ github.workspace }}/i18n/
          # Optional param for disabling logs 
          quiet: 'false'

Gitlab

Add the following block to your .gitlab-ci.yml file:

validate_dependencies:
  image: node:20.5.0
  script:
    - export INPUT_RESOURCES_PATH="${CI_PROJECT_DIR}/i18n"
    - export INPUT_QUIET='true' # This line is optional
    - npx i18next-resources-validator@latest

NPX

Dependencies checker is also published into npm, so you can run with:

export INPUT_RESOURCES_PATH="${CI_PROJECT_DIR}/i18n"
export INPUT_QUIET='true' # This line is optional
npx i18next-resources-validator@latest

License

See more about the MIT licensing at LICENSE.