summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDessalines <happydooby@gmail.com>2019-08-10 11:28:03 -0700
committerDessalines <happydooby@gmail.com>2019-08-10 11:28:03 -0700
commitc71295033dc920308f41a9985eb089c4974c0e43 (patch)
treec27d0fed0c73e62dfea59e56872ccbc85fda7047
parent30f5f97f2fd9703c5a197bd08842de01fe7eb93b (diff)
parentdb93862fa3166bf17764db9f6f646bf79b7cdbeb (diff)
Merge branch 'tqcenglish-i18n-zh' into dev
-rw-r--r--ui/fuse.js3
-rw-r--r--ui/src/components/moment-time.tsx12
-rw-r--r--ui/src/i18next.ts2
-rw-r--r--ui/src/translations/zh.ts161
4 files changed, 176 insertions, 2 deletions
diff --git a/ui/fuse.js b/ui/fuse.js
index 4755d9f5..f77effbd 100644
--- a/ui/fuse.js
+++ b/ui/fuse.js
@@ -24,6 +24,9 @@ Sparky.task('config', _ => {
transformers: {
before: [transformClasscat(), transformInferno()],
},
+ alias: {
+ 'locale': 'moment/locale'
+ },
plugins: [
EnvPlugin({ NODE_ENV: isProduction ? 'production' : 'development' }),
CSSPlugin(),
diff --git a/ui/src/components/moment-time.tsx b/ui/src/components/moment-time.tsx
index 021cf5f7..77dcaf86 100644
--- a/ui/src/components/moment-time.tsx
+++ b/ui/src/components/moment-time.tsx
@@ -1,6 +1,7 @@
import { Component } from 'inferno';
import * as moment from 'moment';
-// import 'moment/locale/de.js';
+// import 'moment/locale/de';
+import 'moment/locale/zh-cn';
import { getLanguage } from '../utils';
import { i18n } from '../i18next';
@@ -16,7 +17,14 @@ export class MomentTime extends Component<MomentTimeProps, any> {
constructor(props: any, context: any) {
super(props, context);
- moment.locale(getLanguage());
+
+ // Moment doesnt have zh, only zh-cn
+ let lang = getLanguage();
+ if (lang == 'zh') {
+ lang = 'zh-cn';
+ }
+
+ moment.locale(lang);
}
render() {
diff --git a/ui/src/i18next.ts b/ui/src/i18next.ts
index 3b2ad604..0c02abf2 100644
--- a/ui/src/i18next.ts
+++ b/ui/src/i18next.ts
@@ -2,12 +2,14 @@ import * as i18n from 'i18next';
import { getLanguage } from './utils';
import { en } from './translations/en';
import { de } from './translations/de';
+import { zh } from './translations/zh';
// https://github.com/nimbusec-oss/inferno-i18next/blob/master/tests/T.test.js#L66
// TODO don't forget to add moment locales for new languages.
const resources = {
en: en,
de: de,
+ zh: zh,
}
function format(value: any, format: any, lng: any) {
diff --git a/ui/src/translations/zh.ts b/ui/src/translations/zh.ts
new file mode 100644
index 00000000..59e09d7c
--- /dev/null
+++ b/ui/src/translations/zh.ts
@@ -0,0 +1,161 @@
+export const zh = {
+ translation: {
+ post: '帖子',
+ remove_post: '移除帖子',
+ no_posts: '没有帖子.',
+ create_a_post: '创建新帖子',
+ create_post: '创建帖子',
+ number_of_posts:'{{count}} 帖子',
+ posts: '帖子',
+ related_posts: '相关的帖子',
+ comments: '评论',
+ number_of_comments:'{{count}} 评论',
+ remove_comment: '移除评论',
+ communities: '节点',
+ create_a_community: '创建新节点',
+ create_community: '创建节点',
+ remove_community: '移除节点',
+ subscribed_to_communities:'订阅新 <1>节点</1>',
+ trending_communities:'<1>节点</1>趋势',
+ list_of_communities: '节点列表',
+ community_reqs: '包含小写与下划线且没有空格的字符串.',
+ edit: '编辑',
+ reply: '回应',
+ cancel: '取消',
+ unlock: '解锁',
+ lock: '加锁',
+ link: '链接',
+ mod: 'mod',
+ mods: 'mods',
+ moderates: 'Moderates',
+ remove_as_mod: 'remove as mod',
+ appoint_as_mod: 'appoint as mod',
+ modlog: 'Modlog',
+ admin: 'admin',
+ admins: 'admins',
+ remove_as_admin: '移除管理权限',
+ appoint_as_admin: '添加管理权限',
+ remove: '移除',
+ removed: '已移除',
+ locked: '已加锁',
+ reason: '原因',
+ mark_as_read: '标记未读',
+ mark_as_unread: '标记已读',
+ delete: '删除',
+ deleted: '已删除',
+ restore: '恢复',
+ ban: '禁止',
+ ban_from_site: '禁止此站点',
+ unban: '取消',
+ unban_from_site: '取消禁止',
+ save: '保存',
+ unsave: '取消保存',
+ create: '创建',
+ username: '用户名',
+ email_or_username: '邮箱或用户名',
+ number_of_users:'{{count}} 用户',
+ number_of_subscribers:'{{count}} 订阅',
+ number_of_points:'{{count}} 分',
+ name: '名字',
+ title: '标题',
+ category: '分类',
+ subscribers: '订阅',
+ both: '全部',
+ saved: '保存',
+ unsubscribe: '取消订阅',
+ subscribe: '订阅',
+ subscribed: '已订阅',
+ prev: '上一页',
+ next: '下一页',
+ sidebar: '侧边栏',
+ sort_type: '排序方式',
+ hot: '最热',
+ new: '最新',
+ top_day: '今日',
+ week: '周',
+ month: '月',
+ year: '年',
+ all: '所有',
+ top: '最热',
+ api: 'API',
+ inbox: '收件箱',
+ inbox_for: '<1>{{user}}</1> 收件箱',
+ mark_all_as_read: '标记所有已读',
+ type: '类型',
+ unread: '未读',
+ reply_sent: '回复发送',
+ search: '搜索',
+ overview: '个人中心',
+ view: '查看',
+ logout: '注销',
+ login_sign_up: '登录/注册',
+ login: '登录',
+ sign_up: '注册',
+ notifications_error: '你的浏览器不支持桌面通知,尝试 Firefox 或 Chrome',
+ unread_messages: '未读消息',
+ password: '密码',
+ verify_password: '确认密码',
+ email: '邮箱',
+ optional: '选项',
+ expires: '过期',
+ url: 'URL',
+ body: '内容',
+ copy_suggested_title: '复制建议的标题: {{title}}',
+ community: '节点',
+ expand_here: '展开',
+ subscribe_to_communities: '订阅一些 <1>节点</1>.',
+ chat: '聊天',
+ no_results: '没有结果.',
+ setup: '设置',
+ lemmy_instance_setup: 'Lemmy Instance Setup',
+ setup_admin: '设置管理员',
+ your_site: '你的站点',
+ modified: '修改',
+ sponsors: 'Sponsors',
+ sponsors_of_lemmy: 'Sponsors of Lemmy',
+ sponsor_message: 'Lemmy is free, <1>open-source</1> software, meaning no advertising, monetizing, or venture capital, ever. Your donations directly support full-time development of the project. Thank you to the following people:',
+ support_on_patreon: 'Support on Patreon',
+ general_sponsors:'General Sponsors are those that pledged $10 to $39 to Lemmy.',
+ crypto: '加密',
+ bitcoin: '比特币',
+ ethereum: '以太币',
+ code: '代码',
+ joined: '已加入',
+ powered_by: '保留所有权利',
+ landing_0: 'Lemmy is a <1>link aggregator</1> / reddit alternative, intended to work in the <2>fediverse</2>.<3></3>Its self-hostable, has live-updating comment threads, and is tiny (<4>~80kB</4>). Federation into the ActivityPub network is on the roadmap. <5></5>This is a <6>very early beta version</6>, and a lot of features are currently broken or missing. <7></7>Suggest new features or report bugs <8>here.</8><9></9>Made with <10>Rust</10>, <11>Actix</11>, <12>Inferno</12>, <13>Typescript</13>.',
+ not_logged_in: '未登录.',
+ community_ban: '你被此节点禁止.',
+ site_ban: '你被此站点禁止',
+ couldnt_create_comment: '不能创建评论.',
+ couldnt_like_comment: '不能收藏评论.',
+ couldnt_update_comment: '不能更新评论.',
+ couldnt_save_comment: '不能保存评论.',
+ no_comment_edit_allowed: '不允许编辑评论.',
+ no_post_edit_allowed: '不运行编辑帖子.',
+ no_community_edit_allowed: '不允许编辑节点.',
+ couldnt_find_community: '不能找到节点.',
+ couldnt_update_community: '不能更新节点.',
+ community_already_exists: '节点已存在.',
+ community_moderator_already_exists: '节点 moderator 已存在.',
+ community_follower_already_exists: '节点 follower 已存在.',
+ community_user_already_banned: '节点用户已禁止.',
+ couldnt_create_post: '不能创建帖子.',
+ couldnt_like_post: '不能收藏帖子.',
+ couldnt_find_post: '不能搜寻帖子.',
+ couldnt_get_posts: '不能获取帖子',
+ couldnt_update_post: '不能更新帖子',
+ couldnt_save_post: '不能保持帖子.',
+ no_slurs: '和谐.',
+ not_an_admin: '不是管理员.',
+ site_already_exists: '站点已存在.',
+ couldnt_update_site: '不能更新站点.',
+ couldnt_find_that_username_or_email: '用户名/邮箱不存在.',
+ password_incorrect: '密码不正确.',
+ passwords_dont_match: '密码不匹配.',
+ admin_already_created: '抱歉,管理员已存在.',
+ user_already_exists: '用户已存在.',
+ couldnt_update_user: '不可以更新用户.',
+ system_err_login: '系统错误. 尝试注销再登录',
+ },
+}
+