diff --git a/next.config.js b/next.config.js index 2f7d648..65f596a 100644 --- a/next.config.js +++ b/next.config.js @@ -1,6 +1,6 @@ /* CONFIG */ -const locales = ["en", "es", "fr", "pt-br", "ja"]; +const locales = ["en", "es", "fr", "pt-br", "ja", "zh"]; /* END CONFIG */ diff --git a/public/local-data/currencies.json b/public/local-data/currencies.json index 6395145..933de04 100644 --- a/public/local-data/currencies.json +++ b/public/local-data/currencies.json @@ -85,6 +85,15 @@ "rate_to_usd": 1.0728706, "display_decimals": true } + }, + { + "id": "11", + "attributes": { + "code": "CNY", + "symbol": "¥", + "rate_to_usd": 0.141546, + "display_decimals": true + } } ] } diff --git a/public/local-data/languages.json b/public/local-data/languages.json index cb3a003..c13e843 100644 --- a/public/local-data/languages.json +++ b/public/local-data/languages.json @@ -23,14 +23,7 @@ "attributes": { "name": "Russian", "code": "ru", "localized_name": "русский" } }, { "id": "11", "attributes": { "name": "Korean", "code": "ko", "localized_name": "한국어" } }, - { - "id": "12", - "attributes": { - "name": "Chinese (Traditional)", - "code": "zh-cht", - "localized_name": "中文(繁體)" - } - } + { "id": "12", "attributes": { "name": "Chinese", "code": "zh", "localized_name": "中文" } } ] } } diff --git a/public/local-data/websiteInterfaces.json b/public/local-data/websiteInterfaces.json index 5fc5a63..0045378 100644 --- a/public/local-data/websiteInterfaces.json +++ b/public/local-data/websiteInterfaces.json @@ -900,6 +900,186 @@ "subber": null, "author": null } + }, + { + "attributes": { + "ui_language": { "data": { "attributes": { "code": "zh" } } }, + "library": "图书馆", + "contents": "各项内容", + "wiki": "百科", + "chronicles": "年表", + "library_short_description": "查看所有实体媒介和数字媒介", + "contents_short_description": "查找各类内容,包含类型查询及标签查询功能。", + "wiki_short_description": "世界观百科全书", + "chronicles_short_description": "以年表顺序浏览所有事件及内容", + "news": "最新情报", + "gallery": "画廊", + "archives": "档案", + "about_us": "关于本站", + "licensing_notice": "如非特殊声明,本网站将遵循\n[CC-BY-SA](https://creativecommons.org/licenses/by-sa/4.0/)共享协议。", + "copyright_notice": "本网站不属于有限公司史克威尔艾尼克斯,且并未获得相关支持。所有游戏资产及宣传材料均属于\n© SQUARE ENIX CO. LTD.", + "contents_description": "所有内容(文本、音频和视频)均来自图书馆板块及其他网络资源。", + "type": "类目", + "category": "标签", + "size": "尺寸", + "release_date": "发售日", + "details": "详情", + "price": "价格", + "width": "宽", + "height": "高", + "thickness": "厚度", + "subitem": "内容物", + "variant": "各版本", + "summary": "概览", + "audio": "音频", + "video": "视频", + "textual": "文本", + "game": "游戏", + "other": "其他", + "left_to_right": "从左到右", + "right_to_left": "从右到左", + "page": "页数", + "page_order": "阅读顺序", + "binding": "装订类别", + "type_information": "类目信息", + "front_matter": "扉页", + "back_matter": "尾页", + "open_content": "打开", + "view_scans": "查看扫描件", + "paperback": "平装", + "hardcover": "精装", + "language": "语言", + "library_description": "网罗所有横尾世界(Yoko-World)相关资料(书籍、小说、美术集、舞台剧、漫画、广播剧CD以及漫画)。\n我们将尽量为每一项资料提供照片、扫描件及转录文本等内容,并给出物品描述、发售时间及渠道、尺寸与价格等信息。", + "wiki_description": "本版块将收录与横尾世界相关的所有内容。\n当前仅有年表条目,但我们计划在未来添加更多条目。", + "chronicles_description": "以年表顺序浏览所有事件及内容", + "news_description": "这里是网站编辑们书写新闻的板块。\n我们会在这里刊载有关新作/周边发售的消息,还将包含索引、考据、开箱及展会等有关内容。", + "archives_description": "除实体媒介外,我们还将收录网站、网页、视频和文档等内容。", + "about_us_description": "请通过下方页面,了解雅科儿图书馆项目的详细信息。", + "page_not_found": "糟了!这个页面的分歧被暂时封锁了!(404)", + "default_description": "雅科儿图书馆力图收集所有横尾太郎相关作品并归档,\n横尾太郎是一位日本游戏导演兼剧作家。", + "name": "名称", + "show_subitems": "显示内容物", + "show_primary_items": "显示主要商品", + "show_secondary_items": "显示关联商品", + "order_by": "显示顺序", + "select_option_sidebar": "请先在侧边栏进行选择", + "group": null, + "settings": "设置", + "theme": "主题", + "light": "亮", + "auto": "自动", + "dark": "暗", + "font_size": "字号", + "player_name": "玩家名", + "currency": "货币单位", + "font": "字体", + "calculated": "已换算", + "status_incomplete": "该条目仅包含一部分翻译/转写。", + "status_draft": "该条目仅为草稿,一般是指该项目仍在制作当中。翻译或转写质量非常糟糕,甚至可能是机翻和机器识别。", + "status_review": "该页面尚未经过校对,内容有待完善。", + "status_done": "该页面已经过检查和校对,如果你注意到任何翻译或排版的谬误,请联系我们进行修改!", + "incomplete": "未完成", + "draft": "草稿", + "review": "查看", + "done": "完成", + "status": "状态", + "transcript_notice": "转写的内容", + "translation_notice": "该页面为粉丝翻译", + "source_language": "根据 翻译", + "pronouns": "希望被称呼为", + "item": "物品列表", + "open_settings": "打开设置", + "open_search": "打开搜索", + "chronology": "年表", + "accords_handbook": "雅科儿的手册", + "legality": "合法性", + "sharing_policy": "分享守则", + "contact_us": "联系我们", + "email": "电子邮箱", + "email_gdpr_notice": "收集邮箱地址仅用于与您(基于您的请求)进行联络。我们不会将该地址分享给其他人,也不会用与其他目的。", + "message": "留言", + "send": "发送", + "response_invalid_code": "验证码不正确", + "response_invalid_email": "请输入正确的邮箱地址!", + "response_email_success": "感谢您的留言!我们会尽快与您联系。", + "always_show_info": "显示信息", + "item_not_available": "不支持购买", + "primary_language": "主要语言", + "secondary_language": "次要语言", + "previous_content": "{ count, plural, =0 {本文为第一部分} one {上一章节} other {相关章节} }", + "followup_content": "{ count, plural, =0 {本文为最后一部分} one {下一章节} other {后续章节} }", + "videos": "影像", + "view_on": null, + "channel": "频道", + "subscribers": "订阅数", + "description": "简介", + "available_at": "可在", + "want_it": "想要!", + "have_it": "已入手!", + "source": "来源", + "reset_all_filters": "重置显示设置", + "only_display_items_i_have": "仅显示我已有的商品", + "only_display_items_i_want": "仅显示我想要的商品", + "only_display_unmarked_items": "仅显示我未添加标签的商品", + "table_of_contents": "目录", + "no_results_message": "未查询到结果,可尝试修改文本或条件。", + "all": "全部", + "special_pages": "特殊页面", + "scan": "扫描方式", + "scanlation": "机器扫描", + "scanners": "扫描者", + "cleaners": "修图", + "typesetters": "转录者", + "notes": "备注", + "tags": "标签", + "no_source_warning": "没有来源!", + "copy_anchor_link": "点击以复制链接", + "anchor_link_copied": "已复制👍", + "folders": "分组", + "empty_folder_message": "该组为空", + "switch_to_grid_view": "切换为网格视图", + "switch_to_folder_view": "切换为分组视图", + "paper_texture": "纸张材质", + "book_fold": "折页效果", + "lighting": "灯光", + "side_pages": "书页厚度效果", + "shadow": "阴影", + "night_reader": "护眼效果", + "single_page_view": "单页模式", + "double_page_view": "跨页模式", + "reset_all_options": "重置所有设置", + "reading_layout": "阅读模式", + "quality": "质量", + "only_unavailable_videos": "显示无法播放的视频", + "oldest": "从旧到新", + "newest": "从新到旧", + "least_popular": "观看数最低", + "most_popular": "观看数最高", + "shortest": "最短的", + "longest": "最长的", + "search": "搜索…", + "showing_x_out_of_y_results": "已显示 {y} 个结果中的 {x}个", + "return_to_x": "返回{ x, select, undefined {} other {{x}} }", + "x_results": "{ x, plural, =0 {没有结果} one {# 个结果} other {# 个结果} }", + "definition_x": "释义 {x}", + "subitem_of_x": "收录于 {x}", + "dark_mode_extension_warning": "本网站支持明亮和黑暗主题,如果你的浏览器被设置为黑暗主题,请将其关闭以确保最佳体验。", + "weapon": "{ count, plural, =0 {没有武器} one {武器} other {武器} }", + "weapons_description": "游戏中登场过的所有武器清单。所有名武器都包含一个专门的页面,里面包含各种细节,包括它们是如何被锻造,过去又是被如何使用的。", + "level_x": "等级 {x}", + "story_x": "故事 {x}", + "player_name_tooltip": "部分游戏中的文本,会在对话和叙事中引用玩家的名字。如果你希望在网站的此类内容中,看到你自己的名字,便可以在这里自由地填写玩家姓名。如果此处留空,则想应文本中会显示“(player)”", + "download_archive": "下载档案", + "search_placeholder": "搜索…", + "performance_mode": "性能模式", + "performance_mode_tooltip": "该选项能够通过减少特效(羽化的背景、阴影等……),以提升您的浏览体验。此模式会在 Linux、iOS 以及 Safari 上默认激活,且无法在 iOS 及 Safari 上关闭此模式,否则体验会非常糟糕。", + "transcriber": "{ count, plural, =0 {无转录者} one {转录者} other {转录者} }", + "translator": "{ count, plural, =0 {无译者} one {译者} other {译者} }", + "proofreader": "{ count, plural, =0 {无校对} one {无校对} other {无校对} }", + "dubber": "{ count, plural, =0 {无配音} one {配音者} other {配音者} }", + "subber": "{ count, plural, =0 {无字幕} one {时间轴} other {时间轴} }", + "author": "{ count, plural, =0 {无作者} one {作者} other {作者} }" + } } ] } diff --git a/src/components/PreviewCard.tsx b/src/components/PreviewCard.tsx index ed4a5e1..e9e6155 100644 --- a/src/components/PreviewCard.tsx +++ b/src/components/PreviewCard.tsx @@ -96,7 +96,7 @@ export const PreviewCard = ({ {metadata.price && (

- {prettyPrice(metadata.price, currencies, currency)} + {prettyPrice(metadata.price, currencies, currency, router.locale)}

)} {metadata.views && ( diff --git a/src/helpers/formatters.ts b/src/helpers/formatters.ts index 7e60b12..4366cdc 100644 --- a/src/helpers/formatters.ts +++ b/src/helpers/formatters.ts @@ -16,7 +16,8 @@ export const prettyDate = ( export const prettyPrice = ( pricePicker: PricePickerFragment, currencies: Currencies, - targetCurrencyCode?: string + targetCurrencyCode?: string, + locale = "en" ): string => { if (!targetCurrencyCode) return ""; if (isUndefined(pricePicker.amount)) return ""; @@ -27,12 +28,12 @@ export const prettyPrice = ( if (targetCurrency?.attributes) { const amountInTargetCurrency = convertPrice(pricePicker, targetCurrency); - return amountInTargetCurrency.toLocaleString("en", { + return amountInTargetCurrency.toLocaleString(locale, { style: "currency", currency: targetCurrency.attributes.code, }); } - return pricePicker.amount.toLocaleString("en", { + return pricePicker.amount.toLocaleString(locale, { style: "currency", currency: pricePicker.currency?.data?.attributes?.code, }); diff --git a/src/pages/library/[slug]/index.tsx b/src/pages/library/[slug]/index.tsx index eb0a8cc..2b8b4fd 100644 --- a/src/pages/library/[slug]/index.tsx +++ b/src/pages/library/[slug]/index.tsx @@ -320,13 +320,14 @@ const LibrarySlug = ({ {prettyPrice( item.price, currencies, - item.price.currency?.data?.attributes?.code + item.price.currency?.data?.attributes?.code, + router.locale )}

{item.price.currency?.data?.attributes?.code !== currency && (

- {prettyPrice(item.price, currencies, currency)}
( - {format("calculated").toLowerCase()}) + {prettyPrice(item.price, currencies, currency, router.locale)} +
({format("calculated").toLowerCase()})

)} diff --git a/src/pages/library/[slug]/reader.tsx b/src/pages/library/[slug]/reader.tsx index 40d4ec2..54159a3 100644 --- a/src/pages/library/[slug]/reader.tsx +++ b/src/pages/library/[slug]/reader.tsx @@ -282,7 +282,7 @@ const LibrarySlug = ({ const subPanel = ( - +