Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: complete translations [v34] #1014

Merged
merged 16 commits into from
May 28, 2020
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- '8'
- '10'
env:
global:
- CC_TEST_REPORTER_ID=2a6f417bdfe1cdc8e2ec8d3347728fc81e64752286079db5ab17fd65c964b946
Expand Down
12 changes: 6 additions & 6 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
"private": true,
"homepage": ".",
"devDependencies": {
"@dhis2/cli-app-scripts": "^3.2.5",
"@dhis2/cli-app-scripts": "^4.0.7",
"cypress": "^3.6.1",
"eslint-plugin-cypress": "^2.7.0",
"redux-mock-store": "^1.5.3"
},
"dependencies": {
"@dhis2/analytics": "4.3.25",
"@dhis2/analytics": "^4.4.0-alpha.2",
"@dhis2/app-runtime": "*",
"@dhis2/d2-i18n": "*",
"@dhis2/d2-ui-core": "^6.5.11",
"@dhis2/d2-ui-file-menu": "^6.5.11",
"@dhis2/d2-ui-interpretations": "^6.5.11",
"@dhis2/data-visualizer-plugin": "34.3.31",
"@dhis2/d2-ui-core": "^7.0.3",
"@dhis2/d2-ui-file-menu": "^7.0.3",
"@dhis2/d2-ui-interpretations": "^7.0.3",
"@dhis2/data-visualizer-plugin": "^34.3.32-alpha.1",
jenniferarnesen marked this conversation as resolved.
Show resolved Hide resolved
"@dhis2/ui-core": "*",
"@material-ui/core": "^3.1.2",
"@material-ui/icons": "^3.0.1",
Expand Down
2 changes: 2 additions & 0 deletions packages/app/src/AppWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import metadataMiddleware from './middleware/metadata'
import App from './components/App'
import muiTheme from './modules/theme'

import './locales'

const AppWrapper = () => {
const engine = useDataEngine()
const store = configureStore([
Expand Down
8 changes: 4 additions & 4 deletions packages/app/src/components/TitleBar/TitleBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import {
getVisualizationState,
} from '../../modules/visualization'

export const TITLE_UNSAVED = i18n.t('Unsaved visualization')
export const TITLE_DIRTY = i18n.t('Edited')
export const getTitleUnsaved = () => i18n.t('Unsaved visualization')
export const getTitleDirty = () => i18n.t('Edited')

const defaultTitleStyle = {
...styles.cell,
Expand All @@ -33,7 +33,7 @@ const defaultInterpretationStyle = {
const getTitleText = (titleState, visualization) => {
switch (titleState) {
case STATE_UNSAVED:
return TITLE_UNSAVED
return getTitleUnsaved()
case STATE_SAVED:
case STATE_DIRTY:
return visualization.name
Expand All @@ -60,7 +60,7 @@ const getSuffix = titleState => {
...styles.suffix,
...styles.titleDirty,
}}
>{`- ${TITLE_DIRTY}`}</div>
>{`- ${getTitleDirty()}`}</div>
)
default:
return ''
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { shallow } from 'enzyme'
import { TitleBar, TITLE_UNSAVED, TITLE_DIRTY } from '../TitleBar'
import { TitleBar, getTitleUnsaved, getTitleDirty } from '../TitleBar'
import {
STATE_EMPTY,
STATE_UNSAVED,
Expand Down Expand Up @@ -35,14 +35,14 @@ describe('TitleBar component', () => {

it('renders "unsaved" state', () => {
props.titleState = STATE_UNSAVED
props.titleText = TITLE_UNSAVED
props.titleText = getTitleUnsaved()
expect(titleBar().find('div')).toHaveLength(2)
expect(
titleBar()
.find('div')
.first()
.text()
).toEqual(TITLE_UNSAVED)
).toEqual(getTitleUnsaved())
})

it('renders "saved" state', () => {
Expand All @@ -66,7 +66,7 @@ describe('TitleBar component', () => {
.find('div')
.first()
.text()
).toEqual(`Yall- ${TITLE_DIRTY}`)
).toEqual(`Yall- ${getTitleDirty()}`)
})

it('renders a <div> containing everything else', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ export class VisualizationOptions extends Component {
}

generateTabContent = sections =>
sections.map(({ key, label, content }) => (
sections.map(({ key, getLabel, content }) => (
<div key={key} className={tabSection.className}>
<FieldSet>
{label ? (
{getLabel ? (
<Legend>
<span className={tabSectionTitle.className}>
{label}
{getLabel()}
</span>
</Legend>
) : null}
Expand All @@ -42,9 +42,9 @@ export class VisualizationOptions extends Component {
))

generateTabs = tabs =>
tabs.map(({ key, label, content }) => ({
tabs.map(({ key, getLabel, content }) => ({
key,
label,
label: getLabel(),
content: this.generateTabContent(content),
}))

Expand Down
8 changes: 4 additions & 4 deletions packages/app/src/modules/options/areaConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import CompletedOnly from '../../components/VisualizationOptions/Options/Complet
export default [
{
key: 'data-tab',
label: i18n.t('Data'),
getLabel: () => i18n.t('Data'),
content: [
{
key: 'data-section-1',
Expand All @@ -45,14 +45,14 @@ export default [
},
{
key: 'data-advanced',
label: i18n.t('Advanced'),
getLabel: () => i18n.t('Advanced'),
content: React.Children.toArray([<CompletedOnly />]),
},
],
},
{
key: 'axes-tab',
label: i18n.t('Axes'),
getLabel: () => i18n.t('Axes'),
content: [
{
key: 'axes-section-1',
Expand All @@ -69,7 +69,7 @@ export default [
},
{
key: 'style-tab',
label: i18n.t('Style'),
getLabel: () => i18n.t('Style'),
content: [
{
key: 'style-section-1',
Expand Down
20 changes: 10 additions & 10 deletions packages/app/src/modules/options/columnConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import CompletedOnly from '../../components/VisualizationOptions/Options/Complet
export default [
{
key: 'data-tab',
label: i18n.t('Data'),
getLabel: () => i18n.t('Data'),
content: [
{
key: 'data-display',
label: i18n.t('Display'),
getLabel: () => i18n.t('Display'),
content: React.Children.toArray([
<CumulativeValues />,
<HideEmptyRowItems />,
Expand All @@ -37,7 +37,7 @@ export default [
},
{
key: 'data-lines',
label: i18n.t('Lines'),
getLabel: () => i18n.t('Lines'),
content: React.Children.toArray([
<RegressionType />,
<TargetLine />,
Expand All @@ -46,7 +46,7 @@ export default [
},
{
key: 'data-advanced',
label: i18n.t('Advanced'),
getLabel: () => i18n.t('Advanced'),
content: React.Children.toArray([
<AggregationType />,
<CompletedOnly />,
Expand All @@ -56,11 +56,11 @@ export default [
},
{
key: 'axes-tab',
label: i18n.t('Axes'),
getLabel: () => i18n.t('Axes'),
content: [
{
key: 'axes-vertical-axis',
label: i18n.t('Vertical (y) axis'),
getLabel: () => i18n.t('Vertical (y) axis'),
content: React.Children.toArray([
<RangeAxisLabel />,
<AxisRange />,
Expand All @@ -70,18 +70,18 @@ export default [
},
{
key: 'axes-horizontal-axis',
label: i18n.t('Horizontal (x) axis'),
getLabel: () => i18n.t('Horizontal (x) axis'),
content: React.Children.toArray([<DomainAxisLabel />]),
},
],
},
{
key: 'style-tab',
label: i18n.t('Style'),
getLabel: () => i18n.t('Style'),
content: [
{
key: 'style-chart-style',
label: i18n.t('Chart style'),
getLabel: () => i18n.t('Chart style'),
content: React.Children.toArray([
<ShowData />,
<NoSpaceBetweenColumns />,
Expand All @@ -91,7 +91,7 @@ export default [
},
{
key: 'style-titles',
label: i18n.t('Titles'),
getLabel: () => i18n.t('Titles'),
content: React.Children.toArray([
<HideTitle />,
<HideSubtitle />,
Expand Down
16 changes: 8 additions & 8 deletions packages/app/src/modules/options/gaugeConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ import CompletedOnly from '../../components/VisualizationOptions/Options/Complet
export default [
{
key: 'data-tab',
label: i18n.t('Data'),
getLabel: () => i18n.t('Data'),
content: [
{
key: 'data-lines',
label: i18n.t('Lines'),
getLabel: () => i18n.t('Lines'),
content: React.Children.toArray([<TargetLine />, <BaseLine />]),
},
{
key: 'data-advanced',
label: i18n.t('Advanced'),
getLabel: () => i18n.t('Advanced'),
content: React.Children.toArray([
<AggregationType />,
<CompletedOnly />,
Expand All @@ -33,7 +33,7 @@ export default [
},
{
key: 'legend-tab',
label: i18n.t('Legend'),
getLabel: () => i18n.t('Legend'),
content: [
{
key: 'legend-section-1',
Expand All @@ -43,22 +43,22 @@ export default [
},
{
key: 'axes-tab',
label: i18n.t('Axes'),
getLabel: () => i18n.t('Axes'),
content: [
{
key: 'axes-vertical-axis',
label: i18n.t('Vertical (y) axis'),
getLabel: () => i18n.t('Vertical (y) axis'),
content: React.Children.toArray([<AxisRange />]),
},
],
},
{
key: 'style-tab',
label: i18n.t('Style'),
getLabel: () => i18n.t('Style'),
content: [
{
key: 'style-titles',
label: i18n.t('Titles'),
getLabel: () => i18n.t('Titles'),
content: React.Children.toArray([
<HideTitle />,
<HideSubtitle />,
Expand Down
8 changes: 4 additions & 4 deletions packages/app/src/modules/options/lineConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import CompletedOnly from '../../components/VisualizationOptions/Options/Complet
export default [
{
key: 'data-tab',
label: i18n.t('Data'),
getLabel: () => i18n.t('Data'),
content: [
{
key: 'data-section-1',
Expand All @@ -43,14 +43,14 @@ export default [
},
{
key: 'data-advanced',
label: i18n.t('Advanced'),
getLabel: () => i18n.t('Advanced'),
content: React.Children.toArray([<CompletedOnly />]),
},
],
},
{
key: 'axes-tab',
label: i18n.t('Axes'),
getLabel: () => i18n.t('Axes'),
content: [
{
key: 'axes-section-1',
Expand All @@ -67,7 +67,7 @@ export default [
},
{
key: 'style-tab',
label: i18n.t('Style'),
getLabel: () => i18n.t('Style'),
content: [
{
key: 'style-section-1',
Expand Down
8 changes: 4 additions & 4 deletions packages/app/src/modules/options/pieConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import CompletedOnly from '../../components/VisualizationOptions/Options/Complet
export default [
{
key: 'data-tab',
label: i18n.t('Data'),
getLabel: () => i18n.t('Data'),
content: [
{
key: 'data-advanced',
label: i18n.t('Advanced'),
getLabel: () => i18n.t('Advanced'),
content: React.Children.toArray([
<AggregationType />,
<CompletedOnly />,
Expand All @@ -24,11 +24,11 @@ export default [
},
{
key: 'style-tab',
label: i18n.t('Style'),
getLabel: () => i18n.t('Style'),
content: [
{
key: 'style-titles',
label: i18n.t('Titles'),
getLabel: () => i18n.t('Titles'),
content: React.Children.toArray([
<HideTitle />,
<HideSubtitle />,
Expand Down
Loading