Giter VIP home page Giter VIP logo

checklocales's Introduction

checkLocales

A Utility to check the validity of locale JSON files.

checkLocales validates that HTML tags and tokens {key} are not translated in a non-English locale file.

Install

npm install --save-dev https://github.com/intervalia/checklocales.git

Use

checkLocales -r

Local File Format

All locale files are JSON files and their names include the locale that it supports. All locale file names must match (except for the locale). For example:

strings_en.json would be a locale file for the en locale and strings_fr.json would be for fr.

The string files are a flat JSON file that uses Key/Value pairs.

strings_en.json Example:

{
  "BUTTON_CANCEL": "Cancel",
  "BUTTON_HTML": "<button class=\"my-button\">Buy a kite</button>"
  "BUTTON_OK": "OK",
  "LABEL_HIDE_DETAILS": "Hide Details",
  "LABEL_IMAGE_X_OF_Y": "Image %{number} of %{count}",
  "LABEL_SHOW_DETAILS": "Show Details"
}

CLI Options

Here is the list of available command-line options for checkLocales.

Options Description
-b Make backup files. This does nothing id -d is not also set.
-d Delete strings that are no longer found in the default file.
-l:<locale> Set the default locale. For example: -l:fr sets the default locale to 'fr' (French).
-r Recursively scan sub-folders.
-? Output the help content.

Releases

Version Date Description
1.1.0 16-Apr-2018 * Added support to allow user to set the default locale (-l:<locale>)
* Changed missing keys from ERROR to WARN.
* Added ERROR:, WARN: and INFO: to clarify the output messages.
* Removed unused console.log code.
* Added options section and updated README.
1.0.0 06-Apr-2018 Initial Release

checklocales's People

Contributors

intervalia avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.