Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default defineConfig({
site: 'https://zen-browser.app',
i18n: {
defaultLocale: 'en',
locales: ['en', 'ja'],
locales: ['en', 'ja','vi'],
routing: {
fallbackType: 'rewrite',
prefixDefaultLocale: false,
Expand Down
7 changes: 6 additions & 1 deletion src/components/Title.astro
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this change.

Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
---
import { getLocale } from '~/utils/i18n'
import { cn } from '~/utils/merge'
const { class: className } = Astro.props
const locale = getLocale(Astro)
---

<h1
class={cn('mb-[0.4rem] font-junicode text-5xl font-semibold leading-[0.9] text-dark', className)}
class={cn(
`mb-[0.4rem] ${locale !== 'vi' ? 'font-junicode' : ''}text-5xl font-semibold leading-[0.9] text-dark`,
className
)}
>
<slot />
</h1>
4 changes: 3 additions & 1 deletion src/constants/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
const UI_EN = (await import('~/i18n/en/translation.json', { with: { type: 'json' } })).default
const UI_JA = (await import('~/i18n/ja/translation.json', { with: { type: 'json' } })).default
const UI_VI = (await import('~/i18n/vi/translation.json', { with: { type: 'json' } })).default

export const i18n = {
DEFAULT_LOCALE: 'en',
LOCALES: [
{ label: 'English', value: 'en', ui: UI_EN, intl: 'en-US' },
{ label: '日本語', value: 'ja', ui: UI_JA, intl: 'ja-JP' },
{label:'Tiếng Việt', value: 'vi', ui: UI_EN, intl: 'vi-VN' },
],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to use UI_VI

Suggested change
{ label: '日本語', value: 'ja', ui: UI_JA, intl: 'ja-JP' },
{label:'Tiếng Việt', value: 'vi', ui: UI_EN, intl: 'vi-VN' },
],
{ label: '日本語', value: 'ja', ui: UI_JA, intl: 'ja-JP' },
{label:'Tiếng Việt', value: 'vi', ui: UI_VI, intl: 'vi-VN' },
],

}

/**
* Type definition for UI translations based on the English translation
*/
export type UIProps = typeof UI_EN | typeof UI_JA
export type UIProps = typeof UI_EN | typeof UI_JA| typeof UI_VI

export const getIntlLocale = (locale: string) => {
return i18n.LOCALES.find(l => l.value === locale)?.intl
Expand Down
Loading