Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-i18n-text

Package Overview
Dependencies
Maintainers
4
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-i18n-text

Disallow English text in string literals

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
38K
decreased by-48.36%
Maintainers
4
Weekly downloads
 
Created
Source

eslint-plugin-i18n-text

Disallow English text in string literals.

Embedding messages in JavaScript files prevents them from being translated into other languages. An alternative is to embed the translated text in the markup and find it with JavaScript.

<div class="js-message" data-success-message="It works!"></div>
const el = document.querySelector('.js-message')
el.textContent = el.getAttribute('data-success-message')

This pattern allows the web framework that's generating the markup to use its translation library to insert the appropriate translated text.

Installation

You'll first need to install ESLint:

$ npm install eslint --save-dev

Next, install eslint-plugin-i18n-text:

$ npm install eslint-plugin-i18n-text --save-dev

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-i18n-text globally.

Usage

Add i18n-text to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": [
    "i18n-text"
  ],
  "rules": {
    "i18n-text/no-en": 2
  }
}

Development

npm install
npm test

License

Distributed under the MIT license. See LICENSE for details.

Keywords

FAQs

Package last updated on 16 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc