Skip to content

Commit

Permalink
feat: Add translations
Browse files Browse the repository at this point in the history
  • Loading branch information
gmaclennan committed Oct 6, 2019
1 parent f09243e commit 3254bd0
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 43 deletions.
9 changes: 9 additions & 0 deletions messages/renderer/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@
"renderer.components.MapFilter.Toolbar.exportButton": {
"message": "Export data"
},
"renderer.components.MapFilter.Toolbar.mapTabLabel": {
"message": "Map"
},
"renderer.components.MapFilter.Toolbar.mediaTabLabel": {
"message": "Media"
},
"renderer.components.MapFilter.Toolbar.reportTabLabel": {
"message": "Report"
},
"renderer.components.SyncView.Searching.searchingHint": {
"description": "Hint on sync screen when searching on wifi for devices",
"message": "Make sure devices are turned on and connected to the same wifi network"
Expand Down
45 changes: 27 additions & 18 deletions messages/renderer/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"renderer.components.MapFilter.Loading.loading": {
"description": "Displayed whilst observations and presets load",
"message": ""
"message": "Cargando…"
},
"renderer.components.MapFilter.MapExportDialog.cancel": {
"description": "cancel button",
Expand Down Expand Up @@ -54,67 +54,76 @@
"message": "Título de este mapa"
},
"renderer.components.MapFilter.Toolbar.exportButton": {
"message": ""
"message": "Exportar"
},
"renderer.components.MapFilter.Toolbar.mapTabLabel": {
"message": "Mapa"
},
"renderer.components.MapFilter.Toolbar.mediaTabLabel": {
"message": "Fotos"
},
"renderer.components.MapFilter.Toolbar.reportTabLabel": {
"message": "Informe"
},
"renderer.components.SyncView.Searching.searchingHint": {
"description": "Hint on sync screen when searching on wifi for devices",
"message": ""
"message": "Asegurar que los equipos están encendidos y conectados a la misma red de wifi"
},
"renderer.components.SyncView.Searching.searchingTitle": {
"description": "Title on sync screen when searching for devices",
"message": ""
"message": "Buscando…"
},
"renderer.components.SyncView.SyncAppBar.newSyncfile": {
"description": "Button to create a new sync file",
"message": ""
"message": "Crear nuevo archivo de sincronización"
},
"renderer.components.SyncView.SyncAppBar.selectSyncfile": {
"description": "Button to sync from an existing sync file",
"message": ""
"message": "Sincronizar con archivo"
},
"renderer.components.SyncView.SyncAppBar.subtitle": {
"message": ""
"message": "por wifi"
},
"renderer.components.SyncView.SyncAppBar.title": {
"description": "Title of sync screen",
"message": ""
"message": "Equipo disponibles"
},
"renderer.components.SyncView.SyncButton.complete": {
"description": "Button when sync is complete",
"message": ""
"message": "Completo"
},
"renderer.components.SyncView.SyncButton.retry": {
"description": "Button to retry sync after error",
"message": ""
"message": "Reintentar"
},
"renderer.components.SyncView.SyncButton.starting": {
"description": "Displayed when sync is starting",
"message": ""
"message": "Iniciando…"
},
"renderer.components.SyncView.SyncButton.sync": {
"description": "Button to sync a device",
"message": ""
"message": "Sincronizar"
},
"renderer.components.SyncView.SyncTarget.database": {
"description": "Prompt of how many database objects have synced",
"message": ""
"message": "Datos: {sofar} / {total}"
},
"renderer.components.SyncView.SyncTarget.errorMsg": {
"description": "Message shown when there is an error while syncing",
"message": ""
"message": "Error de sicronización"
},
"renderer.components.SyncView.SyncTarget.lastSync": {
"description": "Shown before last sync time, e.g. 'Last synchronized: 2 hours ago'",
"message": ""
"message": "Ultima sincronización"
},
"renderer.components.SyncView.SyncTarget.media": {
"description": "Prompt for how many media items have synced",
"message": ""
"message": "Fotos: {sofar} / {total}"
},
"renderer.components.dialogs.LatLon.button-submit": {
"message": ""
"message": "Ir"
},
"renderer.components.dialogs.LatLon.dialog-enter-latlon-coordinates": {
"message": ""
"message": "Ingresar coordenadas"
}
}
9 changes: 9 additions & 0 deletions messages/renderer/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@
"renderer.components.MapFilter.Toolbar.exportButton": {
"message": ""
},
"renderer.components.MapFilter.Toolbar.mapTabLabel": {
"message": ""
},
"renderer.components.MapFilter.Toolbar.mediaTabLabel": {
"message": ""
},
"renderer.components.MapFilter.Toolbar.reportTabLabel": {
"message": ""
},
"renderer.components.SyncView.Searching.searchingHint": {
"description": "Hint on sync screen when searching on wifi for devices",
"message": ""
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"clean": "rimraf \"dist/\"",
"pack": "electron-builder --dir",
"dist": "electron-builder --publish=onTag",
"build": "webpack",
"build": "npm run build:translations && webpack",
"build:translations": "bin/build-translations.js",
"lint": "standard",
"test": "npm run lint && npm run test-integration",
"test-integration": "tape test",
Expand Down
22 changes: 20 additions & 2 deletions src/renderer/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,29 @@ import Home from './components/HomeNew'

const locale = navigator.language.slice(0, 2)

const mdMsgs = {
en: require('../../translations/en.json'),
es: require('../../translations/es.json'),
pt: require('../../translations/pt.json')
}

const mfMsgs = {
en: require('react-mapfilter/translations/en.json'),
es: require('react-mapfilter/translations/es.json'),
pt: require('react-mapfilter/translations/pt.json')
}

const allMsgs = {
en: { ...mdMsgs.en, ...mfMsgs.en },
es: { ...mdMsgs.es, ...mfMsgs.es },
pt: { ...mdMsgs.pt, ...mfMsgs.pt }
}

const App = () => (
<StylesProvider injectFirst>
<ThemeProvider theme={theme}>
<CssBaseline />
<IntlProvider locale={locale}>
<IntlProvider locale={locale} messages={allMsgs[locale]}>
<Home />
</IntlProvider>
</ThemeProvider>
Expand All @@ -22,7 +40,7 @@ const App = () => (

ReactDOM.render(<App />, document.getElementById('root'))

let localStorage = window.localStorage
const localStorage = window.localStorage
window.testMode = function () {
console.log('Test mode, clearing cache')
localStorage.removeItem('lastView')
Expand Down
11 changes: 7 additions & 4 deletions src/renderer/components/MapFilter/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ import clsx from 'clsx'
import MapExportDialog from './MapExportDialog'

const m = defineMessages({
exportButton: 'Export data'
exportButton: 'Export data',
mapTabLabel: 'Map',
mediaTabLabel: 'Media',
reportTabLabel: 'Report'
})

const TabItem = ({ selected, ...props }) => {
Expand Down Expand Up @@ -58,23 +61,23 @@ const MapFilterToolbar = ({
onClick={handleChange('map')}
>
<MapIcon />
<span className={cx.tabLabel}>Map</span>
<span className={cx.tabLabel}>{t(m.mapTabLabel)}</span>
</TabItem>
<TabItem
aria-label='media view'
selected={view === 'media'}
onClick={handleChange('media')}
>
<MediaIcon />
<span className={cx.tabLabel}>Media</span>
<span className={cx.tabLabel}>{t(m.mediaTabLabel)}</span>
</TabItem>
<TabItem
aria-label='report view'
selected={view === 'report'}
onClick={handleChange('report')}
>
<ReportIcon />
<span className={cx.tabLabel}>Report</span>
<span className={cx.tabLabel}>{t(m.reportTabLabel)}</span>
</TabItem>
</div>
<Tooltip title={t(m.exportButton)}>
Expand Down
3 changes: 3 additions & 0 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
"renderer.components.MapFilter.MapExportDialog.title": "Export a map to share online",
"renderer.components.MapFilter.MapExportDialog.titleLabel": "Map Title",
"renderer.components.MapFilter.Toolbar.exportButton": "Export data",
"renderer.components.MapFilter.Toolbar.mapTabLabel": "Map",
"renderer.components.MapFilter.Toolbar.mediaTabLabel": "Media",
"renderer.components.MapFilter.Toolbar.reportTabLabel": "Report",
"renderer.components.SyncView.Searching.searchingHint": "Make sure devices are turned on and connected to the same wifi network",
"renderer.components.SyncView.Searching.searchingTitle": "Searching…",
"renderer.components.SyncView.SyncAppBar.newSyncfile": "Create new syncfile…",
Expand Down
39 changes: 21 additions & 18 deletions translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"renderer.components.HomeNew.sync": "Síncronizar",
"renderer.components.MapEditor.feedback-contribute-button": "",
"renderer.components.MapFilter.FilterPanel.filterHeader": "Filtrar datos…",
"renderer.components.MapFilter.Loading.loading": "",
"renderer.components.MapFilter.Loading.loading": "Cargando…",
"renderer.components.MapFilter.MapExportDialog.cancel": "Cancelar",
"renderer.components.MapFilter.MapExportDialog.descriptionLabel": "Descripción de este mapa",
"renderer.components.MapFilter.MapExportDialog.save": "Guardar",
Expand All @@ -13,21 +13,24 @@
"renderer.components.MapFilter.MapExportDialog.termsLabel": "",
"renderer.components.MapFilter.MapExportDialog.title": "Exportar un mapa para compartir en el internet",
"renderer.components.MapFilter.MapExportDialog.titleLabel": "Título de este mapa",
"renderer.components.MapFilter.Toolbar.exportButton": "",
"renderer.components.SyncView.Searching.searchingHint": "",
"renderer.components.SyncView.Searching.searchingTitle": "",
"renderer.components.SyncView.SyncAppBar.newSyncfile": "",
"renderer.components.SyncView.SyncAppBar.selectSyncfile": "",
"renderer.components.SyncView.SyncAppBar.subtitle": "",
"renderer.components.SyncView.SyncAppBar.title": "",
"renderer.components.SyncView.SyncButton.complete": "",
"renderer.components.SyncView.SyncButton.retry": "",
"renderer.components.SyncView.SyncButton.starting": "",
"renderer.components.SyncView.SyncButton.sync": "",
"renderer.components.SyncView.SyncTarget.database": "",
"renderer.components.SyncView.SyncTarget.errorMsg": "",
"renderer.components.SyncView.SyncTarget.lastSync": "",
"renderer.components.SyncView.SyncTarget.media": "",
"renderer.components.dialogs.LatLon.button-submit": "",
"renderer.components.dialogs.LatLon.dialog-enter-latlon-coordinates": ""
"renderer.components.MapFilter.Toolbar.exportButton": "Exportar",
"renderer.components.MapFilter.Toolbar.mapTabLabel": "Mapa",
"renderer.components.MapFilter.Toolbar.mediaTabLabel": "Fotos",
"renderer.components.MapFilter.Toolbar.reportTabLabel": "Informe",
"renderer.components.SyncView.Searching.searchingHint": "Asegurar que los equipos están encendidos y conectados a la misma red de wifi",
"renderer.components.SyncView.Searching.searchingTitle": "Buscando…",
"renderer.components.SyncView.SyncAppBar.newSyncfile": "Crear nuevo archivo de sincronización",
"renderer.components.SyncView.SyncAppBar.selectSyncfile": "Sincronizar con archivo",
"renderer.components.SyncView.SyncAppBar.subtitle": "por wifi",
"renderer.components.SyncView.SyncAppBar.title": "Equipo disponibles",
"renderer.components.SyncView.SyncButton.complete": "Completo",
"renderer.components.SyncView.SyncButton.retry": "Reintentar",
"renderer.components.SyncView.SyncButton.starting": "Iniciando…",
"renderer.components.SyncView.SyncButton.sync": "Sincronizar",
"renderer.components.SyncView.SyncTarget.database": "Datos: {sofar} / {total}",
"renderer.components.SyncView.SyncTarget.errorMsg": "Error de sicronización",
"renderer.components.SyncView.SyncTarget.lastSync": "Ultima sincronización",
"renderer.components.SyncView.SyncTarget.media": "Fotos: {sofar} / {total}",
"renderer.components.dialogs.LatLon.button-submit": "Ir",
"renderer.components.dialogs.LatLon.dialog-enter-latlon-coordinates": "Ingresar coordenadas"
}
3 changes: 3 additions & 0 deletions translations/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
"renderer.components.MapFilter.MapExportDialog.title": "",
"renderer.components.MapFilter.MapExportDialog.titleLabel": "",
"renderer.components.MapFilter.Toolbar.exportButton": "",
"renderer.components.MapFilter.Toolbar.mapTabLabel": "",
"renderer.components.MapFilter.Toolbar.mediaTabLabel": "",
"renderer.components.MapFilter.Toolbar.reportTabLabel": "",
"renderer.components.SyncView.Searching.searchingHint": "",
"renderer.components.SyncView.Searching.searchingTitle": "",
"renderer.components.SyncView.SyncAppBar.newSyncfile": "",
Expand Down

0 comments on commit 3254bd0

Please sign in to comment.