Skip to content

Commit 330e749

Browse files
Merge pull request #80 from guanguans/main
Add Chinese (zh-CN) translation
2 parents fe7f6a3 + bcc6281 commit 330e749

File tree

3 files changed

+199
-1
lines changed

3 files changed

+199
-1
lines changed

.github/workflows/phpunit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: phpunit
22

3-
on: [ push ]
3+
on: [ push, pull_request ]
44

55
jobs:
66
build:

resources/lang/zh_CN/info.php

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
* This file is part of the "dragon-code/pretty-routes" project.
4+
*
5+
* For the full copyright and license information, please view the LICENSE
6+
* file that was distributed with this source code.
7+
*
8+
* @author Andrey Helldar <[email protected]>
9+
* @copyright 2024 Andrey Helldar
10+
* @license MIT
11+
*
12+
* @see https://github.com/TheDragonCode/pretty-routes
13+
*/
14+
15+
return [
16+
'action' => '动作',
17+
'all' => '全部',
18+
'api' => '接口',
19+
'cleaningRoutes' => '清除路由缓存',
20+
'deprecated' => '废弃的',
21+
'dismiss' => '解雇',
22+
'domain' => '域名',
23+
'error' => '错误',
24+
'itemsPerPageAllText' => '全部数量',
25+
'itemsPerPageText' => '每页显示的路由数量',
26+
'loadedOnActive' => '闲置后重新加载',
27+
'loading' => '加载中... 请稍候...',
28+
'methods' => '方法',
29+
'middlewares' => '中间件',
30+
'module' => '模块',
31+
'name' => '名称',
32+
'noDataText' => '暂无数据',
33+
'noResultsText' => '没有找到相关记录',
34+
'of' => '',
35+
'only' => '只有',
36+
'openGitHub' => '在 GitHub 上打开项目页面',
37+
'pageText' => '{0}-{1} 共 {2}',
38+
'path' => '路径',
39+
'printData' => '打印数据',
40+
'priority' => '优先顺序',
41+
'refreshRoutes' => '刷新路由列表',
42+
'reload' => '重新加载',
43+
'search' => '搜索',
44+
'show' => '显示',
45+
'showMessage' => '显示信息',
46+
'textCopied' => '文本已复制',
47+
'textNotCopy' => '文本不可复制',
48+
'title' => '路由',
49+
'types' => '路由类型',
50+
'web' => '网页',
51+
'without' => '没有',
52+
];

tests/Localizations/ZhCnTest.php

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
<?php
2+
/**
3+
* This file is part of the "dragon-code/pretty-routes" project.
4+
*
5+
* For the full copyright and license information, please view the LICENSE
6+
* file that was distributed with this source code.
7+
*
8+
* @author Andrey Helldar <[email protected]>
9+
* @copyright 2024 Andrey Helldar
10+
* @license MIT
11+
*
12+
* @see https://github.com/TheDragonCode/pretty-routes
13+
*/
14+
15+
namespace Tests\Localizations;
16+
17+
use Tests\TestCase;
18+
19+
class ZhCnTest extends TestCase
20+
{
21+
public function testApp()
22+
{
23+
$this->setConfigLocale('zh_CN');
24+
25+
$response = $this->get('/routes');
26+
27+
$response->assertStatus(200);
28+
29+
$response->assertSee('动作');
30+
$response->assertSee('全部');
31+
$response->assertSee('全部数量');
32+
$response->assertSee('接口');
33+
$response->assertSee('清除路由缓存');
34+
$response->assertSee('废弃的');
35+
$response->assertSee('域名');
36+
$response->assertSee('加载中... 请稍候...');
37+
$response->assertSee('方法');
38+
$response->assertSee('中间件');
39+
$response->assertSee('模块');
40+
$response->assertSee('名称');
41+
$response->assertSee('暂无数据');
42+
$response->assertSee('没有找到相关记录');
43+
$response->assertSee('');
44+
$response->assertSee('只有');
45+
$response->assertSee('在 GitHub 上打开项目页面');
46+
$response->assertSee('路径');
47+
$response->assertSee('优先顺序');
48+
$response->assertSee('刷新路由列表');
49+
$response->assertSee('路由类型');
50+
$response->assertSee('每页显示的路由数量');
51+
$response->assertSee('路由');
52+
$response->assertSee('搜索');
53+
$response->assertSee('显示');
54+
$response->assertSee('网页');
55+
$response->assertSee('没有');
56+
57+
$response->assertSee('{0}-{1} 共 {2}');
58+
59+
$response->assertDontSee('Foo Bar');
60+
$response->assertDontSee('Записей на странице');
61+
}
62+
63+
public function testPackage()
64+
{
65+
$this->setConfigLocale('en', 'zh_CN');
66+
67+
$response = $this->get('/routes');
68+
69+
$response->assertStatus(200);
70+
71+
$response->assertSee('动作');
72+
$response->assertSee('全部');
73+
$response->assertSee('全部数量');
74+
$response->assertSee('接口');
75+
$response->assertSee('清除路由缓存');
76+
$response->assertSee('废弃的');
77+
$response->assertSee('域名');
78+
$response->assertSee('加载中... 请稍候...');
79+
$response->assertSee('方法');
80+
$response->assertSee('中间件');
81+
$response->assertSee('模块');
82+
$response->assertSee('名称');
83+
$response->assertSee('暂无数据');
84+
$response->assertSee('没有找到相关记录');
85+
$response->assertSee('');
86+
$response->assertSee('只有');
87+
$response->assertSee('在 GitHub 上打开项目页面');
88+
$response->assertSee('路径');
89+
$response->assertSee('优先顺序');
90+
$response->assertSee('刷新路由列表');
91+
$response->assertSee('路由类型');
92+
$response->assertSee('每页显示的路由数量');
93+
$response->assertSee('路由');
94+
$response->assertSee('搜索');
95+
$response->assertSee('显示');
96+
$response->assertSee('网页');
97+
$response->assertSee('没有');
98+
99+
$response->assertSee('{0}-{1} 共 {2}');
100+
101+
$response->assertDontSee('Foo Bar');
102+
$response->assertDontSee('Записей на странице');
103+
}
104+
105+
public function testIncorrect()
106+
{
107+
$this->setConfigLocale('en', 'foo');
108+
109+
$response = $this->get('/routes');
110+
111+
$response->assertStatus(200);
112+
113+
$response->assertSee('Action');
114+
$response->assertSee('All');
115+
$response->assertSee('All');
116+
$response->assertSee('Api');
117+
$response->assertSee('Clear route cache');
118+
$response->assertSee('Deprecated');
119+
$response->assertSee('Domain');
120+
$response->assertSee('Loading... Please wait...');
121+
$response->assertSee('Methods');
122+
$response->assertSee('Middlewares');
123+
$response->assertSee('Module');
124+
$response->assertSee('Name');
125+
$response->assertSee('No data available');
126+
$response->assertSee('No matching records found');
127+
$response->assertSee('of');
128+
$response->assertSee('Only');
129+
$response->assertSee('Open the project page on GitHub');
130+
$response->assertSee('Path');
131+
$response->assertSee('Priority');
132+
$response->assertSee('Refresh the list of routes');
133+
$response->assertSee('Route types');
134+
$response->assertSee('Routes per page');
135+
$response->assertSee('Routes');
136+
$response->assertSee('Search');
137+
$response->assertSee('Show');
138+
$response->assertSee('Web');
139+
$response->assertSee('Without');
140+
141+
$response->assertSee('{0}-{1} of {2}');
142+
143+
$response->assertDontSee('Foo Bar');
144+
$response->assertDontSee('Записей на странице');
145+
}
146+
}

0 commit comments

Comments
 (0)