Configures hif-vtk-extention to use ohif-i18n for translation and include load more locations
This commit is contained in:
parent
56b595980e
commit
42cb8e32c7
@ -1,20 +1,20 @@
|
||||
import babel from 'rollup-plugin-babel'
|
||||
import commonjs from 'rollup-plugin-commonjs'
|
||||
import external from 'rollup-plugin-peer-deps-external'
|
||||
import postcss from 'rollup-plugin-postcss'
|
||||
import resolve from 'rollup-plugin-node-resolve'
|
||||
import url from 'rollup-plugin-url'
|
||||
import pkg from './package.json'
|
||||
import babel from 'rollup-plugin-babel';
|
||||
import commonjs from 'rollup-plugin-commonjs';
|
||||
import external from 'rollup-plugin-peer-deps-external';
|
||||
import postcss from 'rollup-plugin-postcss';
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
import url from 'rollup-plugin-url';
|
||||
import pkg from './package.json';
|
||||
// Deal with https://github.com/rollup/rollup-plugin-commonjs/issues/297
|
||||
import builtins from 'rollup-plugin-node-builtins';
|
||||
import copy from 'rollup-plugin-copy'
|
||||
import copy from 'rollup-plugin-copy';
|
||||
|
||||
const globals = {
|
||||
'react': 'React',
|
||||
const globals = {
|
||||
react: 'React',
|
||||
'react-dom': 'ReactDOM',
|
||||
'react-redux': 'ReactRedux',
|
||||
'react-resize-detector': 'ReactResizeDetector',
|
||||
'prop-types': 'PropTypes'
|
||||
'prop-types': 'PropTypes',
|
||||
};
|
||||
|
||||
export default {
|
||||
@ -25,37 +25,35 @@ export default {
|
||||
format: 'umd',
|
||||
name: 'ohif-i18n',
|
||||
sourcemap: true,
|
||||
globals
|
||||
globals,
|
||||
},
|
||||
{
|
||||
file: pkg.module,
|
||||
format: 'es',
|
||||
sourcemap: true,
|
||||
globals
|
||||
}
|
||||
globals,
|
||||
},
|
||||
],
|
||||
plugins: [
|
||||
builtins(),
|
||||
external(),
|
||||
postcss({
|
||||
modules: false
|
||||
modules: false,
|
||||
}),
|
||||
copy({
|
||||
targets: [
|
||||
'src/locales'
|
||||
],
|
||||
outputFolder: 'dist'
|
||||
targets: ['src/locales'],
|
||||
outputFolder: 'dist',
|
||||
}),
|
||||
url(),
|
||||
babel({
|
||||
exclude: 'node_modules/**',
|
||||
externalHelpers: true,
|
||||
runtimeHelpers: true
|
||||
runtimeHelpers: true,
|
||||
}),
|
||||
resolve(),
|
||||
commonjs({
|
||||
include: ['node_modules/**', '.yalc/**']
|
||||
})
|
||||
include: ['node_modules/**', '.yalc/**'],
|
||||
}),
|
||||
],
|
||||
external: Object.keys(pkg.peerDependencies || {}),
|
||||
}
|
||||
};
|
||||
|
||||
@ -50,6 +50,18 @@ function getLocales() {
|
||||
return locales;
|
||||
}
|
||||
|
||||
function addLocales(context) {
|
||||
context.keys().forEach(key => {
|
||||
i18n.addResourceBundle(
|
||||
getCleanKeyForNameSpaces(key),
|
||||
getNameSpaceString(key),
|
||||
context(key),
|
||||
true,
|
||||
true
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
let translate;
|
||||
|
||||
i18n
|
||||
@ -78,5 +90,5 @@ i18n
|
||||
translate = t;
|
||||
});
|
||||
|
||||
export { translate as t, withTranslation, I18nextProvider };
|
||||
export { translate as t, withTranslation, I18nextProvider, addLocales };
|
||||
export default i18n;
|
||||
|
||||
@ -24,16 +24,17 @@
|
||||
"dcmjs": "^0.3.6",
|
||||
"dicom-parser": "^1.8.3",
|
||||
"hammerjs": "^2.0.8",
|
||||
"i18next": "^15.1.3",
|
||||
"ohif-core": "^0.3.3",
|
||||
"ohif-i18n": "file:.yalc/ohif-i18n",
|
||||
"prop-types": "^15.6.2",
|
||||
"react": "^15.0.0 || ^16.0.0",
|
||||
"react-dom": "^15.0.0 || ^16.0.0",
|
||||
"react-i18next": "^10.11.0",
|
||||
"react-redux": "^6.0.0",
|
||||
"react-resize-detector": "^3.4.0",
|
||||
"redux": "^4.0.1",
|
||||
"i18next": "^15.1.3",
|
||||
"react-i18next": "^10.11.0",
|
||||
"react-viewerbase": "^0.6.1"
|
||||
"react-viewerbase": "^0.6.1",
|
||||
"redux": "^4.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.2.2",
|
||||
@ -58,6 +59,7 @@
|
||||
"rollup": "^1.1.2",
|
||||
"rollup-plugin-babel": "^4.2.0",
|
||||
"rollup-plugin-commonjs": "^9.2.0",
|
||||
"rollup-plugin-copy": "^2.0.1",
|
||||
"rollup-plugin-node-builtins": "^2.1.2",
|
||||
"rollup-plugin-node-resolve": "^4.0.0",
|
||||
"rollup-plugin-peer-deps-external": "^2.2.0",
|
||||
@ -90,7 +92,6 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.2.0",
|
||||
"classnames": "^2.2.6",
|
||||
"ohif-vtk-extension": "file:.yalc/ohif-vtk-extension",
|
||||
"react-vtkjs-viewport": "^0.0.7"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,15 +1,16 @@
|
||||
import babel from 'rollup-plugin-babel'
|
||||
import commonjs from 'rollup-plugin-commonjs'
|
||||
import external from 'rollup-plugin-peer-deps-external'
|
||||
import postcss from 'rollup-plugin-postcss'
|
||||
import resolve from 'rollup-plugin-node-resolve'
|
||||
import url from 'rollup-plugin-url'
|
||||
import pkg from './package.json'
|
||||
import babel from 'rollup-plugin-babel';
|
||||
import commonjs from 'rollup-plugin-commonjs';
|
||||
import external from 'rollup-plugin-peer-deps-external';
|
||||
import postcss from 'rollup-plugin-postcss';
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
import url from 'rollup-plugin-url';
|
||||
import copy from 'rollup-plugin-copy';
|
||||
import pkg from './package.json';
|
||||
// Deal with https://github.com/rollup/rollup-plugin-commonjs/issues/297
|
||||
import builtins from 'rollup-plugin-node-builtins';
|
||||
|
||||
const globals = {
|
||||
'react': 'React',
|
||||
const globals = {
|
||||
react: 'React',
|
||||
'react-dom': 'ReactDOM',
|
||||
'react-redux': 'ReactRedux',
|
||||
'react-resize-detector': 'ReactResizeDetector',
|
||||
@ -18,10 +19,10 @@ const globals = {
|
||||
'cornerstone-wado-image-loader': 'cornerstoneWADOImageLoader',
|
||||
'cornerstone-math': 'cornerstoneMath',
|
||||
'cornerstone-tools': 'cornerstoneTools',
|
||||
'dcmjs': 'dcmjs',
|
||||
dcmjs: 'dcmjs',
|
||||
'dicom-parser': 'dicomParser',
|
||||
'ohif-core': 'OHIF',
|
||||
'hammerjs': 'Hammer'
|
||||
hammerjs: 'Hammer'
|
||||
};
|
||||
|
||||
export default {
|
||||
@ -47,6 +48,10 @@ export default {
|
||||
postcss({
|
||||
modules: false
|
||||
}),
|
||||
copy({
|
||||
targets: ['src/locales'],
|
||||
outputFolder: 'dist'
|
||||
}),
|
||||
url(),
|
||||
babel({
|
||||
exclude: 'node_modules/**',
|
||||
@ -57,20 +62,20 @@ export default {
|
||||
commonjs({
|
||||
include: ['node_modules/**', '.yalc/**'],
|
||||
namedExports: {
|
||||
'node_modules/react-vtkjs-viewport/dist/index.js': [
|
||||
'getImageData',
|
||||
'loadImageData',
|
||||
'VTKViewport',
|
||||
'VTKMPRViewport',
|
||||
],
|
||||
'.yalc/react-vtkjs-viewport/dist/index.js': [
|
||||
'getImageData',
|
||||
'loadImageData',
|
||||
'VTKViewport',
|
||||
'VTKMPRViewport',
|
||||
]
|
||||
'node_modules/react-vtkjs-viewport/dist/index.js': [
|
||||
'getImageData',
|
||||
'loadImageData',
|
||||
'VTKViewport',
|
||||
'VTKMPRViewport'
|
||||
],
|
||||
'.yalc/react-vtkjs-viewport/dist/index.js': [
|
||||
'getImageData',
|
||||
'loadImageData',
|
||||
'VTKViewport',
|
||||
'VTKMPRViewport'
|
||||
]
|
||||
}
|
||||
})
|
||||
],
|
||||
external: Object.keys(pkg.peerDependencies || {}),
|
||||
}
|
||||
external: Object.keys(pkg.peerDependencies || {})
|
||||
};
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
import loadLocales from './loadLocales';
|
||||
|
||||
import OHIFVTKExtension from './OHIFVTKExtension.js';
|
||||
|
||||
loadLocales();
|
||||
|
||||
export default OHIFVTKExtension;
|
||||
|
||||
8
extensions/ohif-vtk-extension/src/loadLocales.js
Normal file
8
extensions/ohif-vtk-extension/src/loadLocales.js
Normal file
@ -0,0 +1,8 @@
|
||||
import { addLocales } from 'ohif-i18n';
|
||||
|
||||
function loadLocales() {
|
||||
const context = require.context(`./locales`, true, /\.json$/);
|
||||
addLocales(context);
|
||||
}
|
||||
|
||||
export default loadLocales;
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"Rotate": "Rotate VTK"
|
||||
}
|
||||
@ -2994,7 +2994,7 @@ from2@^2.1.0:
|
||||
inherits "^2.0.1"
|
||||
readable-stream "^2.0.0"
|
||||
|
||||
fs-extra@^7.0.0:
|
||||
fs-extra@^7.0.0, fs-extra@^7.0.1:
|
||||
version "7.0.1"
|
||||
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9"
|
||||
integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==
|
||||
@ -3951,6 +3951,13 @@ is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4:
|
||||
dependencies:
|
||||
isobject "^3.0.1"
|
||||
|
||||
is-plain-object@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-3.0.0.tgz#47bfc5da1b5d50d64110806c199359482e75a928"
|
||||
integrity sha512-tZIpofR+P05k8Aocp7UI/2UTa9lTJSebCXpFFoR9aibpokDj/uXBsJ8luUu0tTVYKkMU6URDUuOfJZ7koewXvg==
|
||||
dependencies:
|
||||
isobject "^4.0.0"
|
||||
|
||||
is-promise@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa"
|
||||
@ -4064,6 +4071,11 @@ isobject@^3.0.0, isobject@^3.0.1:
|
||||
resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
|
||||
integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8=
|
||||
|
||||
isobject@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/isobject/-/isobject-4.0.0.tgz#3f1c9155e73b192022a80819bacd0343711697b0"
|
||||
integrity sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA==
|
||||
|
||||
isstream@~0.1.2:
|
||||
version "0.1.2"
|
||||
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
|
||||
@ -7029,6 +7041,15 @@ rollup-plugin-commonjs@^9.2.0:
|
||||
resolve "^1.8.1"
|
||||
rollup-pluginutils "^2.3.3"
|
||||
|
||||
rollup-plugin-copy@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/rollup-plugin-copy/-/rollup-plugin-copy-2.0.1.tgz#2a45e45be84a0d4054d1774604044e7f7581fdae"
|
||||
integrity sha512-IE+Ob5k1Pi/DLi8SlFcf9jN1m2p0ovIwMuz0GM5NeQeV14puW/bCUpmXlqVtQVy+ErXOhZEeBaqinJ0xnJdxKg==
|
||||
dependencies:
|
||||
chalk "^2.4.2"
|
||||
fs-extra "^7.0.1"
|
||||
is-plain-object "^3.0.0"
|
||||
|
||||
rollup-plugin-node-builtins@^2.1.2:
|
||||
version "2.1.2"
|
||||
resolved "https://registry.yarnpkg.com/rollup-plugin-node-builtins/-/rollup-plugin-node-builtins-2.1.2.tgz#24a1fed4a43257b6b64371d8abc6ce1ab14597e9"
|
||||
|
||||
@ -84,7 +84,7 @@
|
||||
"ohif-dicom-microscopy-extension": "^0.0.5",
|
||||
"ohif-dicom-pdf-extension": "^0.0.6",
|
||||
"ohif-i18n": "file:.yalc/ohif-i18n",
|
||||
"ohif-vtk-extension": "^0.0.1",
|
||||
"ohif-vtk-extension": "file:.yalc/ohif-vtk-extension",
|
||||
"oidc-client": "1.7.x",
|
||||
"prop-types": "^15.6.2",
|
||||
"react-bootstrap-modal": "^4.2.0",
|
||||
@ -95,7 +95,7 @@
|
||||
"react-resize-detector": "^3.4.0",
|
||||
"react-router": "^4.3.1",
|
||||
"react-router-dom": "^4.3.1",
|
||||
"react-viewerbase": "0.4.2",
|
||||
"react-viewerbase": "file:.yalc/react-viewerbase",
|
||||
"react-vtkjs-viewport": "^0.0.7",
|
||||
"redux": "^4.0.1",
|
||||
"redux-oidc": "3.1.x"
|
||||
|
||||
10
yarn.lock
10
yarn.lock
@ -9738,15 +9738,13 @@ ohif-dicom-pdf-extension@^0.0.6:
|
||||
lodash.isequal "^4.5.0"
|
||||
|
||||
"ohif-i18n@file:.yalc/ohif-i18n":
|
||||
version "0.0.1-b9613c88"
|
||||
version "0.0.1-57e63603"
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.2.0"
|
||||
classnames "^2.2.6"
|
||||
|
||||
ohif-vtk-extension@^0.0.1:
|
||||
version "0.0.1"
|
||||
resolved "https://registry.yarnpkg.com/ohif-vtk-extension/-/ohif-vtk-extension-0.0.1.tgz#aec448c1d0a905d162154c65982227b3503f5f15"
|
||||
integrity sha512-JfLh0AyEc2hOstpiXj9wMwvuYIQathOmsbb49SZFTw9Y9jMjgdxzdTJaiGtERsVT/92I9u42YrMYk6w5TQCT6A==
|
||||
"ohif-vtk-extension@file:.yalc/ohif-vtk-extension":
|
||||
version "0.0.1-cbcfa41e"
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.2.0"
|
||||
classnames "^2.2.6"
|
||||
@ -11789,7 +11787,7 @@ react-transition-group@^2.0.0, react-transition-group@^2.2.0:
|
||||
react-lifecycles-compat "^3.0.4"
|
||||
|
||||
"react-viewerbase@file:.yalc/react-viewerbase":
|
||||
version "0.2.17-3da063a9"
|
||||
version "0.2.17-f0fa6ce6"
|
||||
dependencies:
|
||||
"@babel/runtime" "7.2.0"
|
||||
classnames "2.2.6"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user