- Średnia liczba nowych zakażeń przez ostatnie 7 dni:
+ {t('averageNewCasesOverSevenDays')}
{Math.round(newOrOld('the_average'))} {percentageDifference('the_average')}
{updateWarning('the_average')}
@@ -47,25 +49,25 @@ function DoomBar() {
-
-
Regionalny podział na strefy
+
+ {t('greenRealmRules')}
- Cała polska strefą żółtą, wybrane powiaty strefą czerwoną
+ {t('yellowRealmRules')}
- Cała polska strefą czerwoną
+ {t('redRealmRules')}
- Bezpiecznik/Faza odpowiedzialności
+ {t('violetRealmRules')}
- Kwarantanna narodowa
+ {t('blackRealmRules')}
-
Więcej informacji o etapach zasad bezpieczeństwa:
-
{}Kancelaria Premiera
+
{t('moreInfoAboutRealms')}
+
{}{t('PMChancellery')}
diff --git a/src/components/statistics/Landing.js b/src/components/statistics/Landing.js
index 0d2b6f04..5fa04a19 100644
--- a/src/components/statistics/Landing.js
+++ b/src/components/statistics/Landing.js
@@ -7,8 +7,10 @@ import { FaTwitterSquare } from 'react-icons/fa'
import DoomBar from './DoomBar'
import Vaccines from './Vaccines'
import Charts from './Charts'
+import { useTranslation } from 'react-i18next'
function Landing() {
+ const { t } = useTranslation()
useEffect(() => {
ReactGA.pageview(window.location.pathname + window.location.search)
})
@@ -18,30 +20,30 @@ function Landing() {
-
Zachorowania
+ {t('cases')}
- Ostatnia aktualizacja: {lastUpdateDate.lastCases}
+ {t('lastUpdate')} {lastUpdateDate.lastCases}
- Nowe zakażenia:
+ {t('newCases')}
{insertThinSpace(newOrOld('new_cases_today'))}
{updateWarning('new_cases_today')}
{percentageDifference('new_cases_today')}
- Aktywne przypadki:
+ {t('activeCases')}
{insertThinSpace(newOrOld('active_cases'))}
{updateWarning('active_cases')}
{percentageDifference('active_cases')}
- Nowe zgony:
+ {t('newDeaths')}
{insertThinSpace(newOrOld('dead_all_today'))}
{updateWarning('dead_all_today')}
{percentageDifference('dead_all_today')}
@@ -54,18 +56,18 @@ function Landing() {
- Liczba testów:
+ {t('numberOfTests')}
{newOrOld('tests_done_today')}
- {newOrOld('percent_positive')} pozytywnych
+ {t('numberOfTests', {number: newOrOld('percent_positive')})}
{updateWarning('tests_done_today')}
- Zajęte respiratory:
+ {t('takenRespirators')}
{insertThinSpace(newOrOld('occupied_respirator_count'))}/{insertThinSpace(newOrOld('respirator_count'))}
- Zajęte łóżka:
+ {t('takenBeds')}
{insertThinSpace(newOrOld('occupied_bed_count'))}/{insertThinSpace(newOrOld('bed_count'))}
- Zgony Łącznie:
+ {t('allDeaths')}
{insertThinSpace(newOrOld('dead_global'))}
{updateWarning('dead_global')}
@@ -94,7 +96,7 @@ function Landing() {
- Dane pobierane z {}MZ_GOV_PL
+ {t('dataFrom')} {}MZ_GOV_PL
diff --git a/src/components/statistics/Vaccines.js b/src/components/statistics/Vaccines.js
index 4a0e04da..b58b66d6 100644
--- a/src/components/statistics/Vaccines.js
+++ b/src/components/statistics/Vaccines.js
@@ -2,10 +2,12 @@ import React, { useState, useEffect } from 'react'
import axios from 'axios'
import { Jumbotron, Container, Row, Col, ProgressBar } from 'react-bootstrap'
import { insertThinSpace } from '../helpers'
+import { useTranslation } from 'react-i18next'
const adultPopulation = 32_495_000
function Vaccines() {
+ const { t } = useTranslation()
const [data, setData] = useState(null)
useEffect(() => {
@@ -24,33 +26,33 @@ function Vaccines() {
-
Szczepienia
+ {t('vaccinations')}
- Ostatnia aktualizacja: {data.DATA_SHOW}
+ {t('lastUpdate')} {data.DATA_SHOW}
- Szczepienia ogółem:
+ {t('allVaxinations')}
{insertThinSpace(data.SZCZEPIENIA_SUMA.toString())}
- Drugie dawki ogółem:
+ {t('allSecondDoses')}
{insertThinSpace(data.DAWKA_2_SUMA.toString())}
- Szczepienia w ciągu ostatniej doby:
+ {t('lastDayVaccinations')}
{insertThinSpace(data.SZCZEPIENIA_DZIENNIE.toString())}
- Poziom zaszczepienia populacji Polski
+ {t('levelOfVaxxinationInPoland')}
@@ -66,10 +68,10 @@ function Vaccines() {
- Kolor zielony - część populacji zaszczepiona pierwszą oraz drugą dawką (tej wartości dotyczy procent)
+ {t('greenColour')} - {t('greenColourExplanation')}
- Kolor żółty - część populacji, która otrzymała tylko pierwszą dawkę
+ {t('yellowColour')} - {t('yellowColourExplanation')}
diff --git a/src/i18n.js b/src/i18n.js
new file mode 100644
index 00000000..ace8332f
--- /dev/null
+++ b/src/i18n.js
@@ -0,0 +1,29 @@
+import i18n from 'i18next'
+import { initReactI18next } from 'react-i18next'
+import LanguageDetector from 'i18next-browser-languagedetector'
+
+import translationEN from './locales/en.json'
+import translationPL from './locales/pl.json'
+
+const resources = {
+ en: {
+ translation: translationEN,
+ },
+ pl: {
+ translation: translationPL,
+ },
+}
+
+i18n
+ .use(LanguageDetector)
+ .use(initReactI18next)
+ .init({
+ resources,
+ fallbackLng: 'en',
+ keySeparator: true,
+ interpolation: {
+ escapeValue: false, // react already safes from xss
+ },
+ })
+
+export default i18n
diff --git a/src/index.js b/src/index.js
index bde11621..96976610 100644
--- a/src/index.js
+++ b/src/index.js
@@ -4,7 +4,7 @@ import ReactDOM from 'react-dom'
import './index.scss'
import Root from './components/Root'
import reportWebVitals from './reportWebVitals'
-
+import './i18n'
ReactGA.initialize('G-5J0BQEKJX3')
ReactDOM.render(
diff --git a/src/locales/en.json b/src/locales/en.json
new file mode 100644
index 00000000..77482172
--- /dev/null
+++ b/src/locales/en.json
@@ -0,0 +1,41 @@
+{
+ "vaccinations": "Vaccination",
+ "lastUpdate": "Last update:",
+ "allVaxinations": "All administered doses",
+ "allSecondDoses": "Second doses",
+ "lastDayVaccinations": "Doses administered during last day",
+ "levelOfVaxxinationInPoland": "Pecentage of vaccinated people in Poland",
+ "expectationIn21Days": "{{current}}% (vaccinated with only first dose {{expected}}%)",
+ "greenColour": "Green colour",
+ "greenColourExplanation": "Percentage of population vacciated with both doses",
+ "yellowColour": "Yellow colour",
+ "yellowColourExplanation": "Percentage of population vacciated with only first dose",
+ "cases": "Cases",
+ "newCases": "New cases",
+ "activeCases": "Active cases",
+ "newDeaths": "New deaths",
+ "numberOfTests": "Number of tests conducted",
+ "positiveTestsPercentage": "{{number}} positive",
+ "allDeaths": "Deaths altogether",
+ "takenRespirators": "Currently taken respirators",
+ "takenBeds": "Currently taken beds",
+ "dataFrom": "Data from:",
+ "colourfulRealmsRules": "Stages of security rules",
+ "averageNewCasesOverSevenDays": "Average number of new cases in the last 7 days:",
+ "greenRealmRules": "Regional zone assignment",
+ "yellowRealmRules": "Eniterty of Poland is yellow zone - some region's are red zone",
+ "redRealmRules": "Eniterty of Poland is red zone",
+ "violetRealmRules": "Security fuse/Phase of responsibilty",
+ "blackRealmRules": "National quarantine 🇵🇱",
+ "moreInfoAboutRealms": "More info on:",
+ "PMChancellery": "The Chancellery of the Prime Minister of Poland",
+ "chartTitle": "New cases chart",
+ "dataRange": "Range of data presented",
+ "allData": "All data",
+ "lastYear": "Last year",
+ "lastThreeMonths": "Last quarter",
+ "lastMonth": "Last month",
+ "lastWeek": "Last week",
+ "chartLabelNewCases": "New cases count",
+ "chartLabelRollingCases": "Rolling average of last 7 days"
+}
diff --git a/src/locales/pl.json b/src/locales/pl.json
new file mode 100644
index 00000000..717a21a3
--- /dev/null
+++ b/src/locales/pl.json
@@ -0,0 +1,41 @@
+{
+ "vaccinations": "Szczepienia",
+ "lastUpdate": "Ostatnia aktualizacja:",
+ "allVaxinations": "Szczepienia ogółem",
+ "allSecondDoses": "Drugie dawki ogółem",
+ "lastDayVaccinations": "Szczepienia w ciągu ostatniej doby",
+ "levelOfVaxxinationInPoland": "Poziom zaszczepienia populacji Polski",
+ "expectationIn21Days": "{{current}}% (zaszczepionych tylko pierwszą dawką {{expected}}%)",
+ "greenColour": "Kolor zielony",
+ "greenColourExplanation": "część populacji zaszczepiona pierwszą oraz drugą dawką (tej wartości dotyczy procent)",
+ "yellowColour": "Kolor żółty",
+ "yellowColourExplanation": "część populacji, która otrzymała tylko pierwszą dawkę",
+ "cases": "Zachorowania",
+ "newCases": "Nowe zakażenia",
+ "activeCases": "Aktywne przypadki",
+ "newDeaths": "Nowe zgony",
+ "numberOfTests": "Liczba testów",
+ "positiveTestsPercentage": "{{number}} pozytywnych",
+ "allDeaths": "Zgony łącznie",
+ "takenRespirators": "Zajęte respiratory",
+ "takenBeds": "Zajęte łóżka",
+ "dataFrom": "Dane pobierane z",
+ "colourfulRealmsRules": "Etapy zasad bezpieczeństwa",
+ "averageNewCasesOverSevenDays": "Średnia liczba nowych zakażeń przez ostatnie 7 dni:",
+ "greenRealmRules": "Regionalny podział na strefy",
+ "yellowRealmRules": "Cała polska strefą żółtą, wybrane powiaty strefą czerwoną",
+ "redRealmRules": "Cała polska strefą czerwoną",
+ "violetRealmRules": "Bezpiecznik/Faza odpowiedzialności",
+ "blackRealmRules": "Kwarantanna narodowa 🇵🇱",
+ "moreInfoAboutRealms": "Więcej informacji o etapach zasad bezpieczeństwa:",
+ "PMChancellery": "Kancelaria Premiera",
+ "chartTitle": "Wykres nowych zakażeń",
+ "dataRange": "Zakres pokazywanych danych",
+ "allData": "Wszystkie dane",
+ "lastYear": "Ostatni rok",
+ "lastThreeMonths": "Ostatni kwartał",
+ "lastMonth": "Ostatni miesiąc",
+ "lastWeek": "Ostatni tydzień",
+ "chartLabelNewCases": "Liczba nowych zakażeń",
+ "chartLabelRollingCases": "Średnia liczba zakażeń z 7 dni"
+}