Skip to content

Commit

Permalink
Added Chinese translations
Browse files Browse the repository at this point in the history
  • Loading branch information
silversonicaxel committed Aug 26, 2024
1 parent d1e256d commit ab57b1d
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 9 deletions.
71 changes: 71 additions & 0 deletions locales/zh/common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"title": "unknown art",
"description": "unknown art是一个会向你介绍艺术和独立书店的俱乐部。",
"menu" : {
"home": "home",
"places": "places",
"place": "place"
},
"language" : {
"it": "italian",
"en": "english"
},
"logo": {
"title": "logo unknown art",
"label": "main logo"
},
"loading": "loading",
"pagination": {
"current_page": "current page",
"page": "page"
},
"search": {
"title": "search places",
"description": "filter the list of places",
"field": {
"name": {
"label": "name"
},
"country": {
"label": "country"
},
"city": {
"label": "city"
},
"website": {
"label": "website",
"option": {
"all": "all",
"with": "with website",
"without": "without website"
}
}
},
"action": {
"dialog": {
"title": "search",
"label": "open the dialog search of places"
},
"close": {
"label": "close search places dialog"
},
"submit": {
"title": "search",
"label": "submit the search of places"
},
"reset": {
"title": "reset",
"label": "reset the search of places"
}
}
},
"error": {
"description": "the {{page}} page has some problem, you can visit us later, or try to reload the page.",
"action": {
"reload": {
"title": "reload",
"label": "reload the {{page}} page"
}
}
}
}
8 changes: 8 additions & 0 deletions locales/zh/home.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"intro": "欢迎亲爱的读者!",
"content": "unknown art 是一个你可以希望与来自美丽世界各地的个人、爱人、思想家、才智人士或艺术家建立联系的地方。",
"logo": {
"title": "主图 unknown art",
"label": "主图"
}
}
12 changes: 12 additions & 0 deletions locales/zh/places.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"results": {
"notfound": "no results found. please try using different search filters.",
"wrongpagination": "no available results. it looks like the pagination might have been modified in the url. please try searching again."
},
"form": {
"address": "address",
"website": "website",
"description": "description",
"image": "image"
}
}
4 changes: 2 additions & 2 deletions src/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { ReactNode } from 'react'
import { Analytics } from 'src/components/analytics'
import { Header } from 'src/components/header'
import { font } from 'src/helpers/config/font'
import { locales, locales_codes } from 'src/helpers/config/i18n'
import { locales, locales_regional_codes } from 'src/helpers/config/i18n'
import { meta, META_SITE_BASE_URL } from 'src/helpers/config/meta'
import { DialogProvider } from 'src/helpers/providers/dialog'
import { getTranslationServer } from 'src/helpers/utils/getTranslationServer'
Expand All @@ -32,7 +32,7 @@ export async function generateMetadata({ params: { locale } }: AppLayoutProps):
description: t('description'),
url: META_SITE_BASE_URL,
siteName: meta.siteName,
locale: locales_codes[locale],
locale: locales_regional_codes[locale],
type: 'website',
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/[locale]/places/[placeId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import styles from './place.module.css'

import { getPlace } from 'src/api/place'
import { SafeImage } from 'src/components/safe-image'
import { locales_codes } from 'src/helpers/config/i18n'
import { locales_regional_codes } from 'src/helpers/config/i18n'
import { meta, META_SITE_BASE_URL } from 'src/helpers/config/meta'
import { getTranslationServer } from 'src/helpers/utils/getTranslationServer'
import { isImageSecure } from 'src/helpers/utils/isImageSecure'
Expand All @@ -32,7 +32,7 @@ export async function generateMetadata({ params }: PlacePageProps): Promise<Meta
description: t('description'),
url: `${META_SITE_BASE_URL}${params.locale}/places/${place.id}`,
siteName: meta.siteName,
locale: locales_codes[params.locale],
locale: locales_regional_codes[params.locale],
type: 'website',
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/[locale]/places/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Metadata } from 'next'
import { ReactNode } from 'react'

import { locales_codes } from 'src/helpers/config/i18n'
import { locales_regional_codes } from 'src/helpers/config/i18n'
import { meta, META_SITE_BASE_URL } from 'src/helpers/config/meta'
import { getTranslationServer } from 'src/helpers/utils/getTranslationServer'
import type { ComponentParams } from 'src/types/component'
Expand All @@ -24,7 +24,7 @@ export async function generateMetadata(
description: t('description'),
url: `${META_SITE_BASE_URL}${locale}/places`,
siteName: meta.siteName,
locale: locales_codes[locale],
locale: locales_regional_codes[locale],
type: 'website',
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/helpers/config/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
export const defaultLocale = 'en'

export const locales = [defaultLocale, 'it']
export const locales = [defaultLocale, 'it', 'zh']

export const locales_codes: Record<string, string> = {
export const locales_regional_codes: Record<string, string> = {
en: 'en_GB',
it: 'it_IT'
it: 'it_IT',
zh: 'zh_CN'
}

export const I18N_COOKIE_NAME = 'NEXT_I18N_CURRENT_LOCALE'
Expand Down

0 comments on commit ab57b1d

Please sign in to comment.