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!

Country names should respect the active locale

Blue Mouse059307497f5f
diff --git a/web/app/pages/Project/View/ViewProject.helpers.tsx b/web/app/pages/Project/View/ViewProject.helpers.tsx
index 151736ef3..993b0707c 100644
--- a/web/app/pages/Project/View/ViewProject.helpers.tsx
+++ b/web/app/pages/Project/View/ViewProject.helpers.tsx
@@ -1649,6 +1649,7 @@ const getSettingsFunnels = (
funnel: AnalyticsFunnel[],
totalPageviews: number,
t: typeof i18next.t,
+ language: string,
): ChartOptions => {
const values = _map(funnel, (step) => {
if (_startsWith(step.value, '/')) {
@@ -1844,7 +1845,7 @@ const getSettingsFunnels = (
step.events > 0
? Math.round((count / step.events) * 100)
: 0
- const safeName = escapeHtml(countries.getName(cc, 'en') || cc)
+ const safeName = escapeHtml(countries.getName(cc, language) || cc)
const safeCC = encodeURIComponent(cc.toLowerCase())
return `
<div class='flex items-center justify-between gap-2 mt-1'>
diff --git a/web/app/pages/Project/tabs/Funnels/FunnelChart.tsx b/web/app/pages/Project/tabs/Funnels/FunnelChart.tsx
index 95485563d..8fd04af21 100644
--- a/web/app/pages/Project/tabs/Funnels/FunnelChart.tsx
+++ b/web/app/pages/Project/tabs/Funnels/FunnelChart.tsx
@@ -1,5 +1,6 @@
import { ChartOptions } from 'billboard.js'
import React, { useMemo } from 'react'
+import { useTranslation } from 'react-i18next'
import { AnalyticsFunnel } from '~/lib/models/Project'
@@ -19,9 +20,11 @@ export const FunnelChart = ({
t,
className,
}: FunnelChartProps) => {
+ const { i18n } = useTranslation()
+
const options: ChartOptions = useMemo(() => {
- return getSettingsFunnels(funnel, totalPageviews, t)
- }, [funnel, totalPageviews, t])
+ return getSettingsFunnels(funnel, totalPageviews, t, i18n.language)
+ }, [funnel, totalPageviews, t, i18n.language])
const dataNames = useMemo(
() => ({
@@ -32,8 +35,8 @@ export const FunnelChart = ({
)
const deps = useMemo(
- () => [funnel, totalPageviews, t],
- [funnel, totalPageviews, t],
+ () => [funnel, totalPageviews, t, i18n.language],
+ [funnel, totalPageviews, t, i18n.language],
)
return (