|
11 | 11 | * - `true`: use the `"english"` dictionary
|
12 | 12 | * - `Object`:
|
13 | 13 | * - `dictionaries`: (default `["english"]`) array of dictionary names including
|
14 |
| - * `"english"`, `"american"`, `"british"` and `"canadian"` |
| 14 | + * `"english"`, `"english/american"`, `"english/british"` and `"english/canadian"` |
15 | 15 | * - `allowWords`: additional words allowed anywhere
|
16 | 16 | * - `allowWordsInIdentifiers`: additional words allowed only in identifiers
|
17 | 17 | * - `allowWordsInProperties`: additional words allowed only in properties
|
|
26 | 26 | * "requireDictionaryWords": true
|
27 | 27 | *
|
28 | 28 | * "requireDictionaryWords": {
|
29 |
| - * "dictionaries": [ "english", "american" ], |
| 29 | + * "dictionaries": [ "english", "english/american" ], |
30 | 30 | * "allowWords": [ "transclude" ],
|
31 | 31 | * "allowWordsInProperties": [ "chmod" ],
|
32 | 32 | * "allowNamesAsIdentifiers": [ "$stateParams", "util" ],
|
|
53 | 53 | * fileDir = 4;
|
54 | 54 | * ```
|
55 | 55 | *
|
56 |
| - * ##### Valid for mode `"dictionaries": [ "american" ]`, invalid for `"british"` |
| 56 | + * ##### Valid for mode `"dictionaries": [ "english/american" ]`, invalid for `"english/british"` |
57 | 57 | *
|
58 | 58 | * ```js
|
59 | 59 | * var color = 'papayawhip';
|
60 | 60 | * ```
|
61 | 61 | *
|
62 |
| - * ##### Valid for mode `"dictionaries": [ "british" ]`, invalid for `"american"` |
| 62 | + * ##### Valid for mode `"dictionaries": [ "english/british" ]`, invalid for `"english/american"` |
63 | 63 | *
|
64 | 64 | * ```js
|
65 | 65 | * var colour = 'papayawhip';
|
@@ -149,13 +149,6 @@ var assert = require('assert');
|
149 | 149 | var assign = require('lodash.assign');
|
150 | 150 | var indexOf = require('lodash.indexof');
|
151 | 151 |
|
152 |
| -var wordlistMap = { |
153 |
| - english: 'wordlist-english', |
154 |
| - american: 'wordlist-english', |
155 |
| - british: 'wordlist-english', |
156 |
| - canadian: 'wordlist-english', |
157 |
| -}; |
158 |
| - |
159 | 152 | // Breaks names like "fooBar" into ["foo", "bar"], etc.
|
160 | 153 | var reWords = (function() {
|
161 | 154 | var upper = '[A-Z\\xc0-\\xd6\\xd8-\\xde]';
|
@@ -267,12 +260,12 @@ module.exports.prototype = {
|
267 | 260 | }
|
268 | 261 |
|
269 | 262 | this._wordDictionaries = wordDictionaries.map(function(language) {
|
270 |
| - var packageName = wordlistMap.hasOwnProperty(language) ? |
271 |
| - // Special case where one package holds many wordlists. |
272 |
| - wordlistMap[language] : |
273 |
| - // General case where a package is one-to-one with a |
274 |
| - // wordlist. |
275 |
| - 'wordlist-' + language; |
| 263 | + // Languages such as "wordlist-english" contain both "english" and |
| 264 | + // "english/american" languages. |
| 265 | + var firstPartMatch = language.match(/(.*?)\//); |
| 266 | + var packageName = firstPartMatch === null ? |
| 267 | + 'wordlist-' + language : |
| 268 | + 'wordlist-' + firstPartMatch[1]; |
276 | 269 | var wordlist;
|
277 | 270 | try {
|
278 | 271 | wordlist = require(packageName);
|
|
0 commit comments