Skip to content

Instantly share code, notes, and snippets.

@wfjsw
Created April 11, 2015 14:38
Show Gist options
  • Save wfjsw/12d6acf6a05e17278782 to your computer and use it in GitHub Desktop.
Save wfjsw/12d6acf6a05e17278782 to your computer and use it in GitHub Desktop.
Chinese Support Patch for CachetHQ/Cachet
diff --git a/app/config/langs.php b/app/config/langs.php
index e6814ee..1ac453c 100644
--- a/app/config/langs.php
+++ b/app/config/langs.php
@@ -9,6 +9,7 @@ return [
'es' => 'Español',
'fr' => 'Français',
'pt-BR' => 'Portuguese, Brazilian',
- 'zh-Hant' => 'Chinese (Traditional)',
- 'zh-Hans' => 'Chinese (Simplified)',
+ 'zh-CN' => '简体中文 (from Crowdin)'
+ 'zh-Hant' => 'Chinese (Traditional) from applelam',
+ 'zh-Hans' => 'Chinese (Simplified) from applelam',
];
diff --git a/app/lang/zh-CN/cachet.php b/app/lang/zh-CN/cachet.php
new file mode 100644
index 0000000..d68d737
--- /dev/null
+++ b/app/lang/zh-CN/cachet.php
@@ -0,0 +1,59 @@
+<?php
+
+return [
+ // Components
+ 'components' => [
+ 'status' => [
+ 1 => '正常运转',
+ 2 => '性能问题',
+ 3 => '部分停运',
+ 4 => '严重停转',
+ ],
+ ],
+
+ // Incidents
+ 'incidents' => [
+ 'none' => '没有已报告的事件。',
+ 'past' => '过去的事件',
+ 'previous_week' => '前一周',
+ 'next_week' => '后一周',
+ 'none' => '没有已报告的事件。',
+ 'scheduled' => '计划维护',
+ 'scheduled_at' => ',计划于 :timestamp',
+ 'status' => [
+ 0 => '计划中的', // TODO: Hopefully remove this.
+ 1 => '调查中',
+ 2 => '已定位',
+ 3 => '观察中',
+ 4 => '已修复',
+ ],
+ ],
+
+ // Service Status
+ 'service' => [
+ 'good' => '所有系统正常运转。',
+ 'bad' => '一些系统出了问题。',
+ ],
+
+ 'api' => [
+ 'regenerate' => '重新生成 API 密钥',
+ 'revoke' => '吊销 API 密钥',
+ ],
+
+ // Metrics
+ 'metrics' => [
+ 'filter' => [
+ 'hourly' => '每小时的',
+ 'daily' => '每日的',
+ 'monthly' => '每月的',
+ ],
+ ],
+
+ // Other
+ 'powered_by' => ':app 应用状态页面由 <a href="https://cachethq.io">Cachet</a>提供支持。',
+ 'about_this_site' => '关于此站点',
+ 'rss-feed' => 'RSS 源',
+ 'atom-feed' => 'Atom 源',
+ 'feed' => '状态源',
+
+];
diff --git a/app/lang/zh-CN/dashboard.php b/app/lang/zh-CN/dashboard.php
new file mode 100644
index 0000000..0470ae9
--- /dev/null
+++ b/app/lang/zh-CN/dashboard.php
@@ -0,0 +1,186 @@
+<?php
+
+return [
+
+ 'dashboard' => '仪表盘',
+
+ // Incidents
+ 'incidents' => [
+ 'title' => '事件和维护计划',
+ 'incidents' => '事件',
+ 'logged' => '{0} 目前没有问题 干得漂亮!|您已经记录了一个事件|您已经报告了 <strong>:count</strong> 个事件',
+ 'incident-create-template' => '创建模板',
+ 'incident-templates' => '事件模板',
+ 'add' => [
+ 'title' => '添加一个事件',
+ 'success' => '事件已添加',
+ 'failure' => '事件添加失败。',
+ ],
+ 'edit' => [
+ 'title' => '编辑一个事件',
+ 'success' => '事件已更新。',
+ 'failure' => '事件编辑失败。',
+ ],
+
+ // Incident templates
+ 'templates' => [
+ 'title' => '事件模板',
+ 'add' => [
+ 'title' => '创建一个事件模板。',
+ 'success' => '模板已创建。',
+ 'failure' => '创建模板失败。',
+ ],
+ 'edit' => [
+ 'title' => '编辑模板',
+ 'success' => '模板已更新!',
+ 'failure' => '模板修改失败',
+ ],
+ ],
+ ],
+
+ // Incident Maintenance
+ 'schedule' => [
+ 'schedule' => '计划维护',
+ 'scheduled_at' => '计划在 :timestamp',
+ 'add' => [
+ 'title' => '添加维护计划',
+ 'success' => '计划已添加。',
+ 'failure' => '计划添加失败。',
+ ],
+ 'edit' => [
+ 'title' => '编辑维护计划',
+ 'success' => '计划已更新!',
+ 'failure' => '计划更新失败。',
+ ],
+ 'delete' => [
+ 'success' => '维护计划已被删除,它将从你的状态页上消失。',
+ 'failure' => '无法删除该维护计划。请再试一次。',
+ ],
+ ],
+
+ // Components
+ 'components' => [
+ 'components' => '组件',
+ 'component_statuses' => '组件状态',
+ 'listed_group' => '根据 :name 分组',
+ 'add' => [
+ 'title' => '添加一个组件',
+ 'message' => '你应该添加一个组件。',
+ 'success' => '组件已创建。',
+ 'failure' => '组件添加失败。',
+ ],
+ 'edit' => [
+ 'title' => '编辑一个组件',
+ 'success' => '组件已更新。',
+ 'failure' => '组件编辑失败。',
+ ],
+
+ // Component groups
+ 'groups' => [
+ 'groups' => '部件分组|部件分组',
+ 'add' => [
+ 'title' => '添加一个分组。',
+ 'success' => '部件分组已添加。',
+ 'failure' => '分组添加失败。',
+ ],
+ 'edit' => [
+ 'title' => '编辑组件分组',
+ 'success' => '分组已更新。',
+ 'failure' => '分组更新失败。',
+ ],
+ ],
+ ],
+
+ // Metrics
+ 'metrics' => [
+ 'metrics' => '图表',
+ 'add' => [
+ 'title' => '添加一个图表',
+ 'success' => '图表已创建。',
+ 'failure' => '图表创建失败。',
+ ],
+ 'edit' => [
+ 'title' => '编辑图表',
+ 'success' => '图表已更新。',
+ 'failure' => '图表更新失败。',
+ ],
+ ],
+
+ // Team
+ 'team' => [
+ 'team' => '团队',
+ 'member' => '成员',
+ 'profile' => '更改资料',
+ 'description' => '团队成员将能够添加、修改和编辑组件和事件。',
+ 'add' => [
+ 'title' => '添加一个新团队成员',
+ 'success' => '团队成员已添加。',
+ 'failure' => '添加组件失败。',
+ ],
+ 'edit' => [
+ 'title' => '更新配置文件',
+ 'success' => '配置文件已更新。',
+ 'failure' => '资料更新失败。',
+ ],
+ ],
+
+ // Settings
+ 'settings' => [
+ 'settings' => '设置',
+ 'app-setup' => [
+ 'app-setup' => '应用安装',
+ 'images-only' => '只能上传图像。',
+ 'too-big' => '你上传的文件太大了。上传的图像大小应小于:size',
+ ],
+ 'security' => [
+ 'security' => '安全',
+ 'two-factor' => '没有启用双因素身份验证的用户',
+ ],
+ 'stylesheet' => [
+ 'stylesheet' => '样式表',
+ ],
+ 'theme' => [
+ 'theme' => '主题',
+ ],
+ 'edit' => [
+ 'success' => '设置已保存。',
+ 'failure' => '无法保存设置。',
+ ],
+ ],
+
+ // Login
+ 'login' => [
+ 'login' => '登陆',
+ 'logged_in' => '您已登陆',
+ 'welcome' => '欢迎回来!',
+ 'two-factor' => '请输入您的双重验证Token。',
+ ],
+
+ // Sidebar footer
+ 'help' => '帮助',
+ 'status_page' => '状态页面',
+ 'logout' => '注销',
+
+ // Notifications
+ 'notifications' => [
+ 'notifications' => '通知',
+ 'awesome' => '太棒了!',
+ 'whoops' => '哎呦!',
+ ],
+
+ // Welcome modal
+ 'welcome' => [
+ 'welcome' => '欢迎来到Cachet',
+ 'message' => '您的状态页面即将准备好了!您可能想要配置这些额外的设置',
+ 'close' => '您可以直接进入仪表盘',
+ 'steps' => [
+ 'component' => '创建组件',
+ 'incident' => '创建事件',
+ 'customize' => '自定义',
+ 'team' => '添加用户',
+ 'api' => '生成 API 令牌。',
+ 'two-factor' => '双因素认证',
+ ],
+ ],
+
+];
diff --git a/app/lang/zh-CN/errors.php b/app/lang/zh-CN/errors.php
new file mode 100644
index 0000000..4b32470
--- /dev/null
+++ b/app/lang/zh-CN/errors.php
@@ -0,0 +1,16 @@
+<?php
+
+return [
+ 'not-found' => [
+ 'code' => '404',
+ 'title' => '这个页面失踪了!',
+ 'message' => '抱歉,但我们无法找到您要访问的的页面。请检查你的 URL,然后重试。',
+ 'link' => '返回主页',
+ ],
+ 'unauthorized' => [
+ 'code' => '401',
+ 'title' => '未授权',
+ 'message' => '很抱歉,您需要管理员权限才能看到此页面。',
+ 'link' => '返回主页',
+ ],
+];
diff --git a/app/lang/zh-CN/forms.php b/app/lang/zh-CN/forms.php
new file mode 100644
index 0000000..14796e1
--- /dev/null
+++ b/app/lang/zh-CN/forms.php
@@ -0,0 +1,126 @@
+<?php
+
+return [
+
+ // Setup form fields
+ 'setup' => [
+ 'email' => '电子邮箱',
+ 'username' => '用户名',
+ 'password' => '密码',
+ 'site_name' => '站点名称',
+ 'site_domain' => '站点域名',
+ 'site_timezone' => '选择您的时区',
+ 'site_locale' => '选择您的语言',
+ 'enable_google2fa' => '启用谷歌双因素身份验证',
+ ],
+
+ // Login form fields
+ 'login' => [
+ 'email' => '电子邮箱',
+ 'password' => '密码',
+ '2fauth' => '双因素验证代码',
+ 'invalid' => '无效的电子邮件或密码。',
+ 'invalid-token' => '无效的令牌。',
+ ],
+
+ // Incidents form fields
+ 'incidents' => [
+ 'name' => '事件名',
+ 'status' => '状态',
+ 'component' => '组件',
+ 'message' => '消息',
+ 'message-help' => '您可以使用Markdown语言。',
+ 'scheduled_at' => '什么时间安排维护?',
+
+ 'templates' => [
+ 'name' => '事件名',
+ 'template' => '模板',
+ ],
+ ],
+
+ // Components form fields
+ 'components' => [
+ 'name' => '组件名',
+ 'status' => '状态',
+ 'group' => '部件分组',
+ 'description' => '描述',
+ 'link' => '链接',
+ 'tags' => '标签',
+ 'tags-help' => '以逗号分隔。',
+
+ 'groups' => [
+ 'name' => '组名',
+ ],
+ ],
+
+ // Metric form fields
+ 'metrics' => [
+ 'name' => '图表名',
+ 'suffix' => '后缀',
+ 'description' => '描述信息',
+ 'description-help' => '您可以使用Markdown语言。',
+ 'display-chart' => '在状态页上显示图表?',
+ 'default-value' => '默认值',
+ 'calc_type' => '图表计算方法',
+ 'type_sum' => '求和',
+ 'type_avg' => '求平均数',
+
+ 'points' => [
+ 'value' => '数值',
+ ],
+ ],
+
+ // Settings
+ 'settings' => [
+ /// Application setup
+ 'app-setup' => [
+ 'site-name' => '站点名称',
+ 'site-url' => '站点URL',
+ 'site-timezone' => '站点时区',
+ 'site-locale' => '站点语言',
+ 'date-format' => '日期格式',
+ 'display-graphs' => '是否在状态页上显示图表',
+ 'about-this-page' => '关于这个页面',
+ 'days-of-incidents' => '显示多少天的事件?',
+ 'banner' => '横幅图像',
+ 'banner-help' => "建议上传文件宽度不大于930像素。",
+ 'google-analytics' => "Google Analytics 代码",
+ ],
+ 'security' => [
+ 'allowed-domains' => '允许的域',
+ 'allowed-domains-help' => '以逗号分隔。默认情况下,API跨域请求将自动允许以上已设置的域。',
+ ],
+ 'stylesheet' => [
+ 'custom-css' => '自定义样式表',
+ ],
+ 'theme' => [
+ 'background-color' => '背景色',
+ 'text-color' => '文字颜色',
+ ],
+ ],
+
+ 'user' => [
+ 'username' => '用户名',
+ 'email' => '电子邮箱',
+ 'password' => '密码',
+ 'api-token' => 'API 令牌',
+ 'api-token-help' => '重新生成您的 API 令牌将阻止现有的应用程序访问Cachet。',
+ '2fa' => [
+ 'help' => '启用双因素身份验证会增加您的帐户安全。您将需要下载 <a href="https://support.google.com/accounts/answer/1066447?hl=en">Google Authenticator</a> 或类似的应用到您的移动设备。当您登录时将会要求您提供由应用程序生成的一个短码。',
+ ],
+ ],
+
+ // Buttons
+ 'add' => '增加',
+ 'save' => '保存​​',
+ 'update' => '更新',
+ 'create' => '创建',
+ 'edit' => '编辑',
+ 'delete' => '删除',
+ 'submit' => '提交',
+ 'cancel' => '取消',
+ 'remove' => '移除',
+
+ // Other
+ 'optional' => '* 可选',
+];
diff --git a/app/lang/zh-CN/pagination.php b/app/lang/zh-CN/pagination.php
new file mode 100644
index 0000000..2fb34eb
--- /dev/null
+++ b/app/lang/zh-CN/pagination.php
@@ -0,0 +1,19 @@
+<?php
+
+return [
+
+ /*
+ |--------------------------------------------------------------------------
+ | Pagination Language Lines
+ |--------------------------------------------------------------------------
+ |
+ | The following language lines are used by the paginator library to build
+ | the simple pagination links. You are free to change them to anything
+ | you want to customize your views to better match your application.
+ |
+ */
+
+ 'previous' => '&laquo; 上一个',
+ 'next' => '下一个 &raquo;',
+
+];
diff --git a/app/lang/zh-CN/reminders.php b/app/lang/zh-CN/reminders.php
new file mode 100644
index 0000000..841327e
--- /dev/null
+++ b/app/lang/zh-CN/reminders.php
@@ -0,0 +1,22 @@
+<?php
+
+return [
+
+ /*
+ |--------------------------------------------------------------------------
+ | Password Reminder Language Lines
+ |--------------------------------------------------------------------------
+ |
+ | The following language lines are the default lines which match reasons
+ | that are given by the password broker for a password update attempt
+ | has failed, such as for an invalid token or invalid new password.
+ |
+ */
+
+ 'password' => '密码至少应有六个字符 并且与“确认密码”相匹配',
+ 'user' => '我们没有找到使用这个邮箱地址的用户',
+ 'token' => '这个密码重置凭据是无效的',
+ 'sent' => '已经发送密码重置提示信息!',
+ 'reset' => '密码已重置!',
+
+];
diff --git a/app/lang/zh-CN/setup.php b/app/lang/zh-CN/setup.php
new file mode 100644
index 0000000..40671f9
--- /dev/null
+++ b/app/lang/zh-CN/setup.php
@@ -0,0 +1,14 @@
+<?php
+
+return [
+ 'setup' => '设置',
+ 'title' => '安装 Cachet',
+ 'service_details' => '服务细节',
+ 'status_page_setup' => '状态页面设置',
+ 'show_support' => '想支持Cachet?<small>在页脚放Cachet的链接吧</small>',
+ 'admin_account' => '管理员帐户',
+ 'complete_setup' => '设置完成',
+ 'completed' => 'Cachet已成功配置!',
+ 'finish_setup' => '前往控制面板',
+ 'allow_tracking' => '允许匿名用量跟踪吗?',
+];
diff --git a/app/lang/zh-CN/validation.php b/app/lang/zh-CN/validation.php
new file mode 100644
index 0000000..236ba35
--- /dev/null
+++ b/app/lang/zh-CN/validation.php
@@ -0,0 +1,106 @@
+<?php
+
+return [
+
+ /*
+ |--------------------------------------------------------------------------
+ | Validation Language Lines
+ |--------------------------------------------------------------------------
+ |
+ | The following language lines contain the default error messages used by
+ | the validator class. Some of these rules have multiple versions such
+ | as the size rules. Feel free to tweak each of these messages here.
+ |
+ */
+
+ "accepted" => ":attribute 必须是可以接受的。",
+ "active_url" => ":attribute 不是一个有效的URL网址。",
+ "after" => ":attribute 必须在 :date 之后。",
+ "alpha" => ":attribute 只能包含字母。",
+ "alpha_dash" => ":attribute 只能包含字母,数字和破折号。",
+ "alpha_num" => ":attribute 只允许包含字母和数字。",
+ "array" => ":attribute 必须是个数组。",
+ "before" => ":attribute 必须在 :date 之前。",
+ "between" => [
+ "numeric" => ":attribute 必须在 :min 到 :max 之间。",
+ "file" => ":attribute 必须在 :min 到 :max KB 之间。",
+ "string" => ":attribute 必须在 :min 到 :max 字符之间。",
+ "array" => ":attribute 必须在 :min 到 :max 个数目之间。",
+ ],
+ "boolean" => ":attribute 必须为 true(正确) 或者 false(错误)",
+ "confirmed" => ":attribute 与确认项目不匹配",
+ "date" => ":attribute 不是个有效日期",
+ "date_format" => ":attribute 不符合 :format 的格式",
+ "different" => ":attribute 和 :other 不能相同。",
+ "digits" => ":attribute 必须是 :digits 位数。",
+ "digits_between" => ":attribute 必须在 :min 和 :max 位之间。",
+ "email" => ":attribute 必须是个有效的邮件地址。",
+ "exists" => "选择的 :attribute 无效。",
+ "image" => ":attribute 必须是图片。",
+ "in" => "选择的 :attribute 无效。",
+ "integer" => ":attribute 必须是整数。",
+ "ip" => ":attribute 必须是一个有效的 IP 地址。",
+ "max" => [
+ "numeric" => ":attribute 不能大于 :max。",
+ "file" => ":attribute 不能大于 :max KB。",
+ "string" => ":attribute 不能大于 :max 个字符。",
+ "array" => ":attribute 不能超过 :max 个。",
+ ],
+ "mimes" => ":attribute 文件类型必须是 :values。",
+ "min" => [
+ "numeric" => ":attribute 最少是 :min。",
+ "file" => ":attribute 至少需要 :min KB。",
+ "string" => ":attribute 最少需要 :min个字符。",
+ "array" => ":attribute 最少需要 :min 个。",
+ ],
+ "not_in" => "选择的 :attribute 无效。",
+ "numeric" => ":attribute 必须是数字。",
+ "regex" => ":attribute 格式无效。",
+ "required" => ":attribute 字段必填。",
+ "required_if" => ":attribute 项在 :other 是 :value 时是必须填写的。",
+ "required_with" => "当含有 :values 时, :attribute 是必需的。",
+ "required_with_all" => "当含有 :values 时, :attribute 是必需的。",
+ "required_without" => "当 :values 不存在时, :attribute 是必需的。",
+ "required_without_all" => "一项:values 也没有时 :attribute 区域是必填的。",
+ "same" => ":attribute 和 :other 必需匹配。",
+ "size" => [
+ "numeric" => ":attribute 必须是 :size",
+ "file" => ":attribute 必须是 :size KB大小",
+ "string" => ":attribute 必须是 :size 个字符",
+ "array" => ":attribute 必须包含 :size 个",
+ ],
+ "unique" => ":attribute 已经被占用",
+ "url" => ":attribute 的格式无效",
+ "timezone" => ":attribute 必须是个有效的区域。",
+
+ /*
+ |--------------------------------------------------------------------------
+ | Custom Validation Language Lines
+ |--------------------------------------------------------------------------
+ |
+ | Here you may specify custom validation messages for attributes using the
+ | convention "attribute.rule" to name the lines. This makes it quick to
+ | specify a specific custom language line for a given attribute rule.
+ |
+ */
+
+ 'custom' => [
+ 'attribute-name' => [
+ 'rule-name' => '自定义消息',
+ ],
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Custom Validation Attributes
+ |--------------------------------------------------------------------------
+ |
+ | The following language lines are used to swap attribute place-holders
+ | with something more reader friendly such as E-Mail Address instead
+ | of "email". This simply helps us make messages a little cleaner.
+ |
+ */
+
+ 'attributes' => [],
+
+];
diff --git a/app/views/layout/error.blade.php b/app/views/layout/error.blade.php
index f0cb202..a9266ef 100644
--- a/app/views/layout/error.blade.php
+++ b/app/views/layout/error.blade.php
@@ -21,7 +21,7 @@
<title>{{ $pageTitle ?: Setting::get('app_name') }} Status</title>
- <link href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700" rel="stylesheet" type="text/css">
+ <link href="//fonts.lug.ustc.edu.cn/css?family=Open+Sans:300,400,700" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="{{ elixir('dist/css/all.css') }}">
@include('partials.stylesheet')
diff --git a/app/views/layout/master.blade.php b/app/views/layout/master.blade.php
index 453aed8..e3e3f37 100644
--- a/app/views/layout/master.blade.php
+++ b/app/views/layout/master.blade.php
@@ -32,7 +32,7 @@
<title>{{ $pageTitle ?: Setting::get('app_name') }} Status</title>
- <link href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700" rel="stylesheet" type="text/css">
+ <link href="//fonts.lug.ustc.edu.cn/css?family=Open+Sans:300,400,700" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="{{ elixir('dist/css/all.css') }}">
@include('partials.stylesheet')
diff --git a/src/Models/User.php b/src/Models/User.php
index aba1f9e..c69e69c 100644
--- a/src/Models/User.php
+++ b/src/Models/User.php
@@ -94,7 +94,7 @@ class User extends Model implements UserInterface, RemindableInterface
*/
public function getGravatarAttribute($size = 200)
{
- return sprintf('https://www.gravatar.com/avatar/%s?size=%d', md5($this->email), $size);
+ return sprintf('https://cdn.v2ex.com/gravatar/%s?size=%d', md5($this->email), $size);
}
/**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment