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've used 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 case.
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.
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 an "@metadata" object.
- (Note that no parsing is done of the metadata objects.)
- Each defined source message has a matching defined documentation message.
- (Note that 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.