parent
b4bb8f6e49
commit
3550fe0648
|
@ -21,7 +21,6 @@
|
||||||
"@babel/preset-typescript": "^7.1.0",
|
"@babel/preset-typescript": "^7.1.0",
|
||||||
"@kbn/dev-utils": "1.0.0",
|
"@kbn/dev-utils": "1.0.0",
|
||||||
"@types/intl-relativeformat": "^2.1.0",
|
"@types/intl-relativeformat": "^2.1.0",
|
||||||
"@types/json5": "^0.0.30",
|
|
||||||
"@types/react-intl": "^2.3.11",
|
"@types/react-intl": "^2.3.11",
|
||||||
"del": "^3.0.0",
|
"del": "^3.0.0",
|
||||||
"getopts": "^2.2.3",
|
"getopts": "^2.2.3",
|
||||||
|
@ -32,7 +31,6 @@
|
||||||
"intl-format-cache": "^2.1.0",
|
"intl-format-cache": "^2.1.0",
|
||||||
"intl-messageformat": "^2.2.0",
|
"intl-messageformat": "^2.2.0",
|
||||||
"intl-relativeformat": "^2.1.0",
|
"intl-relativeformat": "^2.1.0",
|
||||||
"json5": "^2.0.1",
|
|
||||||
"prop-types": "^15.6.2",
|
"prop-types": "^15.6.2",
|
||||||
"react": "^16.3.0",
|
"react": "^16.3.0",
|
||||||
"react-intl": "^2.7.0"
|
"react-intl": "^2.7.0"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
messages: {
|
"messages": {
|
||||||
test: 'test' // JSON5 test
|
"test": "test"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ describe('I18n loader', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should return translation messages from JSON5 file', async () => {
|
test('should return translation messages from JSON file', async () => {
|
||||||
i18nLoader.registerTranslationFile(
|
i18nLoader.registerTranslationFile(
|
||||||
join(__dirname, './__fixtures__/test_plugin_2/translations/fr.json')
|
join(__dirname, './__fixtures__/test_plugin_2/translations/fr.json')
|
||||||
);
|
);
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { readFile } from 'fs';
|
import { readFile } from 'fs';
|
||||||
import * as JSON5 from 'json5';
|
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import { promisify } from 'util';
|
import { promisify } from 'util';
|
||||||
|
|
||||||
|
@ -65,12 +64,12 @@ function getLocaleFromFileName(fullFileName: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads file and parses it as JSON5
|
* Loads file and parses it as JSON
|
||||||
* @param pathToFile
|
* @param pathToFile
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async function loadFile(pathToFile: string): Promise<Translation> {
|
async function loadFile(pathToFile: string): Promise<Translation> {
|
||||||
return JSON5.parse(await asyncReadFile(pathToFile, 'utf8'));
|
return JSON.parse(await asyncReadFile(pathToFile, 'utf8'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
12
yarn.lock
12
yarn.lock
|
@ -1306,11 +1306,6 @@
|
||||||
resolved "https://registry.yarnpkg.com/@types/json-stable-stringify/-/json-stable-stringify-1.0.32.tgz#121f6917c4389db3923640b2e68de5fa64dda88e"
|
resolved "https://registry.yarnpkg.com/@types/json-stable-stringify/-/json-stable-stringify-1.0.32.tgz#121f6917c4389db3923640b2e68de5fa64dda88e"
|
||||||
integrity sha512-q9Q6+eUEGwQkv4Sbst3J4PNgDOvpuVuKj79Hl/qnmBMEIPzB5QoFRUtjcgcg2xNUZyYUGXBk5wYIBKHt0A+Mxw==
|
integrity sha512-q9Q6+eUEGwQkv4Sbst3J4PNgDOvpuVuKj79Hl/qnmBMEIPzB5QoFRUtjcgcg2xNUZyYUGXBk5wYIBKHt0A+Mxw==
|
||||||
|
|
||||||
"@types/json5@^0.0.30":
|
|
||||||
version "0.0.30"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.30.tgz#44cb52f32a809734ca562e685c6473b5754a7818"
|
|
||||||
integrity sha512-sqm9g7mHlPY/43fcSNrCYfOeX9zkTTK+euO5E6+CVijSMm5tTjkVdwdqRkY3ljjIAf8679vps5jKUoJBCLsMDA==
|
|
||||||
|
|
||||||
"@types/jsonwebtoken@^7.2.7":
|
"@types/jsonwebtoken@^7.2.7":
|
||||||
version "7.2.8"
|
version "7.2.8"
|
||||||
resolved "https://registry.yarnpkg.com/@types/jsonwebtoken/-/jsonwebtoken-7.2.8.tgz#8d199dab4ddb5bba3234f8311b804d2027af2b3a"
|
resolved "https://registry.yarnpkg.com/@types/jsonwebtoken/-/jsonwebtoken-7.2.8.tgz#8d199dab4ddb5bba3234f8311b804d2027af2b3a"
|
||||||
|
@ -12463,13 +12458,6 @@ json5@^1.0.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
minimist "^1.2.0"
|
minimist "^1.2.0"
|
||||||
|
|
||||||
json5@^2.0.1:
|
|
||||||
version "2.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/json5/-/json5-2.0.1.tgz#3d6d0d1066039eb50984e66a7840e4f4b7a2c660"
|
|
||||||
integrity sha512-t6N/86QDIRYvOL259jR5c5TbtMnekl2Ib314mGeMh37zAwjgbWHieqijPH7pWaogmJq1F2I4Sphg19U1s+ZnXQ==
|
|
||||||
dependencies:
|
|
||||||
minimist "^1.2.0"
|
|
||||||
|
|
||||||
jsonfile@^3.0.0:
|
jsonfile@^3.0.0:
|
||||||
version "3.0.1"
|
version "3.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-3.0.1.tgz#a5ecc6f65f53f662c4415c7675a0331d0992ec66"
|
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-3.0.1.tgz#a5ecc6f65f53f662c4415c7675a0331d0992ec66"
|
||||||
|
|
Loading…
Reference in a new issue