Creating a Linter for Multi-Language Support Files in Chrome Extension Development

Introduction

I recently added multi-language support to my personal Chrome extension called TabTabTab. In Chrome extensions, when adding multi-language support, you define the corresponding words for each language in the messages.json file. However, as the number of words grows, it becomes prone to mistakes such as missing translations for certain languages.

To alleviate these issues related to multi-language support in Chrome extensions, I created a linter called chromex-locale-lint.

Usage

First, install chromex-locale-lint via npm or yarn:

npm install --save-dev chromex-locale-lint

yarn add --dev chromex-locale-lint

To run the linter, execute the following command:

npx chromex-locale-lint --localesDir /path/to/locales --baseLang en

The available arguments are as follows (both are optional):

Features

The main features of the current version (v0.0.2) are as follows:

Conclusion

If you’re working on Chrome extension development and implementing multi-language support or planning to do so, consider using chromex-locale-lint. While the current version only implements the necessary features for my own use, I welcome feature requests and bug reports on GitHub.

Repository: https://github.com/okaryo/chromex-locale-lint

Related Posts