Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Integrated translations into Project page

Blue Moused87834ea4939
diff --git a/src/i18n/en.json b/src/i18n/en.json
index f2024ddc1..0994a9dee 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -13,7 +13,9 @@
"continue": "Continue",
"error": "Error",
"close": "Close",
- "gotIt": "Got it"
+ "cancel": "Cancel",
+ "gotIt": "Got it",
+ "settings": "Settings"
},
"main": {
"slogan": "A <span>powerful</span> analytics platform that respects <span>user privacy<span>",
@@ -169,6 +171,7 @@
"active": "Active",
"disabled": "Disabled",
"pageviews": "Pageviews",
+ "unique": "Unique views",
"createdAt": "Created at",
"inc": "Increased by",
"dec": "Descreased by"
@@ -206,6 +209,62 @@
},
"contents": "Contents"
},
+ "project": {
+ "noExist": "The selected project does not exist",
+ "exportImg": "Export as image",
+ "noEvTitle": "No events yet",
+ "noEvContent": "No events have been captured for the specified timeframe.\nIf you haven't tracked any events yet, you can check out our <link>Docs</link> to easily integrate tracking into your app.",
+ "mapping": {
+ "cc": "Country",
+ "pg": "Page",
+ "lc": "Locale",
+ "ref": "Referrer",
+ "dv": "Device type",
+ "br": "Browser",
+ "os": "OS name",
+ "lt": "Load time"
+ },
+ "overview": "Overview",
+ "weeklyStats": "Weekly stats",
+ "statsFor": "Stats for",
+ "event": "Event",
+ "quantity": "Quantity",
+ "conversion": "Conversion",
+ "customEv": "Custom events",
+ "noParamData": "No data for this parameter yet",
+ "prev": "Previous",
+ "next": "Next",
+ "unique": "Unique visitors",
+ "total": "Total page views",
+ "today": "Today",
+ "lastXDays": "Last {{amount}} days",
+ "lastXWeeks": "Last {{amount}} weeks",
+ "lastXMonths": "Last {{amount}} months",
+ "hour": "Hour",
+ "day": "Day",
+ "week": "Week",
+ "month": "Month",
+ "settings": {
+ "verify": "Please, verify your email address first",
+ "updated": "The project's settings were updated",
+ "created": "The project has been created",
+ "pxCharsError": "Project name cannot be longer than {{amount}} characters.",
+ "oxCharsError": "A list of allowed origins has to be smaller than {{amount}} symbols.",
+ "noNameError": "Please enter a project name.",
+ "create": "Create a new project",
+ "settings": "Settings of",
+ "name": "Project name",
+ "pid": "Project ID",
+ "origins": "Allowed origins",
+ "originsHint": "A list of allowed origins (domains) which are allowed to use script with your ProjectID, separated by commas.\nLeave it empty to allow all origins (default setting).\nExample: cornell.edu, app.example.com, ssu.gov.ua",
+ "enabled": "Is project enabled",
+ "enabledHint": "Disabled projects will not count any newly incoming events or pageviews.\nYou will still be able to access the project's analytics in dashboard.",
+ "createHint": "*you will be able to set up your project more thoroughly after you have created it",
+ "delete": "Delete project",
+ "qDelete": "Delete the project?",
+ "deleteHint": "By pressing 'Delete project' you understand, that this action is irreversible.\nThe project and all the data related to it will be deleted from our servers."
+ }
+ },
"titles": {
"recovery": "Account recovery",
"signin": "Sign in",
diff --git a/src/pages/Project/Settings/ProjectSettings.jsx b/src/pages/Project/Settings/ProjectSettings.jsx
index 303e3f034..87de57ebf 100644
--- a/src/pages/Project/Settings/ProjectSettings.jsx
+++ b/src/pages/Project/Settings/ProjectSettings.jsx
@@ -1,5 +1,6 @@
import React, { useState, useEffect, useMemo, memo } from 'react'
import { useLocation, useHistory, useParams } from 'react-router-dom'
+import { useTranslation, Trans } from 'react-i18next'
import _isEmpty from 'lodash/isEmpty'
import _size from 'lodash/size'
import _replace from 'lodash/replace'
@@ -18,10 +19,14 @@ import Modal from 'ui/Modal'
import { nanoid } from 'utils/random'
import routes from 'routes'
+const MAX_NAME_LENGTH = 50
+const MAX_ORIGINS_LENGTH = 300
+
const ProjectSettings = ({
updateProjectFailed, createNewProjectFailed, newProject, projectDeleted, deleteProjectFailed,
loadProjects, isLoading, projects, showError, removeProject, user,
}) => {
+ const { t } = useTranslation('common')
const { pathname } = useLocation()
const { id } = useParams()
const project = useMemo(() => _find(projects, p => p.id === id) || {}, [projects, id])
@@ -41,13 +46,13 @@ const ProjectSettings = ({
useEffect(() => {
if (!user.isActive) {
- showError('Please, verify your email address first')
+ showError(t('project.settings.verify'))
history.push(routes.dashboard)
}
if (!isLoading && isSettings && !projectDeleting) {
if (_isEmpty(project)) {
- showError('The selected project does not exist')
+ showError(t('project.noExist'))
history.push(routes.dashboard)
} else {
setForm({
@@ -69,10 +74,10 @@ const ProjectSettings = ({
if (isSettings) {
await updateProject(id, formalisedData)
- newProject('The project\'s settings were updated')
+ newProject(t('project.settings.updated'))
} else {
await createProject(formalisedData)
- newProject('The project has been created')
+ newProject(t('project.settings.created'))
}
loadProjects()
@@ -134,15 +139,15 @@ const ProjectSettings = ({
const allErrors = {}
if (_isEmpty(form.name)) {
- allErrors.name = 'Please enter a project name.'
+ allErrors.name = t('project.settings.noNameError')
}
- if (_size(form.name) > 50) {
- allErrors.name = 'Project name cannot be longer than 50 characters.'
+ if (_size(form.name) > MAX_NAME_LENGTH) {
+ allErrors.name = t('project.settings.pxCharsError', { amount: MAX_NAME_LENGTH })
}
- if (_size(form.origins) > 300) {
- allErrors.origins = 'A list of allowed origins has to be smaller than 300 symbols'
+ if (_size(form.origins) > MAX_ORIGINS_LENGTH) {
+ allErrors.origins = t('project.settings.oxCharsError', { amount: MAX_ORIGINS_LENGTH })
}
const valid = Object.keys(allErrors).length === 0
@@ -155,7 +160,7 @@ const ProjectSettings = ({
history.push(isSettings ? _replace(routes.project, ':id', id) : routes.dashboard)
}
- const title = isSettings ? `${form.name} settings` : 'Create a new project'
+ const title = isSettings ? `${t('project.settings.settings')} ${form.name}` : t('project.settings.create')
return (
<Title title={title}>
@@ -168,7 +173,7 @@ const ProjectSettings = ({
name='name'
id='name'
type='text'
- label='Project name'
+ label={t('project.settings.name')}
value={form.name}
placeholder='My awesome project'
className='mt-4'
@@ -179,7 +184,7 @@ const ProjectSettings = ({
name='id'
id='id'
type='text'
- label='Project ID'
+ label={t('project.settings.pid')}
value={form.id}
className='mt-4'
onChange={handleInput}
@@ -192,8 +197,8 @@ const ProjectSettings = ({
name='origins'
id='origins'
type='text'
- label='Allowed origins'
- hint={'A list of allowed origins (domains) which are allowed to use script with your ProjectID, separated by commas.\nLeave it empty to allow all origins (default setting).\nExample: cornell.edu, app.example.com, ssu.gov.ua'}
+ label={t('project.settings.origins')}
+ hint={t('project.settings.originsHint')}
value={form.origins}
className='mt-4'
onChange={handleInput}
@@ -205,25 +210,27 @@ const ProjectSettings = ({
name='active'
id='active'
className='mt-4'
- label='Is project enabled'
- hint={'Disabled projects will not count any newly incoming events or pageviews.\nYou will still be able to access the project\'s analytics in dashboard.'}
+ label={t('project.settings.enabled')}
+ hint={t('project.settings.enabledHint')}
/>
</>
) : (
- <p className='text-gray-500 italic mt-2 text-sm'>*you will be able to set up your project more thoroughly after you have created it</p>
+ <p className='text-gray-500 italic mt-2 text-sm'>
+ {t('project.settings.createHint')}
+ </p>
)}
<div className='flex justify-between mt-4'>
<div>
<Button className='mr-2' onClick={onCancel} secondary regular>
- Cancel
- </Button>
+ {t('common.cancel')}
+ </Button>
<Button type='submit' loading={projectSaving} primary regular>
- Save
- </Button>
+ {t('common.save')}
+ </Button>
</div>
{isSettings && (
<Button onClick={() => !projectDeleting && setShowDelete(true)} loading={projectDeleting} danger large>
- Delete project
+ {t('project.settings.delete')}
</Button>
)}
</div>
@@ -232,10 +239,10 @@ const ProjectSettings = ({
<Modal
onClose={() => setShowDelete(false)}
onSubmit={onDelete}
- submitText='Delete project'
- closeText='Close'
- title={`Delete ${form.name || 'the project'}?`}
- message={'By pressing \'Delete project\' you understand, that this action is irreversible.\nThe project and all the data related to it will be deleted from our servers.'}
+ submitText={t('project.settings.delete')}
+ closeText={t('common.close')}
+ title={t('project.settings.qDelete')}
+ message={t('project.settings.deleteHint')}
submitType='danger'
type='error'
isOpened={showDelete}
diff --git a/src/pages/Project/View/Panels.jsx b/src/pages/Project/View/Panels.jsx
index 2f2d50884..2dd93bb69 100644
--- a/src/pages/Project/View/Panels.jsx
+++ b/src/pages/Project/View/Panels.jsx
@@ -35,7 +35,7 @@ PanelContainer.propTypes = {
}
const Overview = ({
- overall, chartData, activePeriod,
+ overall, chartData, activePeriod, t,
}) => {
const pageviewsDidGrowUp = overall.percChange >= 0
const uniqueDidGrowUp = overall.percChangeUnique >= 0
@@ -43,23 +43,29 @@ const Overview = ({
const uniques = _sum(chartData?.uniques) || 0
return (
- <PanelContainer name='Overview'>
+ <PanelContainer name={t('project.overview')}>
{!_isEmpty(chartData) && (
<>
<p className='text-lg font-semibold'>
- Stats for
+ {t('project.statsFor')}
<span className='lowercase'> {activePeriod.label}</span>
</p>
<div className='flex justify-between'>
- <p className='text-lg'>Pageviews:</p>
+ <p className='text-lg'>
+ {t('dashboard.pageviews')}
+ :
+ </p>
<p className='h-5 mr-2 text-gray-900 text-xl'>
{pageviews}
</p>
</div>
<div className='flex justify-between'>
- <p className='text-lg'>Unique views:</p>
+ <p className='text-lg'>
+ {t('dashboard.unique')}
+ :
+ </p>
<p className='h-5 mr-2 text-gray-900 text-xl'>
{uniques}
</p>
@@ -68,10 +74,13 @@ const Overview = ({
</>
)}
<p className='text-lg font-semibold'>
- Weekly stats
+ {t('project.weeklyStats')}
</p>
<div className='flex justify-between'>
- <p className='text-lg'>Pageviews:</p>
+ <p className='text-lg'>
+ {t('dashboard.pageviews')}
+ :
+ </p>
<dd className='flex items-baseline'>
<p className='h-5 mr-2 text-gray-900 text-lg'>
{overall.thisWeek}
@@ -84,14 +93,14 @@ const Overview = ({
<>
<ArrowSmUpIcon className='self-center flex-shrink-0 h-4 w-4 text-green-500' />
<span className='sr-only'>
- Increased by
+ {t('dashboard.inc')}
</span>
</>
) : (
<>
<ArrowSmDownIcon className='self-center flex-shrink-0 h-4 w-4 text-red-500' />
<span className='sr-only'>
- Descreased by
+ {t('dashboard.dec')}
</span>
</>
)}
@@ -100,7 +109,10 @@ const Overview = ({
</dd>
</div>
<div className='flex justify-between'>
- <p className='text-lg'>Unique views:</p>
+ <p className='text-lg'>
+ {t('dashboard.unique')}
+ :
+ </p>
<dd className='flex items-baseline'>
<p className='h-5 mr-2 text-gray-900 text-lg'>
{overall.thisWeekUnique}
@@ -113,14 +125,14 @@ const Overview = ({
<>
<ArrowSmUpIcon className='self-center flex-shrink-0 h-4 w-4 text-green-500' />
<span className='sr-only'>
- Increased by
+ {t('dashboard.inc')}
</span>
</>
) : (
<>
<ArrowSmDownIcon className='self-center flex-shrink-0 h-4 w-4 text-red-500' />
<span className='sr-only'>
- Descreased by
+ {t('dashboard.dec')}
</span>
</>
)}
@@ -133,19 +145,19 @@ const Overview = ({
}
const CustomEvents = ({
- customs, chartData,
+ customs, chartData, t,
}) => {
const keys = _keys(customs)
const uniques = _sum(chartData.uniques)
return (
- <PanelContainer name='Custom events'>
+ <PanelContainer name={t('project.customEv')}>
<table className='table-fixed'>
<thead>
<tr>
- <th className='w-4/6 text-left text-gray-900'>Event</th>
- <th className='w-1/6 text-right text-gray-900'>Quantity&nbsp;&nbsp;</th>
- <th className='w-1/6 text-right text-gray-900'>Conversion</th>
+ <th className='w-4/6 text-left text-gray-900'>{t('project.event')}</th>
+ <th className='w-1/6 text-right text-gray-900'>{t('project.quantity')}&nbsp;&nbsp;</th>
+ <th className='w-1/6 text-right text-gray-900'>{t('project.conversion')}</th>
</tr>
</thead>
<tbody>
@@ -167,7 +179,7 @@ CustomEvents.propTypes = {
}
const Panel = ({
- name, data, rowMapper, capitalize, linkContent,
+ name, data, rowMapper, capitalize, linkContent, t,
}) => {
const [page, setPage] = useState(0)
const currentIndex = page * ENTRIES_PER_PANEL
@@ -193,7 +205,9 @@ const Panel = ({
return (
<PanelContainer name={name}>
{_isEmpty(data) ? (
- <p className='mt-1 text-base text-gray-700'>No data for this parameter yet</p>
+ <p className='mt-1 text-base text-gray-700'>
+ {t('project.noParamData')}
+ </p>
) : _map(keysToDisplay, key => {
const perc = _round(data[key] / total * 100, 2)
const rowData = _isFunction(rowMapper) ? rowMapper(key) : key
@@ -231,7 +245,9 @@ const Panel = ({
role='button'
onClick={onPrevious}
>
- &lt; Previous
+ &lt;
+ &nbsp;
+ {t('project.prev')}
</span>
<span
className={cx('text-gray-500 font-light', {
@@ -241,7 +257,9 @@ const Panel = ({
role='button'
onClick={onNext}
>
- Next &gt;
+ {t('project.next')}
+ &nbsp;
+ &gt;
</span>
</div>
</div>
diff --git a/src/pages/Project/View/ViewProject.jsx b/src/pages/Project/View/ViewProject.jsx
index b00bffbfb..31b88cb21 100644
--- a/src/pages/Project/View/ViewProject.jsx
+++ b/src/pages/Project/View/ViewProject.jsx
@@ -9,6 +9,7 @@ import countriesEn from 'i18n-iso-countries/langs/en.json'
import cx from 'classnames'
import * as d3 from 'd3'
import dayjs from 'dayjs'
+import { useTranslation, Trans } from 'react-i18next'
import _keys from 'lodash/keys'
import _map from 'lodash/map'
import _includes from 'lodash/includes'
@@ -36,21 +37,21 @@ import { getProjectData, getProject } from 'api'
countries.registerLocale(countriesEn)
-const getJSON = (chart, showTotal) => ({
+const getJSON = (chart, showTotal, t) => ({
x: _map(chart.x, el => dayjs(el).toDate()),
- 'Unique visitors': chart.uniques,
- ...(showTotal && { 'Total page views': chart.visits }),
+ [t('project.unique')]: chart.uniques,
+ ...(showTotal && { [t('project.total')]: chart.visits }),
})
-const getSettings = (chart, timeBucket, showTotal = true) => ({
+const getSettings = (chart, timeBucket, showTotal = true, t) => ({
data: {
x: 'x',
- json: getJSON(chart, showTotal),
+ json: getJSON(chart, showTotal, t),
type: area(),
xFormat: '%y-%m-%d %H:%M:%S',
colors: {
- 'Unique visitors': '#2563EB',
- 'Total page views': '#D97706',
+ [t('project.unique')]: '#2563EB',
+ [t('project.total')]: '#D97706',
}
},
axis: {
@@ -107,29 +108,34 @@ const getSettings = (chart, timeBucket, showTotal = true) => ({
bindto: '#dataChart',
})
-const typeNameMapping = {
- cc: 'Country',
- pg: 'Page',
- lc: 'Locale',
- ref: 'Referrer',
- dv: 'Device type',
- br: 'Browser',
- os: 'OS name',
+const typeNameMapping = (t) => ({
+ cc: t('project.mapping.cc'),
+ pg: t('project.mapping.pg'),
+ lc: t('project.mapping.lc'),
+ ref: t('project.mapping.ref'),
+ dv: t('project.mapping.dv'),
+ br: t('project.mapping.br'),
+ os: t('project.mapping.os'),
so: 'utm_source',
me: 'utm_medium',
ca: 'utm_campaign',
- lt: 'Load time',
-}
+ lt: t('project.mapping.lt'),
+})
-const NoEvents = () => (
+const NoEvents = ({ t }) => (
<div className='flex flex-col py-6 sm:px-6 lg:px-8 mt-5'>
<div className='max-w-7xl w-full mx-auto'>
- <h2 className='text-4xl text-center leading-tight my-3'>No events yet</h2>
+ <h2 className='text-4xl text-center leading-tight my-3'>
+ {t('project.noEvTitle')}
+ </h2>
<h2 className='text-2xl mb-8 text-center leading-snug'>
- No events have been captured for the specified timeframe.<br />
- If you haven't tracked any events yet, you can check out our&nbsp;
- <Link to={routes.docs} className='hover:underline text-blue-600'>Docs</Link>
- &nbsp;to easily integrate tracking into your app.
+ <Trans
+ t={t}
+ i18nKey='project.noEvContent'
+ components={{
+ link: <Link to={routes.docs} className='hover:underline text-blue-600' />,
+ }}
+ />
</h2>
</div>
</div>
@@ -138,15 +144,18 @@ const NoEvents = () => (
const ViewProject = ({
projects, isLoading, showError, cache, setProjectCache, projectViewPrefs, setProjectViewPrefs, user, setProject,
}) => {
+ const { t } = useTranslation('common')
+ const periodPairs = tbPeriodPairs(t)
+
const dashboardRef = useRef(null)
const { id } = useParams()
const history = useHistory()
const project = useMemo(() => _find(projects, p => p.id === id) || {}, [projects, id])
const [panelsData, setPanelsData] = useState({})
const [analyticsLoading, setAnalyticsLoading] = useState(true)
- const [period, setPeriod] = useState(projectViewPrefs[id]?.period || tbPeriodPairs[1].period)
- const [timeBucket, setTimebucket] = useState(projectViewPrefs[id]?.timeBucket || tbPeriodPairs[1].tbs[1])
- const activePeriod = useMemo(() => _find(tbPeriodPairs, p => p.period === period), [period])
+ const [period, setPeriod] = useState(projectViewPrefs[id]?.period || periodPairs[1].period)
+ const [timeBucket, setTimebucket] = useState(projectViewPrefs[id]?.timeBucket || periodPairs[1].tbs[1])
+ const activePeriod = useMemo(() => _find(periodPairs, p => p.period === period), [period])
const [showTotal, setShowTotal] = useState(false)
const [chartData, setChartData] = useState({})
const [mainChart, setMainChart] = useState(null)
@@ -154,6 +163,8 @@ const ViewProject = ({
// Because headless browser cannot do a request to the DDG API due to absense of The Same Origin Policy header
const [showIcons, setShowIcons] = useState(true)
+ const tnMapping = typeNameMapping(t)
+
const { name } = project
const loadAnalytics = async () => {
@@ -178,14 +189,14 @@ const ViewProject = ({
if (!_isEmpty(params)) {
setChartData(chart)
-
+
setPanelsData({
types: _keys(params),
data: params,
customs,
})
-
- const bbSettings = getSettings(chart, timeBucket, showTotal)
+
+ const bbSettings = getSettings(chart, timeBucket, showTotal, t)
setMainChart(bb.generate(bbSettings))
}
@@ -200,22 +211,22 @@ const ViewProject = ({
if (!isLoading && !_isEmpty(chartData) && !_isEmpty(mainChart)) {
if (showTotal) {
mainChart.load({
- json: getJSON(chartData, true),
+ json: getJSON(chartData, true, t),
})
} else {
mainChart.unload({
- ids: ['Total page views'],
+ ids: [t('project.total')],
})
}
}
- }, [isLoading, showTotal, chartData, mainChart])
+ }, [isLoading, showTotal, chartData, mainChart, t])
useEffect(() => {
loadAnalytics()
}, [project, period, timeBucket]) // eslint-disable-line
const updatePeriod = (newPeriod) => {
- const newPeriodFull = _find(tbPeriodPairs, (el) => el.period === newPeriod)
+ const newPeriodFull = _find(periodPairs, (el) => el.period === newPeriod)
let tb = timeBucket
if (_isEmpty(newPeriodFull)) return
@@ -239,7 +250,7 @@ const ViewProject = ({
.then(setProject)
.catch(console.error)
} else {
- showError('The selected project does not exist')
+ showError(t('project.noExist'))
history.push(routes.dashboard)
}
}
@@ -284,13 +295,13 @@ const ViewProject = ({
'z-10 border-indigo-500 text-indigo-600': timeBucket === tb,
})}
>
- {tb}
+ {t(`project.${tb}`)}
</button>
))}
</span>
</div>
<Dropdown
- items={tbPeriodPairs}
+ items={periodPairs}
title={activePeriod.label}
labelExtractor={pair => pair.label}
keyExtractor={pair => pair.label}
@@ -298,7 +309,7 @@ const ViewProject = ({
/>
<div className='h-full ml-3'>
<Button onClick={openSettingsHandler} className='py-2.5 px-3 md:px-4 text-sm' secondary>
- Settings
+ {t('common.settings')}
</Button>
</div>
</div>
@@ -307,14 +318,14 @@ const ViewProject = ({
analyticsLoading ? (
<Loader />
) : (
- <NoEvents />
+ <NoEvents t={t} />
)
)}
<div className={cx('flex flex-row items-center justify-center md:justify-end h-10 mt-16 md:mt-5 mb-4', { hidden: isPanelsDataEmpty })}>
<Checkbox label='Show all views' id='views' checked={showTotal} onChange={(e) => setShowTotal(e.target.checked)} />
<div className='h-full ml-3'>
<Button onClick={exportAsImageHandler} className='py-2.5 px-3 md:px-4 text-sm' secondary>
- Export as image
+ {t('project.exportImg')}
</Button>
</div>
</div>
@@ -322,12 +333,17 @@ const ViewProject = ({
<div className='h-80' id='dataChart' />
<div className='mt-5 grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3'>
{!_isEmpty(project.overall) && (
- <Overview overall={project.overall} chartData={chartData} activePeriod={activePeriod} />
- )}
+ <Overview
+ t={t}
+ overall={project.overall}
+ chartData={chartData}
+ activePeriod={activePeriod}
+ />
+ )}
{_map(panelsData.types, type => {
if (type === 'cc') {
return (
- <Panel key={type} name={typeNameMapping[type]} data={panelsData.data[type]} rowMapper={(name) => (
+ <Panel t={t} key={type} name={tnMapping[type]} data={panelsData.data[type]} rowMapper={(name) => (
<>
<Flag className='rounded-md' country={name} size={21} alt='' />
&nbsp;&nbsp;
@@ -339,13 +355,13 @@ const ViewProject = ({
if (type === 'dv') {
return (
- <Panel key={type} name={typeNameMapping[type]} data={panelsData.data[type]} capitalize />
+ <Panel t={t} key={type} name={tnMapping[type]} data={panelsData.data[type]} capitalize />
)
}
if (type === 'ref') {
return (
- <Panel key={type} name={typeNameMapping[type]} data={panelsData.data[type]} rowMapper={(name) => {
+ <Panel t={t} key={type} name={tnMapping[type]} data={panelsData.data[type]} rowMapper={(name) => {
const url = new URL(name)
return (
@@ -362,11 +378,11 @@ const ViewProject = ({
}
return (
- <Panel key={type} name={typeNameMapping[type]} data={panelsData.data[type]} />
+ <Panel t={t} key={type} name={tnMapping[type]} data={panelsData.data[type]} />
)
})}
{!_isEmpty(panelsData.customs) && (
- <CustomEvents customs={panelsData.customs} chartData={chartData} />
+ <CustomEvents t={t} customs={panelsData.customs} chartData={chartData} />
)}
</div>
</div>
diff --git a/src/redux/constants/index.js b/src/redux/constants/index.js
index 22a9260c2..eda99e221 100644
--- a/src/redux/constants/index.js
+++ b/src/redux/constants/index.js
@@ -1,30 +1,30 @@
-export const tbPeriodPairs = [{
- label: 'Today',
+export const tbPeriodPairs = (t) => [{
+ label: t('project.today'),
period: '1d',
tbs: ['hour'],
access: 'free',
}, {
- label: 'Last 7 days',
+ label: t('project.lastXDays', { amount: 7 }),
period: '7d',
tbs: ['hour', 'day'],
access: 'free',
}, {
- label: 'Last 4 weeks',
+ label: t('project.lastXWeeks', { amount: 4 }),
period: '4w',
tbs: ['day', 'week'],
access: 'free',
}, {
- label: 'Last 3 months',
+ label: t('project.lastXMonths', { amount: 3 }),
period: '3M',
tbs: ['week', 'month'],
access: 'paid',
}, {
- label: 'Last 12 months',
+ label: t('project.lastXMonths', { amount: 12 }),
period: '12M',
tbs: ['week', 'month'],
access: 'paid',
}, {
- label: 'Last 24 months',
+ label: t('project.lastXMonths', { amount: 24 }),
period: '24M',
tbs: ['month'],
access: 'paid',