Merge branch 'master' into feature/extensions-panels-and-docs

This commit is contained in:
Danny Brown authored and GitHub committed 2019-06-14 20:45:00 -04:00
commit df2a984cd3
39 files changed
+6178 -37

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
{
"presets": [
["@babel/preset-env", {
"targets": {
"ie": "11"
}
}],
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-runtime"
]
}
+9
View File
@@ -0,0 +1,9 @@
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
+26
View File
@@ -0,0 +1,26 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
node_modules
# builds
build
dist
.rpt2_cache
# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.idea
yalc.lock
.yalc
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 Open Health Imaging Foundation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+86
View File
@@ -0,0 +1,86 @@
{
"name": "@ohif/i18n",
"version": "0.0.4",
"description": "OHIF extension for internationalization",
"author": "OHIF",
"license": "MIT",
"repository": "OHIF/Viewers",
"main": "dist/index.umd.js",
"module": "dist/index.es.js",
"jsnext:main": "dist/index.es.js",
"engines": {
"node": ">=8",
"npm": ">=5"
},
"scripts": {
"build": "rollup -c",
"prepublishOnly": "npm run build"
},
"peerDependencies": {
"i18next": "^17.0.3",
"i18next-browser-languagedetector": "^3.0.1",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-i18next": "^10.11.0"
},
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/plugin-external-helpers": "^7.2.0",
"@babel/plugin-proposal-class-properties": "^7.2.3",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.2.3",
"@babel/preset-react": "^7.0.0",
"babel-eslint": "^10.0.1",
"cross-env": "^5.2.0",
"eslint": "5.13.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-react": "^7.11.1",
"husky": "^1.3.1",
"i18next": "^15.1.3",
"i18next-browser-languagedetector": "^3.0.1",
"lint-staged": "^8.1.0",
"prettier": "^1.15.3",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-i18next": "^10.11.0",
"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",
"rollup-plugin-postcss": "^2.0.3",
"rollup-plugin-url": "^2.1.0"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*.{js,jsx,json,css}": [
"prettier --single-quote --write",
"git add"
]
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"dependencies": {
"@babel/runtime": "^7.2.0",
"classnames": "^2.2.6",
"rollup-plugin-json": "^4.0.0"
}
}
+72
View File
@@ -0,0 +1,72 @@
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 json from 'rollup-plugin-json';
const globals = {
react: 'React',
'react-dom': 'ReactDOM',
'react-redux': 'ReactRedux',
'react-resize-detector': 'ReactResizeDetector',
'prop-types': 'PropTypes',
'i18next': 'i18next',
'react-i18next': 'react-i18next',
'i18next-browser-languagedetector': 'LngDetector'
};
export default {
input: 'src/index.js',
output: [
{
file: pkg.main,
format: 'umd',
name: 'ohif-i18n',
sourcemap: true,
globals,
exports: 'named',
},
{
file: pkg.module,
format: 'es',
sourcemap: true,
globals,
exports: 'named',
},
],
plugins: [
builtins(),
external(),
postcss({
modules: false,
}),
copy({
targets: ['src/locales'],
outputFolder: 'dist',
}),
json({
// ignores indent and generates the smallest code
compact: true, // Default: false
// generate a named export for every property of the JSON object
namedExports: true // Default: true
}),
url(),
babel({
exclude: 'node_modules/**',
externalHelpers: true,
runtimeHelpers: true,
}),
resolve(),
commonjs({
include: ['node_modules/**', '.yalc/**'],
}),
],
external: Object.keys(pkg.peerDependencies || {})
};
+24
View File
@@ -0,0 +1,24 @@
const debugMode = !!(
process.env.NODE_ENV !== 'production' && process.env.REACT_APP_I18N_DEBUG
);
const detectionOptions = {
// order and from where user language should be detected
order: ['querystring', 'cookie', 'localStorage', 'navigator', 'htmlTag', 'path', 'subdomain'],
// keys or params to lookup language from
lookupQuerystring: 'lng',
lookupCookie: 'i18next',
lookupLocalStorage: 'i18nextLng',
lookupFromPathIndex: 0,
lookupFromSubdomainIndex: 0,
// cache user language on
caches: ['localStorage', 'cookie'],
excludeCacheFor: ['cimode'], // languages to not persist (cookie, localStorage)
// optional htmlTag with lang attribute, the default is:
htmlTag: document.documentElement
};
export { debugMode, detectionOptions };
+8
View File
@@ -0,0 +1,8 @@
import { debugMode } from './config';
export default (message, level = 'log') => {
if (debugMode) {
// eslint-disable-next-line
console[level]('@ohif/i18n: ', message);
}
};
+97
View File
@@ -0,0 +1,97 @@
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import LngDetector from 'i18next-browser-languagedetector';
import customDebug from './debugger';
import pkg from '../package.json';
import { debugMode, detectionOptions } from './config';
let translate;
function getNameSpaceString(key) {
const nameSpaceMatcher = key.match(/[^/]+$/g);
let finalNameSpace;
if (nameSpaceMatcher !== null) {
finalNameSpace = nameSpaceMatcher[0].replace('.json', '');
}
return finalNameSpace;
}
function getKeyForNameSpaces(key) {
const cleanedKey = key.match(/[/\\].+(?=[/\\])/);
let finalKey;
if (cleanedKey !== null) {
finalKey = cleanedKey[0].replace(/[/\\]/, '');
finalKey = finalKey.replace(/[/\\]/, '-');
}
return finalKey;
}
function getLocales() {
var isTestEnvironment = process.env.NODE_ENV === 'test';
// require.context is exclusive from webpack. This conditional is needed to escape while running tests
if (isTestEnvironment) {
return {};
}
const context = require.context(`./locales`, true, /\.json$/);
const locales = {};
context.keys().forEach(key => {
locales[getKeyForNameSpaces(key)] = {
...locales[getKeyForNameSpaces(key)],
[getNameSpaceString(key)]: context(key),
};
});
return locales;
}
function addLocales(context) {
context.keys().forEach(key => {
i18n.addResourceBundle(
getKeyForNameSpaces(key),
getNameSpaceString(key),
context(key),
true,
true
);
});
customDebug(`Locales added successfully`, 'info');
}
function initI18n(detection = detectionOptions) {
i18n
.use(LngDetector)
.use(initReactI18next)
.init({
resources: getLocales(),
debug: debugMode,
keySeparator: false,
interpolation: {
escapeValue: false,
},
detection,
fallbackNS: ['Common'],
defaultNS: 'Common',
react: {
wait: true,
},
})
.then(function(t) {
translate = t;
customDebug(`t function available.`, 'info');
});
}
customDebug(`version ${pkg.version} loaded.`, 'info');
initI18n();
export { translate as t, addLocales, initI18n };
export default i18n;
@@ -0,0 +1,43 @@
{
"Themes": "Themes",
"Previous": "$t(Common:Previous)",
"Next": "$t(Common:Next)",
"Play": "$t(Common:Play)",
"Stop": "$t(Common:Stop)",
"Layout": "$t(Common:Layout)",
"More": "$t(Common:More)",
"Crosshairs": "Crosshairs",
"Magnify": "Magnify",
"ROI Window": "ROI Window",
"Probe": "Probe",
"Ellipse": "Ellipse",
"Rectangle": "Rectangle",
"Invert": "Invert",
"Rotate Right": "Rotate Right",
"Flip H": "Flip H",
"Flip V": "Flip V",
"Clear": "Clear",
"Brush": "Brush",
"Coronal": "Coronal",
"Stack Scroll": "Stack Scroll",
"Measurements": "Measurements",
"Zoom": "Zoom",
"Levels": "Levels",
"Pan": "Pan",
"Length": "Length",
"Angle": "Angle",
"Bidirectional": "Bidirectional",
"Freehand": "Freehand",
"Elliptical": "Elliptical",
"Circle": "Circle",
"Rectangle": "Rectangle",
"Reset": "$t(Common:Reset)",
"CINE": "CINE",
"Acquired": "Acquired",
"Sagittal": "Sagittal",
"Axial": "Axial",
"Manual": "Manual",
"Save": "Save",
"Reset to Defaults": "$t(Common:Reset) to Defaults",
"Cancel": "Cancel"
}
@@ -0,0 +1,8 @@
{
"fps": "fps",
"Skip to first image": "Skip to first $t(Common:Image)",
"Previous image": "$t(Common:Previous) $t(Common:Image)",
"Play / Stop": "$t(Common:Play) / $t(Common:Stop)",
"Next image": "$t(Common:Play) $t(Common:Image)",
"Skip to last image": "Skip, to last $t(Common:Image)"
}
+10
View File
@@ -0,0 +1,10 @@
{
"Reset": "Reset",
"Previous": "Previous",
"Next": "Next",
"Play": "Play",
"Stop": "Stop",
"Layout": "Layout",
"More": "More",
"Image": "Image"
}
@@ -0,0 +1,8 @@
{
"INVESTIGATIONAL USE ONLY": "INVESTIGATIONAL USE ONLY",
"Options": "Options",
"About": "About",
"Preferences": "Preferences",
"Study list": "Study list",
"Back to Viewer": "Back to Viewer"
}
@@ -0,0 +1,9 @@
{
"Criteria nonconformities": "Criteria nonconformities",
"Relabel": "Relabel",
"Description": "Description",
"Delete": "Delete",
"Targets": "Targets",
"NonTargets": "NonTargets",
"MAX": "MAX"
}
@@ -0,0 +1,3 @@
{
"About": "Info"
}
@@ -0,0 +1,3 @@
{
"About": "About"
}
@@ -0,0 +1,6 @@
{
"User Preferences": "User Preferences",
"Save": "$t(Buttons:Save)",
"Reset to Defaults": "$t(Buttons:Reset to Defaults)",
"Cancel": "$t(Buttons:Cancel)"
}
@@ -0,0 +1,3 @@
{
"INVESTIGATIONAL USE ONLY": "SOLO USO DE DESAROLLO"
}
@@ -0,0 +1,42 @@
{
"Themes": "Temas",
"Previous": "$t(Common:Previous)",
"Next": "$t(Common:Next)",
"Play": "$t(Common:Play)",
"Stop": "$t(Common:Stop)",
"Layout": "$t(Common:Layout)",
"More": "$t(Common:More)",
"Crosshairs": "Cruces",
"Magnify": "Lupa",
"ROI Window": "Ventana ROI",
"Probe": "Probar",
"Ellipse": "Elipse",
"Rectangle": "Rectángulo",
"Invert": "Invertido",
"Rotate Right": "Rotar ->",
"Flip H": "Espejo Hor.",
"Flip V": "Espejo Ver.",
"Clear": "Limpiar",
"Brush": "Escoba",
"Coronal": "Coronal",
"Stack Scroll": "Avance X slice",
"Measurements": "Medidas",
"Zoom": "Zoom",
"Levels": "Niveles",
"Pan": "Mover",
"Length": "Medición",
"Angle": "Ángulo",
"Bidirectional": "Bidirectional",
"Freehand": "Freehand",
"Elliptical": "Elliptical",
"Circle": "Circle",
"Reset": "$t(Common:Reset)",
"CINE": "CINE",
"Acquired": "Acquired",
"Sagittal": "Sagittal",
"Axial": "Axial",
"Manual": "Manual",
"Save": "Guardar",
"Reset to Defaults": "$t(Common:reset) por defectos",
"Cancel": "Cancelar"
}
@@ -0,0 +1,8 @@
{
"fps": "fps",
"Skip to first image": "Avanza para la primera $t(Common:Image)",
"Previous image": "$t(Common:Previous) $t(Common:Image)",
"Play / Stop": "$t(Common:Play) / $t(Common:Stop)",
"Next image": "$t(Common:Play) $t(Common:Image)",
"Skip to last image": "Pular para la ultima $t(Common:Image)"
}
+10
View File
@@ -0,0 +1,10 @@
{
"reset": "Reiniciar",
"Previous": "Anterior",
"Next": "Próximo",
"Play": "Play",
"Stop": "Stop",
"Layout": "Esquema",
"More": "Más",
"Image": "Imagen"
}
@@ -0,0 +1,8 @@
{
"INVESTIGATIONAL USE ONLY": "SOLO USO DE INVESTIGACIÓN",
"Options": "Opciones",
"About": "Sobre",
"Preferences": "Preferencias",
"Study list": "Lista de estudio",
"Back to Viewer": "Back to Viewer"
}
@@ -0,0 +1,3 @@
{
"INVESTIGATIONAL USE ONLY": "SOLO USO DE INVESTIGACIÓN"
}
@@ -0,0 +1,11 @@
{
"Criteria nonconformities": "Criterios de no conformidades",
"Relabel": "Reetiquetar",
"Description": "Descripción",
"Delete": "Borrar",
"Targets": "Objetivos",
"NonTargets": "NonObjetivos",
"MAX": "máximo",
"Chest Wall Posterior": "Pared pectoral posterior",
"Bone Extremity": "Extremidad ósea"
}
@@ -0,0 +1,6 @@
{
"User Preferences": "Preferencias de usuario",
"Save": "$t(Buttons:Save)",
"Reset to Defaults": "$t(Buttons:Reset to Defaults)",
"Cancel": "$t(Buttons:Cancel)"
}
File diff suppressed because it is too large. Load diff
+3 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-vtk",
"version": "0.0.2",
"version": "0.0.3",
"description": "OHIF extension for VTK.js",
"author": "OHIF",
"license": "MIT",
@@ -25,6 +25,7 @@
"dicom-parser": "^1.8.3",
"hammerjs": "^2.0.8",
"ohif-core": "^0.3.3",
"@ohif/i18n": "0.0.4",
"prop-types": "^15.6.2",
"react": "^15.0.0 || ^16.0.0",
"react-dom": "^15.0.0 || ^16.0.0",
@@ -56,6 +57,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",
@@ -6,6 +6,7 @@ import pkg from './package.json';
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';
// Deal with https://github.com/rollup/rollup-plugin-commonjs/issues/297
@@ -24,7 +25,8 @@ const globals = {
dcmjs: 'dcmjs',
'dicom-parser': 'dicomParser',
'ohif-core': 'OHIF',
hammerjs: 'Hammer'
hammerjs: 'Hammer',
'@ohif/i18n': 'i18n'
};
export default {
@@ -56,6 +58,10 @@ export default {
externalHelpers: true,
runtimeHelpers: true
}),
copy({
targets: ['src/locales'],
outputFolder: 'dist',
}),
resolve(),
commonjs({
include: ['node_modules/**', '.yalc/**'],
@@ -1,3 +1,7 @@
import loadLocales from './loadLocales';
import OHIFVTKExtension from './OHIFVTKExtension.js';
loadLocales();
export default OHIFVTKExtension;
@@ -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"
}
@@ -0,0 +1,3 @@
{
"Rotate": "Rotacionar"
}
+22 -1
View File
@@ -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==
@@ -3963,6 +3963,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"
@@ -4076,6 +4083,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"
@@ -7041,6 +7053,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"