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: working translations [v32] #1001

Merged
merged 5 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
98 changes: 34 additions & 64 deletions packages/app/i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2019-06-21T08:47:33.000Z\n"
"PO-Revision-Date: 2019-06-21T08:47:33.000Z\n"
"POT-Creation-Date: 2020-05-18T23:27:07.844Z\n"
"PO-Revision-Date: 2020-05-18T23:27:07.844Z\n"

msgid "Rename successful"
msgstr ""
Expand Down Expand Up @@ -64,12 +64,33 @@ msgstr ""
msgid "Metadata ID scheme"
msgstr ""

msgid "ID"
msgstr ""

msgid "Code"
msgstr ""

msgid "Name"
msgstr ""

msgid "Data value set"
msgstr ""

msgid "JSON"
msgstr ""

msgid "XML"
msgstr ""

msgid "Other formats"
msgstr ""

msgid "JRXML"
msgstr ""

msgid "Raw data SQL"
msgstr ""

msgid "An error occurred in the DHIS2 Data Visualizer application."
msgstr ""

Expand Down Expand Up @@ -103,9 +124,6 @@ msgstr ""
msgid "Filter"
msgstr ""

msgid "Move to"
msgstr ""

msgid "None selected"
msgstr ""

Expand All @@ -118,10 +136,10 @@ msgstr ""
msgid "Viewing interpretation from {{interpretationDate}}"
msgstr ""

msgid "Create a new visualization by adding dimensions to the layout"
msgid "Chart error"
msgstr ""

msgid "Chart error"
msgid "Create a new visualization by adding dimensions to the layout"
msgstr ""

msgid "Error generating chart, please try again"
Expand Down Expand Up @@ -316,79 +334,31 @@ msgstr ""
msgid "Year over year (column)"
msgstr ""

msgid "Reporting rate"
msgstr ""

msgid "Reporting rate on time"
msgstr ""

msgid "Actual reports"
msgstr ""

msgid "Actual reports on time"
msgstr ""

msgid "Expected reports"
msgstr ""

msgid "Program"
msgstr ""

msgid "Select a program"
msgstr ""

msgid "Indicators"
msgstr ""

msgid "Select indicator group"
msgstr ""

msgid "[ All groups ]"
msgstr ""

msgid "Data elements"
msgstr ""

msgid "Select data element group"
msgstr ""

msgid "[ All data elements ]"
msgstr ""

msgid "Totals"
msgid "Open as Map"
msgstr ""

msgid "Details"
msgstr ""

msgid "Data sets"
msgstr ""

msgid "Select data sets"
msgstr ""

msgid "[ All metrics ]"
msgid "Period"
msgstr ""

msgid "Event data items"
msgid "Organisation Unit"
msgstr ""

msgid "Program indicators"
msgid "Add to series"
msgstr ""

msgid "Period"
msgid "Add to category"
msgstr ""

msgid "Organisation Unit"
msgid "Add to filter"
msgstr ""

msgid "Add to series"
msgid "Move to series"
msgstr ""

msgid "Add to category"
msgid "Move to category"
msgstr ""

msgid "Add to filter"
msgid "Move to filter"
msgstr ""

msgid "series"
Expand Down
12 changes: 6 additions & 6 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
"webpack-bundle-analyzer": "^3.0.3"
},
"dependencies": {
"@dhis2/analytics": "2.4.9",
"@dhis2/analytics": "~2.4.15",
"@dhis2/d2-i18n": "^1.0.6",
"@dhis2/d2-ui-core": "^6.2.1",
"@dhis2/d2-ui-file-menu": "^6.2.1",
"@dhis2/d2-ui-interpretations": "^6.2.1",
"@dhis2/data-visualizer-plugin": "^32.0.8",
"@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": "^33.1.13",
"@dhis2/ui": "^1.0.0-beta.11",
"@material-ui/core": "^3.1.2",
"@material-ui/icons": "^3.0.1",
Expand Down Expand Up @@ -97,7 +97,7 @@
"lint": "eslint --config=../../.eslintrc.json src",
"prettier-ci": "prettier \"./src/{**/*,*}.js\" --list-different",
"prettier-write": "prettier \"./src/{**/*,*}.js\" --write",
"localize": "npm run extract-pot && d2-i18n-generate -n data-visualizer-app -p ./i18n/ -o ./src/locales/",
"localize": "npm run extract-pot && d2-i18n-generate -n default -p ./i18n/ -o ./src/locales/",
"extract-pot": "d2-i18n-extract -p src/ -o i18n/",
"manifest": "d2-manifest package.json build/manifest.webapp",
"test": "node scripts/test.js --config=../../jest.config.js",
Expand Down
10 changes: 9 additions & 1 deletion packages/app/src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,17 @@ export class App extends Component {

const rootOrgUnit = this.props.settings.rootOrganisationUnit;

const defaultMetadataWithNames = Object.entries(defaultMetadata).reduce(
(acc, [key, value]) => ({
...acc,
[key]: { name: value() },
}),
{}
);

store.dispatch(
fromActions.fromMetadata.acAddMetadata({
...defaultMetadata,
...defaultMetadataWithNames,
[rootOrgUnit.id]: {
...rootOrgUnit,
path: `/${rootOrgUnit.id}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class AddToLayoutButton extends Component {
key={option.axisKey}
onClick={() => this.onUpdate(option.axisKey)}
>
{option.name}
{option.name()}
</MenuItem>
));

Expand All @@ -84,7 +84,7 @@ export class AddToLayoutButton extends Component {
disableFocusRipple
onClick={() => this.onUpdate(filterItem.axisKey)}
>
{filterItem.name}
{filterItem.name()}
</Button>
) : (
<div ref={addToRef => (this.buttonRef = addToRef)}>
Expand All @@ -96,7 +96,7 @@ export class AddToLayoutButton extends Component {
disableFocusRipple
onClick={() => this.onUpdate(seriesItem.axisKey)}
>
{seriesItem.name}
{seriesItem.name()}
</Button>
<Menu
onClose={this.onClose}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react';
import { shallow } from 'enzyme';
import Menu from '@material-ui/core/Menu';
import MenuItem from '@material-ui/core/MenuItem';
import { ADD_TO_LAYOUT_OPTIONS } from '../../../../../modules/layout';

import { DropDown } from '../Menu';
import DropDownButton from '../DropDownButton';
Expand Down Expand Up @@ -55,7 +54,7 @@ describe('The DropDownButton component ', () => {
it('renders a Menu with children if prop anchorel is equal to a truthy value', () => {
props.anchorEl = { getBoundingClientRect: () => ({ bottom: 100 }) };

props.menuItems = ADD_TO_LAYOUT_OPTIONS.map((option, i) => (
props.menuItems = ['colums', 'rows', 'filters'].map((option, i) => (
<MenuItem key={i} value={option.axisName} />
));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class DimensionOptions extends Component {
key: `add-to-${this.props.id}`,
id: ADD_TO_LAYOUT_OPTIONS[FILTER].axisKey,
onClick: this.addDimension,
displayName: ADD_TO_LAYOUT_OPTIONS[FILTER].name,
displayName: ADD_TO_LAYOUT_OPTIONS[FILTER].name(),
}),
];
} else {
Expand All @@ -50,7 +50,7 @@ export class DimensionOptions extends Component {
key: `add-to-${axis.axisKey}`,
id: axis.axisKey,
onClick: this.addDimension,
displayName: axis.name,
displayName: axis.name(),
})
)
);
Expand All @@ -69,13 +69,11 @@ export class DimensionOptions extends Component {
);

return items.map(([key, axisIds]) => {
const label = menuLabels[key];

return this.renderMenuItem({
key: `${this.props.id}-to-${key}`,
id: key,
onClick: this.addDimension,
displayName: `${i18n.t(`Move to ${label}`, { label })}`,
displayName: menuLabels[key](),
});
});
};
Expand Down
19 changes: 11 additions & 8 deletions packages/app/src/components/DownloadMenu/DownloadMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,29 +212,32 @@ export class DownloadMenu extends Component {
'UID'
)}
>
ID
{i18n.t('ID')}
</MenuItem>
<MenuItem
onClick={this.downloadData(
this.state.schemeSubmenu.dataType,
'CODE'
)}
>
Code
{i18n.t('Code')}
</MenuItem>
<MenuItem
onClick={this.downloadData(
this.state.schemeSubmenu.dataType,
'NAME'
)}
>
Name
{i18n.t('Name')}
</MenuItem>
</Menu>
<Menu
open={Boolean(this.state.advancedSubmenu.anchorEl)}
anchorEl={this.state.advancedSubmenu.anchorEl}
anchorOrigin={{ vertical: 'top', horizontal: 'right' }}
anchorOrigin={{
vertical: 'top',
horizontal: 'right',
}}
onClose={event => this.toggleSubmenu('advanced')}
>
<ListSubheader component="div">
Expand All @@ -247,24 +250,24 @@ export class DownloadMenu extends Component {
'dataValueSet'
)}
>
JSON
{i18n.t('JSON')}
</MenuItem>
<MenuItem
onClick={this.downloadData('xml', null, 'dataValueSet')}
>
XML
{i18n.t('XML')}
</MenuItem>
<Divider />
<ListSubheader component="div">
{i18n.t('Other formats')}
</ListSubheader>
<MenuItem onClick={this.downloadData('jrxml')}>
JRXML
{i18n.t('JRXML')}
</MenuItem>
<MenuItem
onClick={this.downloadData('sql', null, 'debug/sql')}
>
Raw data SQL
{i18n.t('Raw data SQL')}
</MenuItem>
</Menu>
</Fragment>
Expand Down
2 changes: 0 additions & 2 deletions packages/app/src/components/Layout/Chip.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { sGetUiItemsByDimension } from '../../reducers/ui';
import { styles } from './styles/Chip.style';
import { FIXED_DIMENSIONS } from '../../modules/fixedDimensions';
import DynamicDimensionIcon from '../../assets/DynamicDimensionIcon';
import { sGetMetadata } from '../../reducers/metadata';

const TOOLTIP_ENTER_DELAY = 500;

Expand Down Expand Up @@ -125,7 +124,6 @@ class Chip extends React.Component {
const mapStateToProps = (state, ownProps) => ({
dimensionName: (sGetDimensions(state)[ownProps.dimensionId] || {}).name,
items: sGetUiItemsByDimension(state, ownProps.dimensionId) || emptyItems,
metadata: sGetMetadata(state),
});

export default connect(mapStateToProps)(Chip);
16 changes: 10 additions & 6 deletions packages/app/src/components/Layout/DefaultLayout/DefaultAxis.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ import { isYearOverYear, isDualAxisType } from '../../../modules/chartTypes';
import { AXIS_SETUP_DIALOG_ID } from '../../AxisSetup/AxisSetup';
import { FIXED_DIMENSIONS } from '../../../modules/fixedDimensions';

const axisLabels = {
columns: i18n.t('Series'),
rows: i18n.t('Category'),
filters: i18n.t('Filter'),
const getAxisLabel = axis => {
const axisLabels = {
columns: i18n.t('Series'),
rows: i18n.t('Category'),
filters: i18n.t('Filter'),
};

return axisLabels[axis];
};

class Axis extends React.Component {
Expand Down Expand Up @@ -59,7 +63,7 @@ class Axis extends React.Component {
<MenuItem
key={`${dimensionId}-to-${key}`}
onClick={this.props.getMoveHandler({ [dimensionId]: key })}
>{`${i18n.t('Move to')} ${menuLabels[key]}`}</MenuItem>
>{`${menuLabels[key]()}`}</MenuItem>
));

isSeries = () => this.props.axisName === AXIS_NAME_COLUMNS;
Expand Down Expand Up @@ -117,7 +121,7 @@ class Axis extends React.Component {
onDrop={this.onDrop}
>
<div style={styles.label}>
{axisLabels[this.props.axisName]}
{getAxisLabel(this.props.axisName)}
</div>
<div style={styles.content}>
{this.props.axis.map(dimensionId => (
Expand Down
Loading