Merge pull request #119 from mikecao/dev

Localization fixes
This commit is contained in:
Mike Cao 2020-09-08 03:36:12 -07:00 committed by GitHub
commit deb54bbb2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 272 additions and 9 deletions

View File

@ -1,6 +1,7 @@
import React from 'react';
import classNames from 'classnames';
import styles from './Table.module.css';
import { FormattedMessage } from 'react-intl';
export default function Table({ columns, rows, empty }) {
if (empty && rows.length === 0) {
@ -21,6 +22,11 @@ export default function Table({ columns, rows, empty }) {
))}
</div>
<div className={styles.body}>
{rows.length === 0 && (
<div className={styles.empty}>
<FormattedMessage id="message.no-data-available" defaultMessage="No data available." />
</div>
)}
{rows.map((row, rowIndex) => (
<div className={classNames(styles.row, 'row')} key={rowIndex}>
{columns.map(({ key, render, className, style, cell }) => (

View File

@ -19,8 +19,7 @@
flex-direction: column;
}
.body:empty:before {
content: 'No data available';
.empty {
color: var(--gray500);
position: absolute;
top: 50%;

View File

@ -151,7 +151,7 @@ export default function BarChart({
updateChart();
}
}
}, [datasets, unit, animationDuration]);
}, [datasets, unit, animationDuration, locale]);
return (
<>

View File

@ -87,6 +87,14 @@ export default function MetricsTable({
</div>
</div>
<div className={styles.body}>
{data?.length === 0 && (
<div className={styles.empty}>
<FormattedMessage
id="message.no-data-available"
defaultMessage="No data available."
/>
</div>
)}
{limit
? rankings.map(row => getRow(row))
: data?.length > 0 && (

View File

@ -95,8 +95,7 @@
overflow: hidden;
}
.body:empty:before {
content: 'No data available';
.empty {
color: var(--gray500);
position: absolute;
top: 50%;

View File

@ -12,7 +12,15 @@ export default function PageviewsChart({ websiteId, data, unit, records, classNa
} = chart;
datasets[0].data = data.uniques;
datasets[0].label = intl.formatMessage({
id: 'metrics.unique-visitors',
defaultMessage: 'Unique visitors',
});
datasets[1].data = data.pageviews;
datasets[1].label = intl.formatMessage({
id: 'metrics.page-views',
defaultMessage: 'Page views',
});
chart.update();
};

View File

@ -47,7 +47,7 @@
"header.nav.settings": {
"defaultMessage": "Settings"
},
"label.adminsitrator": {
"label.administrator": {
"defaultMessage": "Administrator"
},
"label.confirm-password": {
@ -125,6 +125,9 @@
"message.incorrect-username-password": {
"defaultMessage": "Incorrect username/password."
},
"message.no-data-available": {
"defaultMessage": "No data available."
},
"message.save-success": {
"defaultMessage": "Saved successfully."
},

236
lang/nl-NL.json Normal file
View File

@ -0,0 +1,236 @@
{
"active-users.message": {
"defaultMessage": "{x} actieve {x, plural, one {bezoeker} other {bezoekers}}"
},
"button.add-account": {
"defaultMessage": "Account toevoegen"
},
"button.add-website": {
"defaultMessage": "Website toevoegen"
},
"button.back": {
"defaultMessage": "Terug"
},
"button.cancel": {
"defaultMessage": "Annuleren"
},
"button.change-password": {
"defaultMessage": "Wachtwoord wijzigen"
},
"button.copy-to-clipboard": {
"defaultMessage": "Kopiëer naar klembord"
},
"button.delete": {
"defaultMessage": "Verwijderen"
},
"button.edit": {
"defaultMessage": "Bewerken"
},
"button.login": {
"defaultMessage": "Inloggen"
},
"button.more": {
"defaultMessage": "Toon meer"
},
"button.save": {
"defaultMessage": "Opslaan"
},
"button.view-details": {
"defaultMessage": "Meer details"
},
"footer.powered-by": {
"defaultMessage": "mogelijk gemaakt door"
},
"header.nav.dashboard": {
"defaultMessage": "Dashboard"
},
"header.nav.settings": {
"defaultMessage": "Instellingen"
},
"label.administrator": {
"defaultMessage": "Administrator"
},
"label.confirm-password": {
"defaultMessage": "Wachtwoord bevestigen"
},
"label.current-password": {
"defaultMessage": "Huidig wachtwoord"
},
"label.domain": {
"defaultMessage": "Domein"
},
"label.enable-share-url": {
"defaultMessage": "Sta delen via openbare URL toe"
},
"label.invalid": {
"defaultMessage": "Ongeldig"
},
"label.invalid-domain": {
"defaultMessage": "Ongeldig domein"
},
"label.last-days": {
"defaultMessage": "Laatste {x} dagen"
},
"label.last-hours": {
"defaultMessage": "Laatste {x} uur"
},
"label.logged-in-as": {
"defaultMessage": "Ingelogd als {username}"
},
"label.logout": {
"defaultMessage": "Uitloggen"
},
"label.name": {
"defaultMessage": "Naam"
},
"label.new-password": {
"defaultMessage": "Nieuw wachtwoord"
},
"label.password": {
"defaultMessage": "Wachtwoord"
},
"label.passwords-dont-match": {
"defaultMessage": "Wachtwoorden komen niet overeen"
},
"label.required": {
"defaultMessage": "Verplicht"
},
"label.this-month": {
"defaultMessage": "Deze maand"
},
"label.this-week": {
"defaultMessage": "Deze week"
},
"label.this-year": {
"defaultMessage": "Dit jaar"
},
"label.today": {
"defaultMessage": "Vandaag"
},
"label.username": {
"defaultMessage": "Gebruikersnaam"
},
"message.confirm-delete": {
"defaultMessage": "Weet je zeker dat je {target} wilt verwijderen?"
},
"message.copied": {
"defaultMessage": "Gekopiëerd!"
},
"message.delete-warning": {
"defaultMessage": "Alle verwante gegezens zullen ook verwijderd worden."
},
"message.failure": {
"defaultMessage": "Er is iets misgegaan."
},
"message.incorrect-username-password": {
"defaultMessage": "Incorrecte gebruikersnaam/wachtwoord."
},
"message.save-success": {
"defaultMessage": "Opslaan succesvol."
},
"message.share-url": {
"defaultMessage": "Met deze URL kan {target} openbaar gedeeld worden."
},
"message.track-stats": {
"defaultMessage": "Om statistieken voor {target} bij te houden, plaats je de volgende code in het {head} gedeelte van je website."
},
"message.type-delete": {
"defaultMessage": "Type {delete} in onderstaande veld om dit te bevestigen."
},
"metrics.actions": {
"defaultMessage": "Acties"
},
"metrics.average-visit-time": {
"defaultMessage": "Gemiddelde bezoektijd"
},
"metrics.bounce-rate": {
"defaultMessage": "Bouncepercentage"
},
"metrics.browsers": {
"defaultMessage": "Browsers"
},
"metrics.countries": {
"defaultMessage": "Landen"
},
"metrics.devices": {
"defaultMessage": "Apparaten"
},
"metrics.events": {
"defaultMessage": "Gebeurtenissen"
},
"metrics.filter.combined": {
"defaultMessage": "Gecombineerd"
},
"metrics.filter.domain-only": {
"defaultMessage": "Alleen domein"
},
"metrics.filter.raw": {
"defaultMessage": "Ruw"
},
"metrics.operating-system": {
"defaultMessage": "Besturingssystem"
},
"metrics.page-views": {
"defaultMessage": "Paginaweergaven"
},
"metrics.pages": {
"defaultMessage": "Pagina's"
},
"metrics.referrers": {
"defaultMessage": "Verwijzers"
},
"metrics.unique-visitors": {
"defaultMessage": "Unieke bezoekers"
},
"metrics.views": {
"defaultMessage": "Weergaven"
},
"metrics.visitors": {
"defaultMessage": "Bezoekers"
},
"placeholder.message.go-to-settings": {
"defaultMessage": "Naar instellingen"
},
"placeholder.message.no-websites-configured": {
"defaultMessage": "Je hebt geen websites ingesteld."
},
"settings.accounts": {
"defaultMessage": "Accounts"
},
"settings.profile": {
"defaultMessage": "Profiel"
},
"settings.websites": {
"defaultMessage": "Websites"
},
"title.add-account": {
"defaultMessage": "Account toevoegen"
},
"title.add-website": {
"defaultMessage": "Website toevoegen"
},
"title.delete-account": {
"defaultMessage": "Account verwijderen"
},
"title.delete-website": {
"defaultMessage": "Website verwijderen"
},
"title.edit-account": {
"defaultMessage": "Account bewerken"
},
"title.edit-website": {
"defaultMessage": "Website bewerken"
},
"title.share-url": {
"defaultMessage": "URL delen"
},
"title.tracking-code": {
"defaultMessage": "Tracking code"
},
"tooltip.get-share-url": {
"defaultMessage": "Openbare URL"
},
"tooltip.get-tracking-code": {
"defaultMessage": "Tracking code"
}
}

View File

@ -47,7 +47,7 @@
"header.nav.settings": {
"defaultMessage": "设置"
},
"label.adminsitrator": {
"label.administrator": {
"defaultMessage": "管理员"
},
"label.confirm-password": {

View File

@ -1,20 +1,24 @@
import enMessages from 'lang-compiled/en.json';
import nlMessages from 'lang-compiled/nl-NL.json';
import zhCNMessages from 'lang-compiled/zh-CN.json';
import { format } from 'date-fns';
import { enUS, zhCN } from 'date-fns/locale';
import { enUS, nl, zhCN } from 'date-fns/locale';
export const messages = {
en: enMessages,
'nl-NL': nlMessages,
'zh-CN': zhCNMessages,
};
export const dateLocales = {
en: enUS,
'nl-NL': nl,
'zh-CN': zhCN,
};
export const menuOptions = [
{ label: 'English', value: 'en', display: 'EN' },
{ label: 'Nederlands', value: 'nl-NL', display: 'NL' },
{ label: '中文 (Chinese Simplified)', value: 'zh-CN', display: '中文' },
];

View File

@ -1,6 +1,6 @@
{
"name": "umami",
"version": "0.24.0",
"version": "0.25.0",
"description": "A simple, fast, website analytics alternative to Google Analytics. ",
"author": "Mike Cao <mike@mikecao.com>",
"license": "MIT",