diff --git a/src/browser/i18n.js b/src/browser/i18n.js index 4bc4f937702..1b808ce33aa 100644 --- a/src/browser/i18n.js +++ b/src/browser/i18n.js @@ -1,23 +1,8 @@ import i18n from 'i18next' +import { i18nResource } from 'neo4j-arc' import { initReactI18next } from 'react-i18next' -const resources = { - en: { - translation: { - 'graph summary': - 'Displaying {{nodeCount}} nodes, {{relationshipCount}} relationships.', - 'Relationship types': 'Relationship types', - 'Node labels': 'Node labels' - } - }, - zh: { - translation: { - 'graph summary': '总计 {{nodeCount}} 个节点, {{relationshipCount}} 条边.', - 'Relationship types': '关系类型', - 'Node labels': '节点类型' - } - } -} +const resources = i18nResource i18n.use(initReactI18next).init({ resources, diff --git a/src/neo4j-arc/i18n.json b/src/neo4j-arc/i18n.json new file mode 100644 index 00000000000..271b07e4e64 --- /dev/null +++ b/src/neo4j-arc/i18n.json @@ -0,0 +1,16 @@ +{ + "en": { + "translation": { + "graph summary": "Displaying {{nodeCount}} nodes, {{relationshipCount}} relationships.", + "Relationship types": "Relationship types", + "Node labels": "Node labels" + } + }, + "zh": { + "translation": { + "graph summary": "总计 {{nodeCount}} 个节点, {{relationshipCount}} 条边。", + "Relationship types": "关系类型", + "Node labels": "节点类型" + } + } +} diff --git a/src/neo4j-arc/index.ts b/src/neo4j-arc/index.ts index d88fe5d48ae..1deb579538f 100644 --- a/src/neo4j-arc/index.ts +++ b/src/neo4j-arc/index.ts @@ -1,3 +1,4 @@ export * from './common' export * from './graph-visualization' export * from './cypher-language-support' +export { default as i18nResource } from './i18n.json' diff --git a/src/neo4j-arc/package.json b/src/neo4j-arc/package.json index 6e6207ed8ee..f15cd8477aa 100644 --- a/src/neo4j-arc/package.json +++ b/src/neo4j-arc/package.json @@ -22,6 +22,7 @@ ], "devDependencies": { "@rollup/plugin-alias": "^3.1.9", + "@rollup/plugin-json": "^6.0.1", "@types/react": "^17.0.40", "esbuild": "^0.14.26", "neo4j-driver-core": "5.9.2", diff --git a/src/neo4j-arc/rollup.config.js b/src/neo4j-arc/rollup.config.js index 7854168b42a..ac8d5233588 100644 --- a/src/neo4j-arc/rollup.config.js +++ b/src/neo4j-arc/rollup.config.js @@ -2,6 +2,7 @@ import dts from 'rollup-plugin-dts' import esbuild from 'rollup-plugin-esbuild' import alias from '@rollup/plugin-alias' import pkg from './package.json' +import json from '@rollup/plugin-json' const importsWithPaths = [ 'monaco-editor/esm/vs/base/parts/quickinput/browser/quickInputList', @@ -24,7 +25,11 @@ export default [ { input: 'index.ts', external: id => dependenciesNotToBundle.includes(id), - plugins: [/* handles ts */ esbuild(), alias({ entries: aliasEntries })], + plugins: [ + /* handles ts */ esbuild(), + alias({ entries: aliasEntries }), + json() + ], output: [ { file: pkg.main, @@ -36,7 +41,7 @@ export default [ // Build types { input: 'index.ts', - plugins: [dts(), alias({ entries: aliasEntries })], + plugins: [dts(), alias({ entries: aliasEntries }), json()], output: { file: pkg.typings, format: 'es' diff --git a/src/neo4j-arc/tsconfig.json b/src/neo4j-arc/tsconfig.json index bd8b7a5acc7..01e0f0792ac 100644 --- a/src/neo4j-arc/tsconfig.json +++ b/src/neo4j-arc/tsconfig.json @@ -6,6 +6,8 @@ "skipLibCheck": true, "allowSyntheticDefaultImports": true, "moduleResolution": "node", + "esModuleInterop": true, + "resolveJsonModule": true, "paths": { "neo4j-arc/common": ["./common/index.ts"] } diff --git a/src/neo4j-arc/yarn.lock b/src/neo4j-arc/yarn.lock index 1bfce1b9032..271ddde7a77 100644 --- a/src/neo4j-arc/yarn.lock +++ b/src/neo4j-arc/yarn.lock @@ -226,6 +226,13 @@ dependencies: slash "^3.0.0" +"@rollup/plugin-json@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-6.0.1.tgz#7e2efcf5ed549963f1444e010611d22f463931c0" + integrity sha512-RgVfl5hWMkxN1h/uZj8FVESvPuBJ/uf6ly6GTj0GONnkfoBN5KC0MSz+PN2OLDgYXMhtG0mWpTrkiOjoxAIevw== + dependencies: + "@rollup/pluginutils" "^5.0.1" + "@rollup/pluginutils@^4.1.1": version "4.2.0" resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-4.2.0.tgz#a14bbd058fdbba0a5647143b16ed0d86fb60bd08" @@ -234,6 +241,15 @@ estree-walker "^2.0.1" picomatch "^2.2.2" +"@rollup/pluginutils@^5.0.1": + version "5.0.5" + resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.0.5.tgz#bbb4c175e19ebfeeb8c132c2eea0ecb89941a66c" + integrity sha512-6aEYR910NyP73oHiJglti74iRyOwgFU4x3meH/H8OJx6Ry0j6cOVZ5X/wTvub7G7Ao6qaHBEaNsV3GLJkSsF+Q== + dependencies: + "@types/estree" "^1.0.0" + estree-walker "^2.0.2" + picomatch "^2.3.1" + "@types/chroma-js@2.1.4": version "2.1.4" resolved "https://registry.yarnpkg.com/@types/chroma-js/-/chroma-js-2.1.4.tgz#52e3a8453000cdb9ad76357c2c47dbed702d136f" @@ -312,6 +328,11 @@ "@types/d3-interpolate" "*" "@types/d3-selection" "*" +"@types/estree@^1.0.0": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" + integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw== + "@types/hoist-non-react-statics@*": version "3.3.1" resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz#1124aafe5118cb591977aeb1ceaaed1070eb039f" @@ -711,7 +732,7 @@ escape-string-regexp@^1.0.5: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= -estree-walker@^2.0.1: +estree-walker@^2.0.1, estree-walker@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== @@ -836,7 +857,7 @@ object-assign@^4.1.1: resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= -picomatch@^2.2.2, picomatch@^2.3.0: +picomatch@^2.2.2, picomatch@^2.3.0, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==