translate-lint
v1.10.1
Published
Simple tools for checking translate keys in the whole app that uses regexp. Support for popular libraries and frameworks
Maintainers
Readme
translate-lint
Simple tools for checking translate keys in the whole app that uses regexp. Support for popular libraries and frameworks
for
desktopusengx-translate-editor
Table of Contents
Background
There are a lot of translation keys in the whole app. This repository contains a proposal to check all translation keys in the whole app which should exist in all languages files.
Support
| Library | Preset | Framework |
|------------------------------------------------------------------|-------------------------|-----------|
| ngx-translate | angular-ngx-translate | Angular |
| transloco | transloco | Angular |
| react-i18next | react-i18next | React |
| react-intl | react-intl | React |
| lingui | lingui-js | React |
| next-intl | next-intl | Next.js |
| next-i18next | next-i18next | Next.js |
| vue-i18n | vue-i18n | Vue |
| i18next-vue | i18next-vue | Vue |
| fluent-vue | fluent-vue | Vue |
| @nuxtjs/i18n | nuxtjs-i18n | Nuxt.js |
| svelte-i18n | svelte-i18n | Svelte |
| next-translate | next-translate | Next.js |
| remix-i18next | remix-i18next | Remix |
| sveltekit-i18n | sveltekit-i18n | SvelteKit |
| solid-i18n | solid-i18n | Solid.js |
| qwik-speak | qwik-speak | Qwik |
| i18next | i18next | Universal |
| i18n | i18n-node | Node.js |
| lit-translate | lit-translate | Lit |
Installation
NPM
npm install translate-lint -gUsage
CLI
Run translate-lint against your project and language files:
translate-lint -p './src/app/**/*.{html,ts,resx}' -l './src/assets/i18n/*.{json,yaml,yml}' -f angular-ngx-translateNOTE: For
projectandlanguagesoptions need to include file types like on the example.
Init
Run the interactive config generator to create a translate-lint.config.json (or .js) file in the current directory:
translate-lint --initAfter generation, pass the file to the linter via --config:
translate-lint --config ./translate-lint.config.jsonTypeScript
translate-lint can also be used programmatically — the TranslateLint class, all rule config interfaces, and the framework preset registry are exported from the package. See docs/rules/README.md for a full, up-to-date example.
Rules
translate-lint ships with the following rules. See docs/rules/README.md for how each one works, its config options, CLI flags, and example error messages:
- keysOnViews
- zombieKeys
- emptyKeys
- misprintKeys
- deepSearch
- keyNamingConvention
- missingTranslations
- duplicateKeys
- namespaceKeys
- maxKeyDepth
- coverage
- duplicateValues
- untranslatedValues
- caseSensitiveKeyCollision
- sortKeys
- variableConsistency
- maxValueLength
- noHtmlInValues
- htmlTagConsistency
- brokenEncoding
- valueEqualsKeyName
- localeFileNamingConvention
- duplicateLocaleFile
- emptyLocaleFile
Contribute
You may contribute in several ways like requesting new features, adding tests, fixing bugs, improving documentation or examples. Please check our contributing guidelines.
Used By
Here can be your extensions:
- ngx-translate-editor - Simple GUI for CRUD translate keys of ngx-translate, which included ngx-translate-lint
- 121 Platform - 121 is an open source platform for Cash based Aid built with Digital Identity & Local/Global Financial service partners.
