Skip to content

Commit

Permalink
fix: add missing translations (DHIS2-8658) (#697)
Browse files Browse the repository at this point in the history
  • Loading branch information
turban authored May 13, 2020
1 parent d0f6ea8 commit 1563ae0
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 27 deletions.
55 changes: 53 additions & 2 deletions 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: 2020-05-05T09:18:51.686Z\n"
"PO-Revision-Date: 2020-05-05T09:18:51.687Z\n"
"POT-Creation-Date: 2020-05-12T20:48:33.602Z\n"
"PO-Revision-Date: 2020-05-12T20:48:33.602Z\n"

msgid "Maps"
msgstr ""
Expand All @@ -26,6 +26,9 @@ msgstr ""
msgid "Predefined"
msgstr ""

msgid "Size"
msgstr ""

msgid "Data element group"
msgstr ""

Expand Down Expand Up @@ -278,6 +281,24 @@ msgstr ""
msgid "Group set is required"
msgstr ""

msgid "event"
msgstr ""

msgid "tracked entity"
msgstr ""

msgid "facility"
msgstr ""

msgid "thematic"
msgstr ""

msgid "boundary"
msgstr ""

msgid "Earth Engine"
msgstr ""

msgid "Edit {{name}} layer"
msgstr ""

Expand Down Expand Up @@ -449,6 +470,9 @@ msgstr ""
msgid "Interpretations"
msgstr ""

msgid "External basemap"
msgstr ""

msgid "Basemap"
msgstr ""

Expand Down Expand Up @@ -595,6 +619,9 @@ msgstr ""
msgid "Exit fullscreen"
msgstr ""

msgid "Finish measurement"
msgstr ""

msgid "ha"
msgstr ""

Expand Down Expand Up @@ -762,6 +789,30 @@ msgstr ""
msgid "Variance"
msgstr ""

msgid "OSM Light"
msgstr ""

msgid "OSM Detailed"
msgstr ""

msgid "Google Streets"
msgstr ""

msgid "Google Hybrid"
msgstr ""

msgid "Bing Road"
msgstr ""

msgid "Bing Dark"
msgstr ""

msgid "Bing Aerial"
msgstr ""

msgid "Bing Aerial Labels"
msgstr ""

msgid "Equal intervals"
msgstr ""

Expand Down
3 changes: 2 additions & 1 deletion src/components/core/FontStyle.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import i18n from '@dhis2/d2-i18n';
import { withStyles } from '@material-ui/core/styles';
import { IconButton } from '@material-ui/core';
import BoldIcon from '@material-ui/icons/FormatBold';
Expand Down Expand Up @@ -42,7 +43,7 @@ const FontStyle = ({
<TextField
id="size"
type="number"
label="Size"
label={i18n.t('Size')}
value={parseInt(
size !== undefined ? size : LABEL_FONT_SIZE,
10
Expand Down
18 changes: 9 additions & 9 deletions src/components/edit/LayerEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ const layerType = {
earthEngine: EarthEngineDialog,
};

const layerName = {
event: 'event',
trackedEntity: 'tracked entity',
facility: 'facility',
thematic: 'thematic',
boundary: 'boundary',
earthEngine: 'Earth Engine',
};
const layerName = () => ({
event: i18n.t('event'),
trackedEntity: i18n.t('tracked entity'),
facility: i18n.t('facility'),
thematic: i18n.t('thematic'),
boundary: i18n.t('boundary'),
earthEngine: i18n.t('Earth Engine'),
});

const styles = {
title: {
Expand Down Expand Up @@ -95,7 +95,7 @@ class LayerEdit extends Component {
}

const type = layer.layer;
const name = layerName[type];
const name = layerName()[type];
const LayerDialog = layerType[type];

if (!LayerDialog) {
Expand Down
7 changes: 5 additions & 2 deletions src/components/layers/basemaps/Basemap.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import i18n from '@dhis2/d2-i18n';
import { withStyles } from '@material-ui/core/styles';

const styles = theme => ({
Expand Down Expand Up @@ -72,7 +73,9 @@ const Basemap = ({ classes, id, img, name, isSelected, onClick }) => {
{img ? (
<img src={img} className={classes.image} />
) : (
<div className={classes.noImage}>External basemap</div>
<div className={classes.noImage}>
{i18n.t('External basemap')}
</div>
)}
</div>
<div
Expand All @@ -81,7 +84,7 @@ const Basemap = ({ classes, id, img, name, isSelected, onClick }) => {
}`}
data-test="basemaplistitem-name"
>
{name}
{i18n.t(name)}
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/layers/basemaps/BasemapCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const BasemapCard = props => {
title: classes.title,
subheader: classes.subheader,
}}
title={name}
title={i18n.t(name)}
subheader={subtitle}
action={
<Tooltip
Expand Down
1 change: 1 addition & 0 deletions src/components/map/mapLocale.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const getMapLocale = () => ({
Distance: i18n.t('Distance'),
'Enter fullscreen': i18n.t('Enter fullscreen'),
'Exit fullscreen': i18n.t('Exit fullscreen'),
'Finish measurement': i18n.t('Finish measurement'),
ha: i18n.t('ha'),
km: i18n.t('km'),
'Measure distances and areas': i18n.t('Measure distances and areas'),
Expand Down
20 changes: 11 additions & 9 deletions src/constants/basemaps.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export const defaultBasemaps = [
import i18n from '@dhis2/d2-i18n';

export const defaultBasemaps = () => [
{
id: 'osmLight',
name: 'OSM Light',
name: i18n.t('OSM Light'),
img: 'images/osmlight.png',
config: {
type: 'tileLayer',
Expand All @@ -13,7 +15,7 @@ export const defaultBasemaps = [
},
{
id: 'openStreetMap',
name: 'OSM Detailed',
name: i18n.t('OSM Detailed'),
img: 'images/osm.png',
config: {
type: 'tileLayer',
Expand All @@ -24,7 +26,7 @@ export const defaultBasemaps = [
},
{
id: 'googleStreets',
name: 'Google Streets',
name: i18n.t('Google Streets'),
img: 'images/googlestreets.png',
config: {
type: 'googleLayer',
Expand All @@ -33,7 +35,7 @@ export const defaultBasemaps = [
},
{
id: 'googleHybrid',
name: 'Google Hybrid',
name: i18n.t('Google Hybrid'),
img: 'images/googlehybrid.jpeg',
config: {
type: 'googleLayer',
Expand All @@ -42,7 +44,7 @@ export const defaultBasemaps = [
},
{
id: 'bingLight',
name: 'Bing Road',
name: i18n.t('Bing Road'),
img: 'images/bingroad.png',
config: {
type: 'bingLayer',
Expand All @@ -53,7 +55,7 @@ export const defaultBasemaps = [
},
{
id: 'bingDark',
name: 'Bing Dark',
name: i18n.t('Bing Dark'),
img: 'images/bingdark.png',
config: {
type: 'bingLayer',
Expand All @@ -62,7 +64,7 @@ export const defaultBasemaps = [
},
{
id: 'bingAerial',
name: 'Bing Aerial',
name: i18n.t('Bing Aerial'),
img: 'images/bingaerial.jpeg',
config: {
type: 'bingLayer',
Expand All @@ -71,7 +73,7 @@ export const defaultBasemaps = [
},
{
id: 'bingHybrid',
name: 'Bing Aerial Labels',
name: i18n.t('Bing Aerial Labels'),
img: 'images/binghybrid.jpeg',
config: {
type: 'bingLayer',
Expand Down
2 changes: 1 addition & 1 deletion src/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ const PluginContainer = () => {
},
};
} else {
basemap = defaultBasemaps.find(map => map.id === basemapId);
basemap = defaultBasemaps().find(map => map.id === basemapId);
}

if (basemapId.substring(0, 4) === 'bing') {
Expand Down
2 changes: 1 addition & 1 deletion src/reducers/basemaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defaultBasemaps } from '../constants/basemaps';

import * as types from '../constants/actionTypes';

const basemaps = (state = defaultBasemaps, action) => {
const basemaps = (state = defaultBasemaps(), action) => {
switch (action.type) {
case types.BASEMAP_ADD:
return [...state, action.payload];
Expand Down
1 change: 0 additions & 1 deletion src/reducers/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const defaultState = {
isVisible: true,
isExpanded: true,
opacity: 1,
subtitle: 'Basemap',
},
mapViews: [],
};
Expand Down

0 comments on commit 1563ae0

Please sign in to comment.