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

grunt-banana-checker

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-banana-checker

A grunt checker for the "banana" JSON i18n system provided by MediaWiki and jquery.i18n

  • 0.4.0
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

NPM version Build Status

grunt-banana-checker

Task for checking JSON files for the "Banana" i18n system provided by MediaWiki and jquery.i18n.

Getting started

If this is the first time you're using Grunt, the getting started guide will show you how to get up and running.

Once you have that installed, with a Gruntfile set for your code, you can install the plugin with:

npm install grunt-banana-checker --save-dev

In your Gruntfile, add the line:

grunt.loadNpmTasks( 'grunt-banana-checker' );

Running and configuring

Run this task with the grunt banana command.

This is designed to be very simple and not need configuring for the most common cases.

You can specify the targets and options for the task using the normal Grunt configuration – see Grunt's guide on how to configure tasks in general.

Options

For edge cases, you can set some path options:

sourceFile

Type: string Default value: "en.json"

The JSON file providing the primary messages.

documentationFile

Type: string Default value: "qqq.json"

The JSON file providing the documentation messages.

requireMetadata

Type: boolean Default value: true

Whether to fail if message files don't have a @metadata meta-data key.

requireCompleteMessageDocumentation

Type: boolean Default value: true

Whether to fail if any message is in the primary file but not documented.

disallowEmptyDocumentation

Type: boolean Default value: true

Whether to fail if any message is in the primary file but documented as a blank string.

disallowUnusedDocumentation

Type: boolean Default value: true

Whether to fail if any documented message isn't in the primary file.

disallowBlankTranslations

Type: boolean Default value: true

Whether to fail if any message is translated as a blank string.

disallowDuplicateTranslations

Type: boolean Default value: false

Whether to fail if any message is translated as identical to the original string.

disallowUnusedTranslations

Type: boolean Default value: false

Whether to fail if any translated message isn't in the primary file.

requireCompleteTranslationLanguages

Type: string[] Default value: [] Example value: [ 'fr', 'es' ]

Languages on which to fail if any message in the primary file is missing.

requireCompleteTranslationMessages

Type: string[] Default value: [] Example value: [ 'first-message-key', 'third-message-key' ]

Messages on which to fail if missing in any provided language.

Example uses

OOjs UI uses this on a single directory of messages:

banana: {
    all: 'i18n/'
}

VisualEditor's MediaWiki extension uses this on two directories as a single test:

banana: {
    all: 'modules/ve-{mw,wmf}/i18n/'
}

MediaWiki uses this on two directories as different tests – one for the main software and another for the installer:

banana: {
    core: 'languages/i18n/',
    installer: 'includes/installer/i18n/'
}

Checks run

  • The source and documentation files both exist, and are both valid JSON.
  • Both source and documentation include a "@metadata" object.
    • (Note no parsing is done of the metadata objects.)
  • Each defined source message has a matching defined documentation message.
    • (Note no parsing is done of the message definitions or their documentation, including if they are simply the blank string "".)
  • Each defined documentation message has a matching defined source message.

Keywords

FAQs

Package last updated on 06 Oct 2015

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