Renaming Content to I18n to avoid naming clashes; Artist and Debug views mapped

This commit is contained in:
James Barnsley
2020-07-07 20:52:09 +12:00
parent fca28ada88
commit 6225c6a6b0
18 changed files with 1058 additions and 917 deletions

View File

@ -1,5 +1,4 @@
import React, { Fragment } from 'react';
import { useSelector } from 'react-redux';
import get from 'lodash/get';
import dictionaries from './dictionaries';
import { titleCase } from '../util/helpers';
@ -7,7 +6,7 @@ import { titleCase } from '../util/helpers';
const PARAMS_REG_EXP = '%{(.*?)}';
const paramsRegExp = new RegExp(PARAMS_REG_EXP, 'g');
const content = (path, params = {}, transform) => {
const i18n = (path, params = {}, transform) => {
const dictionary = dictionaries[window.language || 'en'] || dictionaries.en;
let value = get((dictionary), path, '');
@ -33,19 +32,19 @@ const content = (path, params = {}, transform) => {
return value;
};
const Content = ({ path, params = {}, transform, children }) => (
const I18n = ({ path, transform, children, ...params }) => (
<Fragment>
{content(path, params, transform)}
{i18n(path, params, transform)}
{children}
</Fragment>
);
export default {
Content,
content,
I18n,
i18n,
};
export {
Content,
content,
I18n,
i18n,
};