Skip to content

Commit

Permalink
feat: i10n (#201)
Browse files Browse the repository at this point in the history
* feat: add i10n

* feat: add i10n zh-Hans translate

* feat: add i10n zh-Hans translate

* feat: add en translate template

* fix: fix key typo

* chore: add alternate link

* chore: update en translate

* feat: disabled multi language href for now
  • Loading branch information
PaiJi authored Sep 6, 2024
1 parent 8f39f8b commit 49a6e0e
Show file tree
Hide file tree
Showing 20 changed files with 1,326 additions and 895 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": "next/core-web-vitals"
"extends": "next/core-web-vitals",
"rules": {
"@next/next/no-img-element": "off"
}
}
9 changes: 9 additions & 0 deletions next-i18next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** @type {import('next-i18next').UserConfig} */
module.exports = {
i18n: {
defaultLocale: "zh-Hans",
locales: ["zh-Hans", "en"],
localeDetection: false,
},
reloadOnPrerender: process.env.NODE_ENV === "development",
};
3 changes: 3 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.NODE_ENV === "production",
});

const { i18n } = require("./next-i18next.config");

const isProd = process.env.NODE_ENV === "production";
const IS_CN_REGION = process.env.NEXT_PUBLIC_REGION === "CN";
const STATIC_CDN_URL = process.env.NEXT_PUBLIC_STATIC_CDN_URL;
Expand Down Expand Up @@ -62,6 +64,7 @@ const nextConfig = {
);
return config;
},
i18n,
};

const sentryWebpackPluginOptions = {
Expand Down
41 changes: 22 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,43 @@
"clean": "rm -rf .next && rm -rf out"
},
"dependencies": {
"@headlessui/react": "^2.0.1",
"@next/third-parties": "^14.2.3",
"@radix-ui/react-collapsible": "^1.0.3",
"@sentry/nextjs": "^7.113.0",
"@xata.io/client": "^0.29.4",
"autoprefixer": "^10.4.19",
"@headlessui/react": "^2.1.3",
"@next/third-parties": "^14.2.7",
"@radix-ui/react-collapsible": "^1.1.0",
"@sentry/nextjs": "^7.119.0",
"@xata.io/client": "^0.29.5",
"autoprefixer": "^10.4.20",
"clsx": "^2.1.1",
"date-fns": "^3.6.0",
"embla-carousel-autoplay": "^8.0.4",
"embla-carousel-react": "^8.0.4",
"embla-carousel-autoplay": "^8.2.0",
"embla-carousel-react": "^8.2.0",
"eslint": "8.57.0",
"eslint-config-next": "14.2.3",
"eslint-config-next": "14.2.7",
"git-revision-webpack-plugin": "^5.0.0",
"i18next": "^23.14.0",
"lodash-es": "^4.17.21",
"next": "14.2.3",
"next": "14.2.7",
"next-i18next": "^15.3.1",
"next-sitemap": "^4.2.3",
"next-superjson-plugin": "^0.6.3",
"postcss": "^8.4.38",
"postcss": "^8.4.41",
"postcss-flexbugs-fixes": "^5.0.2",
"postcss-nested": "^6.0.1",
"postcss-preset-env": "^9.5.9",
"postcss-nested": "^6.2.0",
"postcss-preset-env": "^9.6.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-hot-toast": "^2.4.1",
"react-icons": "^5.2.1",
"react-i18next": "^15.0.1",
"react-icons": "^5.3.0",
"superjson": "1.13.3",
"tailwindcss": "^3.4.3",
"typescript": "5.4.5"
"tailwindcss": "^3.4.10",
"typescript": "5.5.4"
},
"devDependencies": {
"@next/bundle-analyzer": "^14.2.3",
"@next/bundle-analyzer": "^14.2.7",
"@types/lodash-es": "^4.17.12",
"@types/node": "20.12.8",
"@types/react": "18.3.1",
"@types/node": "20.16.2",
"@types/react": "18.3.5",
"@types/react-dom": "18.3.0"
},
"packageManager": "[email protected]",
Expand Down
99 changes: 99 additions & 0 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"header": {
"title": "Furry Event China",
"slogan": "Wait for vacation 🤤",
"nav": {
"homepage": "Home",
"city": "City",
"organization": "Organizer",
"years": "Year Overview"
}
},
"footer": {
"friendsLink": "Friend Links",
"aboutUs": "About Us",
"disclaimer": "The information shown on this page is for reference only. Please refer to the official event website for accurate information.",
"use": "Made by",
"and": "and",
"made": "produced"
},
"homepage": {
"total": "A total of {{total}} conventions",
"month": "{{month}} Month",
"nextYearMonth": "Next year {{month}} Month",
"group": {
"status": {
"passed": "Already ended",
"now": "Right now",
"soon": "Coming soon",
"next": "There are still",
"nextYear": "Look at next year"
}
},
"noResult": "It seems there are no conventions that meet the query requirements...",
"noResultTip": "Try different search criteria, or... wait a bit longer?",
"noResultContact": "You can also report a convention that has been officially announced! Our contact information is in the footer!"
},
"event": {
"filter": {
"onlyAvailable": "Only view upcoming conventions",
"all": "I want them all (all)",
"cosy": "A small gathering (small convention)",
"small": "A bit impressive (medium convention)",
"medium": "So many people (large convention)",
"large": "Starting to get lost (giant convention)",
"mega": "Can't breathe (expo)"
},
"status": {
"cancel": "The event has been canceled by the organizer and cannot be held."
},
"hostBy": "Hosted by {{hostName}}",
"unknown": "Not yet announced",
"scaleDes": "This is a {{scale}} furry convention",
"scale": {
"cosy": "Small scale",
"small": "Medium scale",
"medium": "Large scale",
"large": "Extra large scale",
"mega": "Giant scale"
},
"goToSource": "Go to source",
"map": "Convention map",
"mapLoading": "Loading map",
"gotoGaoDe": "View on Gaode Map",
"gotoOrganization": "View Organizer details",
"dateFormat": "yyyy年MM月dd日"
},
"organization": {
"active": "Active Organizers",
"deactive": "Inactive Organizers",
"createdAt": "Established {{distance}} ago",
"firstTimeEvent": "First held on {{year}}/{{month}}/{{day}}",
"firstTimeShow": "First appeared on {{year}}/{{month}}/{{day}}",
"totalEvent": "A total of {{amount}} furry conventions/gatherings recorded",
"website": "Visit official website",
"bilibili": "Visit Bilibili",
"twitter": "Visit Twitter",
"weibo": "Visit Weibo",
"wikifur": "Visit Wikifur for more information",
"qq": "Copy QQ group number: {{qq}}",
"copyQq": "Copy QQ group number",
"qqCopySuccess": "🥳 Copied successfully, go join the QQ group now",
"mail": "Email {{email}}",
"copyMail": "Copy Email",
"mailCopySuccess": "🥳 Copied successfully, go send an email now",
"des": "Organizer introduction",
"defaultDes": "This organizer is lazy and hasn't written any introduction.",
"passedEvent": "Past conventions"
},
"years": {
"title": "Summary",
"des": "The FEC·Furry Convention Calendar has recorded {{totalAmount}} furry conventions/gatherings over {{totalYear}} years. Among them:",
"eachYear": "{{year}} had a total of {{amount}} furry conventions/gatherings",
"unknown": "Not yet scheduled",
"known": "{{year}}",
"thisYear": "This year",
"total": "A total of {{total}} furry conventions/gatherings",
"month": "{{month}} Month"
}
}
99 changes: 99 additions & 0 deletions public/locales/zh-Hans/common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"header": {
"title": "FEC·兽展日历",
"slogan": "展后综合征治疗中🤤",
"nav": {
"homepage": "首页",
"city": "城市",
"organization": "展商",
"years": "年份表"
}
},
"footer": {
"friendsLink": "友情链接",
"aboutUs": "关于我们",
"disclaimer": "本页所示信息仅供参考,准确信息请以活动官网为准",
"use": "",
"and": "",
"made": "制作而成"
},
"homepage": {
"total": "共有 {{total}} 个展会",
"month": "{{month}}月",
"nextYearMonth": "明年{{month}}月",
"group": {
"status": {
"passed": "已经结束",
"now": "就是现在",
"soon": "马上就来",
"next": "今年还有",
"nextYear": "看看来年"
}
},
"noResult": "似乎没有满足查询需求的展会...",
"noResultTip": "换个查询条件,或者...再等等?",
"noResultContact": "你也可以向我们反馈一个已经官宣的展会!页脚有我们的联系方式!"
},
"event": {
"filter": {
"onlyAvailable": "只看还未开始的展会",
"all": "我全都要(全部)",
"cosy": "三两小聚(小型展)",
"small": "有点厉害(中型展)",
"medium": "好多人啊(大型展)",
"large": "开始迷路(巨型展)",
"mega": "无法呼吸(博览会展)"
},
"status": {
"cancel": "活动已被主办方取消,无法举行。"
},
"hostBy": "由{{hostName}}主办",
"unknown": "暂未公布",
"scaleDes": "这是一个 {{scale}} 的兽展",
"scale": {
"cosy": "小型规模",
"small": "中型规模",
"medium": "大型规模",
"large": "超大型规模",
"mega": "巨型规模"
},
"goToSource": "前往信源",
"map": "展会地图",
"mapLoading": "正在加载地图",
"gotoGaoDe": "去高德地图查看",
"gotoOrganization": "看看展商详情",
"dateFormat": "yyyy年MM月dd日"
},
"organization": {
"active": "活跃展商",
"deactive": "停止活动展商",
"createdAt": "已创立 {{distance}}",
"firstTimeEvent": "首次举办于 {{year}}年{{month}}月{{day}}日",
"firstTimeShow": "首次出现于 {{year}}年{{month}}月{{day}}日",
"totalEvent": "已累计收录{{amount}}场兽展/兽聚",
"website": "去官网",
"bilibili": "去Bilibili",
"twitter": "去Twitter",
"weibo": "去微博",
"wikifur": "去 Wikifur 了解更多",
"qq": "复制QQ群号: {{qq}}",
"copyQq": "复制QQ群号",
"qqCopySuccess": "🥳 复制成功,快去QQ加群吧",
"mail": "发邮件给 {{email}}",
"copyMail": "复制邮件地址",
"mailCopySuccess": "🥳 复制成功,快去发邮件吧",
"des": "展方简介",
"defaultDes": "这个主办方很懒,什么介绍也没写过。",
"passedEvent": "历届展会"
},
"years": {
"title": "总结",
"des": "FEC·兽展日历共在 {{totalYear}} 年里收录到 {{totalAmount}} 场兽展/兽聚。 其中:",
"eachYear": "{{year}}年共有 {{amount}} 场兽展/兽聚",
"unknown": "暂未定档",
"known": "{{year}}年",
"thisYear": "这一年",
"total": "共有 {{total}} 场兽展/兽聚",
"month": "{{month}}月"
}
}
Loading

0 comments on commit 49a6e0e

Please sign in to comment.