Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Jenkins 中文社区
Simplified Chinese Plugin
提交
faa5d3b3
S
Simplified Chinese Plugin
项目概览
Jenkins 中文社区
/
Simplified Chinese Plugin
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Simplified Chinese Plugin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
faa5d3b3
编写于
5月 14, 2019
作者:
Z
Zhao Xiaojie
提交者:
GitHub
5月 14, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #80 from LinuxSuRen/community-page
Add Chinese Community page
上级
3e34f6db
4791bf38
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
139 addition
and
1 deletion
+139
-1
src/main/java/io/jenkins/plugins/localization_zh_cn/CommunityDecorator.java
...enkins/plugins/localization_zh_cn/CommunityDecorator.java
+26
-0
src/main/java/io/jenkins/plugins/localization_zh_cn/CommunityPage.java
.../io/jenkins/plugins/localization_zh_cn/CommunityPage.java
+30
-0
src/main/resources/index.jelly
src/main/resources/index.jelly
+1
-1
src/main/resources/io/jenkins/plugins/localization_zh_cn/CommunityDecorator/footer.jelly
...lugins/localization_zh_cn/CommunityDecorator/footer.jelly
+8
-0
src/main/resources/io/jenkins/plugins/localization_zh_cn/CommunityPage/index.jelly
...kins/plugins/localization_zh_cn/CommunityPage/index.jelly
+20
-0
src/main/webapp/images/jenkins-wechat.png
src/main/webapp/images/jenkins-wechat.png
+0
-0
src/test/java/io/jenkins/plugins/localization_zh_cn/CommunityPageTest.java
...jenkins/plugins/localization_zh_cn/CommunityPageTest.java
+54
-0
未找到文件。
src/main/java/io/jenkins/plugins/localization_zh_cn/CommunityDecorator.java
0 → 100644
浏览文件 @
faa5d3b3
package
io.jenkins.plugins.localization_zh_cn
;
import
hudson.Extension
;
import
hudson.model.PageDecorator
;
import
org.kohsuke.stapler.Stapler
;
import
org.kohsuke.stapler.StaplerRequest
;
import
java.util.Locale
;
@Extension
public
class
CommunityDecorator
extends
PageDecorator
{
public
boolean
isCurrentLanguage
()
{
StaplerRequest
req
=
Stapler
.
getCurrentRequest
();
if
(
req
==
null
)
{
return
false
;
}
String
languages
=
req
.
getHeader
(
"Accept-Language"
);
if
(
languages
!=
null
)
{
return
languages
.
startsWith
(
Locale
.
SIMPLIFIED_CHINESE
.
toString
())
||
languages
.
startsWith
(
"zh-CN"
);
}
return
false
;
}
}
src/main/java/io/jenkins/plugins/localization_zh_cn/CommunityPage.java
0 → 100644
浏览文件 @
faa5d3b3
package
io.jenkins.plugins.localization_zh_cn
;
import
hudson.Extension
;
import
hudson.model.UnprotectedRootAction
;
import
org.jenkinsci.Symbol
;
import
javax.annotation.CheckForNull
;
import
javax.annotation.Nonnull
;
@Extension
@Symbol
(
"chinese"
)
public
class
CommunityPage
implements
UnprotectedRootAction
{
@CheckForNull
@Override
public
String
getIconFileName
()
{
return
null
;
}
@Nonnull
@Override
public
String
getDisplayName
()
{
return
"Jenkins Chinese Community"
;
}
@CheckForNull
@Override
public
String
getUrlName
()
{
return
"chinese"
;
}
}
src/main/resources/index.jelly
浏览文件 @
faa5d3b3
<?jelly escape-by-default='true'?>
<div>
Jenkins
及其插件的简体中文语言包
。
Jenkins
Core 及其插件的简体中文语言包,由 <a href="https://jenkins-zh.cn/about" target="_blank">Jenkins 中文社区</a>维护
。
</div>
src/main/resources/io/jenkins/plugins/localization_zh_cn/CommunityDecorator/footer.jelly
0 → 100644
浏览文件 @
faa5d3b3
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form" xmlns:st="jelly:stapler">
<j:if test="${it.isCurrentLanguage()}">
<span>
<a href="${rootURL}/chinese">Jenkins 中文社区</a>
</span>
</j:if>
</j:jelly>
src/main/resources/io/jenkins/plugins/localization_zh_cn/CommunityPage/index.jelly
0 → 100644
浏览文件 @
faa5d3b3
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
<l:layout norefresh="true" permission="${app.READ}">
<st:include page="sidepanel.jelly" it="${app}"/>
<l:main-panel>
<div style="margin:10px;">
Jenkins Core 及其插件的简体中文语言包,由 <a href="https://jenkins-zh.cn/about" target="_blank">Jenkins 中文社区</a>维护。我们致力于给每一位 Jenkins 的中文用户带来更好的体验,并非常欢迎您反馈任何建议和意见。
</div>
<div style="margin:10px;">
我们会在 Jenkins 社区官方微信公众号上发布以下资讯信息:
<li>社区的线上以及线下活动,例如:Jenkins Meetup</li>
<li>官方博客文章</li>
<li>CI/CD 相关的技术文章(原创、翻译),案例分享</li>
<li>版本更新发布</li>
<img width="300px" height="300px" src="${rootURL}/plugin/localization-zh-cn/images/jenkins-wechat.png" alt="Jenkins 微信公众号二维码"/>
</div>
</l:main-panel>
</l:layout>
</j:jelly>
\ No newline at end of file
src/main/webapp/images/jenkins-wechat.png
0 → 100644
浏览文件 @
faa5d3b3
104.1 KB
src/test/java/io/jenkins/plugins/localization_zh_cn/CommunityPageTest.java
0 → 100644
浏览文件 @
faa5d3b3
package
io.jenkins.plugins.localization_zh_cn
;
import
com.gargoylesoftware.htmlunit.ElementNotFoundException
;
import
com.gargoylesoftware.htmlunit.WebRequest
;
import
com.gargoylesoftware.htmlunit.html.HtmlAnchor
;
import
com.gargoylesoftware.htmlunit.html.HtmlPage
;
import
com.gargoylesoftware.htmlunit.util.UrlUtils
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.jvnet.hudson.test.JenkinsRule
;
import
org.xml.sax.SAXException
;
import
java.io.IOException
;
import
java.net.URL
;
import
java.util.Locale
;
import
static
org
.
junit
.
Assert
.*;
public
class
CommunityPageTest
{
@Rule
public
JenkinsRule
rule
=
new
JenkinsRule
();
@Test
public
void
indexPage
()
throws
IOException
,
SAXException
{
JenkinsRule
.
WebClient
client
=
rule
.
createWebClient
();
client
.
goTo
(
"chinese"
);
}
@Test
public
void
locale
()
throws
IOException
,
SAXException
{
JenkinsRule
.
WebClient
client
=
rule
.
createWebClient
();
URL
rootURL
=
UrlUtils
.
toUrlUnsafe
(
client
.
getContextPath
());
WebRequest
webRequest
=
new
WebRequest
(
rootURL
);
webRequest
.
setAdditionalHeader
(
"Accept-Language"
,
Locale
.
ENGLISH
.
toString
());
// for English locale
HtmlPage
page
=
client
.
getPage
(
webRequest
);
HtmlAnchor
anchor
=
null
;
try
{
page
.
getAnchorByText
(
"Jenkins 中文社区"
);
}
catch
(
ElementNotFoundException
e
)
{
// should throw an exception here
}
// for Chinese locale
webRequest
.
removeAdditionalHeader
(
"Accept-Language"
);
webRequest
.
setAdditionalHeader
(
"Accept-Language"
,
Locale
.
SIMPLIFIED_CHINESE
.
toString
());
page
=
client
.
getPage
(
webRequest
);
anchor
=
page
.
getAnchorByText
(
"Jenkins 中文社区"
);
assertNotNull
(
anchor
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录