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!

Use i18n

Blue Mouse1dab5b006ae5
diff --git a/web/app/pages/Onboarding/Onboarding.tsx b/web/app/pages/Onboarding/Onboarding.tsx
index d35ff7848..fd2b4d673 100644
--- a/web/app/pages/Onboarding/Onboarding.tsx
+++ b/web/app/pages/Onboarding/Onboarding.tsx
@@ -441,10 +441,26 @@ const TRACKING_TABS: {
labelKey: string
icon: React.ElementType
}[] = [
- { id: 'script', labelKey: 'Script', icon: CodeIcon },
- { id: 'npm', labelKey: 'NPM', icon: PackageIcon },
- { id: 'gtm', labelKey: 'Tag Manager', icon: TagIcon },
- { id: 'platforms', labelKey: 'Platforms', icon: SquaresFourIcon },
+ {
+ id: 'script',
+ labelKey: 'onboarding.installTracking.tabs.script',
+ icon: CodeIcon,
+ },
+ {
+ id: 'npm',
+ labelKey: 'onboarding.installTracking.tabs.npm',
+ icon: PackageIcon,
+ },
+ {
+ id: 'gtm',
+ labelKey: 'onboarding.installTracking.tabs.tagManager',
+ icon: TagIcon,
+ },
+ {
+ id: 'platforms',
+ labelKey: 'onboarding.installTracking.tabs.platforms',
+ icon: SquaresFourIcon,
+ },
]
const PLATFORM_INTEGRATIONS: {
@@ -804,7 +820,7 @@ const SetupTrackingStep = ({
className='size-4 shrink-0'
weight={isActive ? 'bold' : 'regular'}
/>
- <span className='hidden sm:inline'>{tab.labelKey}</span>
+ <span className='hidden sm:inline'>{t(tab.labelKey)}</span>
</button>
)
})}
@@ -1050,6 +1066,7 @@ const SetupTrackingStep = ({
}
const CopyableField = ({ value }: { value: string }) => {
+ const { t } = useTranslation('common')
const [copied, setCopied] = useState(false)
const handleCopy = async () => {
@@ -1058,7 +1075,7 @@ const CopyableField = ({ value }: { value: string }) => {
setCopied(true)
setTimeout(() => setCopied(false), 2000)
} catch {
- toast.error('Failed to copy')
+ toast.error(t('common.failedToCopy'))
}
}
@@ -1074,13 +1091,13 @@ const CopyableField = ({ value }: { value: string }) => {
<>
<CheckIcon className='size-4 text-emerald-500' />
<span className='text-emerald-600 dark:text-emerald-400'>
- Copied
+ {t('common.copied')}
</span>
</>
) : (
<>
<CopyIcon className='size-4' />
- Copy
+ {t('common.copy')}
</>
)}
</button>
diff --git a/web/app/ui/CodeBlock.tsx b/web/app/ui/CodeBlock.tsx
index e8365a8cd..1068acefc 100644
--- a/web/app/ui/CodeBlock.tsx
+++ b/web/app/ui/CodeBlock.tsx
@@ -1,5 +1,6 @@
import { CheckIcon, CopyIcon } from '@phosphor-icons/react'
import { useMemo, useState } from 'react'
+import { useTranslation } from 'react-i18next'
import { toast } from 'sonner'
const highlightHTML = (code: string): React.ReactNode[] => {
@@ -81,6 +82,7 @@ interface CodeBlockProps {
}
const CodeBlock = ({ code, onCopy }: CodeBlockProps) => {
+ const { t } = useTranslation('common')
const [copied, setCopied] = useState(false)
const handleCopy = async () => {
@@ -90,7 +92,7 @@ const CodeBlock = ({ code, onCopy }: CodeBlockProps) => {
onCopy?.()
setTimeout(() => setCopied(false), 2000)
} catch {
- toast.error('Failed to copy')
+ toast.error(t('common.failedToCopy'))
}
}
@@ -109,12 +111,12 @@ const CodeBlock = ({ code, onCopy }: CodeBlockProps) => {
{copied ? (
<>
<CheckIcon className='size-3.5' />
- Copied
+ {t('common.copied')}
</>
) : (
<>
<CopyIcon className='size-3.5' />
- Copy
+ {t('common.copy')}
</>
)}
</button>
diff --git a/web/public/locales/en.json b/web/public/locales/en.json
index 2b9c2e209..1ef4728e2 100644
--- a/web/public/locales/en.json
+++ b/web/public/locales/en.json
@@ -122,7 +122,9 @@
"quit": "Quit",
"enable": "Enable",
"disable": "Disable",
+ "copy": "Copy",
"copied": "Copied",
+ "failedToCopy": "Failed to copy",
"new": "New",
"all": "All",
"active": "Active",
@@ -2203,6 +2205,12 @@
"weAlsoSupport": "We also support intalling Swetrix via NPM (for React, Vue, etc.), provide Events API to send events directly to our API, and many different integrations with other services like WordPress or Google Tag Manager. <url>Learn more</url>.",
"optional": "This step is optional — you can always set up tracking later from your project settings.",
"skipForNow": "Skip for now",
+ "tabs": {
+ "script": "Script",
+ "npm": "NPM",
+ "tagManager": "Tag Manager",
+ "platforms": "Platforms"
+ },
"npm": {
"title": "NPM package",
"desc": "For React, Vue, Angular, and other JS frameworks.",