{"id":15283709,"url":"https://github.com/wikimedia/banana-checker","last_synced_at":"2025-10-07T00:31:27.734Z","repository":{"id":15714519,"uuid":"18452566","full_name":"wikimedia/banana-checker","owner":"wikimedia","description":"Development has moved to Wikimedia GitLab","archived":true,"fork":false,"pushed_at":"2022-12-06T19:14:34.000Z","size":391,"stargazers_count":8,"open_issues_count":6,"forks_count":4,"subscribers_count":25,"default_branch":"master","last_synced_at":"2024-10-01T14:44:59.341Z","etag":null,"topics":["grunt","grunt-plugins","i18n"],"latest_commit_sha":null,"homepage":"https://gitlab.wikimedia.org/repos/ci-tools/banana-checker/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wikimedia.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-04T20:59:37.000Z","updated_at":"2023-05-20T11:06:23.000Z","dependencies_parsed_at":"2023-01-13T18:33:11.116Z","dependency_job_id":null,"html_url":"https://github.com/wikimedia/banana-checker","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wikimedia%2Fbanana-checker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wikimedia%2Fbanana-checker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wikimedia%2Fbanana-checker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wikimedia%2Fbanana-checker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wikimedia","download_url":"https://codeload.github.com/wikimedia/banana-checker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235569500,"owners_count":19011184,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["grunt","grunt-plugins","i18n"],"created_at":"2024-09-30T14:45:01.586Z","updated_at":"2025-10-07T00:31:22.376Z","avatar_url":"https://github.com/wikimedia.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NPM version](https://badge.fury.io/js/grunt-banana-checker.svg)](http://badge.fury.io/js/grunt-banana-checker) [![Build Status](https://travis-ci.org/wikimedia/banana-checker.svg?branch=master)](https://travis-ci.org/wikimedia/banana-checker)\n\n# banana-checker\n\n\u003e Checker for the 'Banana' JSON-file format for interface messages, as used by MediaWiki and jQuery.i18n.\n\nBy default, Banana checker asserts the following:\n\n* The source and documentation files must exist and contain valid JSON.\n* Both files include a `@metadata` object.\n* Each defined source message is documentated.\n* Each defined documentation entry has a matching source message.\n\nFor all available options, see the [**Options** section](#options).\n\nYou can use Banana checker [standalone](#command-line-interface), or as [Grunt plugin](#getting-started-grunt-plugin).\n\n## Getting started (Grunt plugin)\n\nTo use this plugin, add it as a development dependency to your project:\n\n\u003cpre lang=shell\u003e\nnpm install grunt-banana-checker --save-dev\n\u003c/pre\u003e\n\nEnsure your project has a Gruntfile.js file ([example file](http://gruntjs.com/sample-gruntfile)). Then, in Gruntfile.js, add the line:\n\n\u003cpre lang=js\u003e\ngrunt.loadNpmTasks( 'grunt-banana-checker' );\n\u003c/pre\u003e\n\n### Configure the Grunt plugin\n\nIn Gruntfile.js, add a configuation key for `banana` and set it to an empty object.\n\nWe will use this object to declare which directory contains the interface messages. For example, to enable grunt-banana-checker for a single directory only, configure it like so:\n\n\u003cpre lang=js\u003e\ngrunt.initConfig( {\n\tbanana: {\n\t    all: 'i18n/'\n\t}\n} );\n\u003c/pre\u003e\n\nYou can also configure multiple directories, like so:\n\n\u003cpre lang=js\u003e\ngrunt.initConfig( {\n\tbanana: {\n\t    core: 'languages/i18n/',\n\t    installer: 'includes/installer/i18n/'\n\t}\n} );\n\u003c/pre\u003e\n\nYou can also use globbing patterns and/or arrays of directories, like so:\n\n\u003cpre lang=js\u003e\ngrunt.initConfig( {\n\tbanana: {\n\t    all: 'modules/ve-{mw,wmf}/i18n/'\n\t}\n} );\n\u003c/pre\u003e\n\nFor a full list of supported ways of defining the target directory of a Grunt plugin, see [Configuring tasks](https://gruntjs.com/configuring-tasks) on gruntjs.com.\n\nTo customise [the **options** for Banana checker](#Options), define your target directory as an object instead of a string, with `src` and `options` properties, like so:\n\n\u003cpre lang=js\u003e\ngrunt.initConfig( {\n\tbanana: {\n\t\tall: {\n\t\t\tsrc: 'i18n/',\n\t\t\toptions: {\n\t\t\t\tsourceFile: 'messages.json',\n\t\t\t\tdocumentationFile: 'documentation.json'\n\t\t\t}\n\t\t}\n\t}\n} );\n\u003c/pre\u003e\n\nFor all available options, see the [**Options** section](#Options).\n\n## Command-line\n\nThe Banana checker also offers a command-line interface.\n\n\u003cpre lang=shell\u003e\nnpm install grunt-banana-checker --save-dev\n\u003c/pre\u003e\n\nTo use Banana checker as part of your test run, refer to the `banana-checker`\nprogram from the `scripts.test` property in your `package.json` file.\n\n\u003cpre lang=js\u003e\n{\n\t\"scripts\": {\n\t\t\"test\": \"banana-checker i18n/\"\n\t}\n}\n\u003c/pre\u003e\n\nTo set custom options, pass parameters as `--key=value` pairs. For example:\n\n\u003cpre lang=shell\u003e\nnpx banana-checker --requireKeyPrefix=\"x-\" i18n/\n\u003c/pre\u003e\n\n* For boolean options, use the valus `0`, `1`, `true`, or `false`.\n* Quotes are allowed, but not required.\n* For options that allow multiple values, separate values by comma. Like `--key=one,two`.\n\n## Options\n\nFor edge cases, you can set some path options:\n\n#### sourceFile\nType: `string`\nDefault value: `\"en.json\"`\n\nThe JSON file providing the primary messages.\n\n#### documentationFile\nType: `string`\nDefault value: `\"qqq.json\"`\n\nThe JSON file providing the documentation messages.\n\n#### requireMetadata\nType: `boolean`\nDefault value: `true`\n\nWhether to fail if message files don't have a `@metadata` meta-data key.\n\n#### requireCompleteMessageDocumentation\nType: `boolean`\nDefault value: `true`\n\nWhether to fail if any message is in the primary file but not documented.\n\n#### disallowEmptyDocumentation\nType: `boolean`\nDefault value: `true`\n\nWhether to fail if any message is in the primary file but documented as a blank string.\n\n#### requireLowerCase\nType: `boolean` or `\"initial\"`\nDefault value: `true`\n\nWhether to fail if any message key is not lower case. If set to `\"initial\"`, fail only if the first\ncharacter is not lower case.\n\n#### requireKeyPrefix\nType: `string` or `string[]`\nDefault value: `[]`\n\nWhether to fail if any message key is not prefixed by the given prefix, or if multiple, one of the\ngiven prefices.\n\n#### disallowUnusedDocumentation\nType: `boolean`\nDefault value: `true`\n\nWhether to fail if any documented message isn't in the primary file.\n\n#### disallowBlankTranslations\nType: `boolean`\nDefault value: `true`\n\nWhether to fail if any message is translated as a blank string.\n\n#### disallowDuplicateTranslations\nType: `boolean`\nDefault value: `false`\n\nWhether to fail if any message is translated as identical to the original string.\n\n#### disallowUnusedTranslations\nType: `boolean`\nDefault value: `false`\n\nWhether to fail if any translated message isn't in the primary file.\n\n#### requireCompletelyUsedParameters\nType: `boolean`\nDefault value: `false`\n\nWhether to fail if any translated message fails to use a parameter used in the primary message.\n\n#### requireCompleteTranslationLanguages\nType: `string[]`\nDefault value: `[]`\nExample value: `[ 'fr', 'es' ]`\n\nLanguages on which to fail if any message in the primary file is missing.\n\n#### requireCompleteTranslationMessages\nType: `string[]`\nDefault value: `[]`\nExample value: `[ 'first-message-key', 'third-message-key' ]`\n\nMessages on which to fail if missing in any provided language.\n\n### ignoreMissingBlankTranslations\nType: `boolean`\nDefault value: `true`\n\nWhether to ignore missing translations whose original string is blank.\n\n### allowLeadingWhitespace\nType: `boolean`\nDefault value: `true`\n\nWhether to ignore leading whitespace in original or translated messages.\n\n### allowTrailingWhitespace\nType: `boolean`\nDefault value: `true`\n\nWhether to ignore trailing whitespace in original or translated messages.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwikimedia%2Fbanana-checker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwikimedia%2Fbanana-checker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwikimedia%2Fbanana-checker/lists"}