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

clear-i18n-loader

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clear-i18n-loader

A webpack loader for simple and clear i18n.

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

clear-i18n-loader

A webpack loader for simple and clear i18n.

Basic Usage

npm install --save clear-i18n-loader

Usually, use it as the last loader require("html!clear-i18n!./index.html"). This loader takes one JSON file for each file containing untranslated strings.

In the text files, put "^" around the untranslated strings.

<div>^Please help me translate this!^</div>
var str = '^Please help me translate this!^';

If you need the "^" character itself, write double.

<div>^Ha^^_^^ha!^ <span>^^_^^</span></div>
<!-- This means "Ha^_^ha!" need to be translated, and there is a "^_^" followed in the span. -->

Do not like "^" character? It is configurable! "`" character might look better, but it is used in ECMAScript 2015...

Options

Tips: write options like this: clear-i18n?{"lang":"en","char":"^"}

  • lang the target language. It is required, or translations are silently ignored.
  • localePath where the translation files locate. It is "[path][file].[ext].locale/" by default. The target file is a JSON file named current lang (i.e. "en.json") inside this dir.
  • char the "^" above. ONLY special ASCII characters are allowed!
  • multiline if there are multiline untranslated strings, please set this to true.
  • generateFile generate target translation files, collect and put untranslated strings in. I found this feature quite useful.

License

MIT

FAQs

Package last updated on 16 Mar 2016

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