Skip to content

Commit f30e682

Browse files
committed
Merge: CTA 404 修复、页脚身份更新、ossheroes HTML hero 与中英双语
2 parents 02fafb7 + 060c22d commit f30e682

14 files changed

Lines changed: 305 additions & 52 deletions

File tree

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import tseslint from 'typescript-eslint'
66
import { defineConfig, globalIgnores } from 'eslint/config'
77

88
export default defineConfig([
9-
globalIgnores(['dist']),
9+
globalIgnores(['dist', '.mindmux', 'brain']),
1010
{
1111
files: ['**/*.{ts,tsx}'],
1212
extends: [
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
<div class="page-footer">Copyright &#169 2022 - <%- date(Date.now(), 'YYYY') %> OpenSource.Win</div>
1+
<% const footerYear = date(Date.now(), 'YYYY'); %>
2+
<div class="page-footer" data-i18n-zh="Copyright &#169; 2022 - <%= footerYear %> OpenSource.Win" data-i18n-en="Copyright &#169; 2022 - <%= footerYear %> OpenSource.Win">Copyright &#169; 2022 - <%= footerYear %> OpenSource.Win</div>

ossheroes/themes/OpenSourceWin/layout/_partial/head.ejs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,5 @@
7373
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
7474
<%- favicon_tag('img/favicon.ico') %>
7575
<%- css('css/index.v1.css') %>
76+
<%- js('js/i18n.js') %>
7677
</head>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<%
2+
// 终端风 hero:纯 HTML/CSS,不引入图片素材
3+
// 默认取最新年份,往年榜单页通过 partial('_partial/hero', {year: ...}) 传入
4+
let heroYear = typeof year !== 'undefined' ? year : null;
5+
if (!heroYear) {
6+
const latest = site.data.rankingList?.slice().sort((a, b) => b.year - a.year)[0];
7+
heroYear = latest ? latest.year : '';
8+
}
9+
%>
10+
<div class="hero">
11+
<div class="hero-inner container">
12+
<div class="hero-badge">
13+
<span class="hero-dot" aria-hidden="true"><span class="hero-dot-ping"></span><span class="hero-dot-core"></span></span>
14+
<span data-i18n-zh="系统广播" data-i18n-en="System Broadcast">系统广播</span>
15+
</div>
16+
<h1 class="hero-title">
17+
<span class="hero-cmd">./ranking --year <%- heroYear %></span>
18+
<span class="hero-hash" aria-hidden="true">#</span> <span data-i18n-zh="中国开源码力榜" data-i18n-en="China Open Source HeroRank">中国开源码力榜</span>
19+
</h1>
20+
<p class="hero-subtitle" data-i18n-zh="由 SegmentFault 思否、开源社、X-lab 开放实验室联合发起,基于 OpenRank 开源贡献度算法,甄选年度最具影响力的中国开源开发者。" data-i18n-en="Co-founded by SegmentFault, KAIYUANSHE and X-lab — an annual ranking of China's most impactful open source developers, powered by the OpenRank algorithm.">由 SegmentFault 思否、开源社、X-lab 开放实验室联合发起,基于 OpenRank 开源贡献度算法,甄选年度最具影响力的中国开源开发者。</p>
21+
</div>
22+
</div>
Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
<!-- 导航 -->
22
<nav class="navbar navbar-expand-lg navbar-dark" id="navWrap">
33
<div class="container container-fluid">
4-
<a class="navbar-brand" href="<%= config.url %>/"><%= config.title %></a>
4+
<a class="navbar-brand" href="<%= config.url %>/" data-i18n-zh="中国开源码力榜" data-i18n-en="China Open Source HeroRank"><%= config.title %></a>
55
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
66
<span class="navbar-toggler-icon"></span>
77
</button>
88
<div class="collapse navbar-collapse justify-content-sm-end" id="navbarSupportedContent">
99
<ul class="navbar-nav mb-2 mb-lg-0">
1010
<li class="nav-item">
11-
<a href="<%= config.url %>#ranking" class="nav-link">榜单背景</a>
11+
<a href="<%= config.url %>#ranking" class="nav-link" data-i18n-zh="榜单背景" data-i18n-en="Background">榜单背景</a>
1212
</li>
1313
<li class="nav-item">
14-
<a href="<%= config.url %>#standard" class="nav-link">评选标准</a>
14+
<a href="<%= config.url %>#standard" class="nav-link" data-i18n-zh="评选标准" data-i18n-en="Criteria">评选标准</a>
1515
</li>
1616
<li class="nav-item">
17-
<a href="<%= config.url %>#detail" class="nav-link">榜单详情</a>
17+
<a href="<%= config.url %>#detail" class="nav-link" data-i18n-zh="榜单详情" data-i18n-en="Rankings">榜单详情</a>
1818
</li>
1919
<li class="nav-item">
20-
<a href="<%= config.url %>#partner" class="nav-link">合作伙伴</a>
20+
<a href="<%= config.url %>#partner" class="nav-link" data-i18n-zh="合作伙伴" data-i18n-en="Partners">合作伙伴</a>
2121
</li>
2222
<li class="nav-item">
2323
<a href="https://github.com/opensourcewin" target="_blank" class="nav-link">GitHub</a>
2424
</li>
2525
<li class="nav-item dropdown">
26-
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
26+
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false" data-i18n-zh="往年榜单" data-i18n-en="Past Rankings">
2727
往年榜单
2828
</a>
2929
<%
@@ -37,10 +37,14 @@
3737
</ul>
3838
</li>
3939
<li class="nav-item">
40-
<a href="https://opensource.win/" class="nav-link">回到官网</a>
40+
<a href="https://opensource.win/" class="nav-link" data-i18n-zh="回到官网" data-i18n-en="Main Site">回到官网</a>
41+
</li>
42+
<!-- 语言切换:中 / EN,与官网共用 localStorage key osw-language -->
43+
<li class="nav-item lang-switch" aria-label="Language / 语言">
44+
<button type="button" class="lang-btn" data-lang-switch="zh" onclick="window.OSW_I18N && OSW_I18N.set('zh')">中</button><span class="lang-sep" aria-hidden="true">/</span><button type="button" class="lang-btn" data-lang-switch="en" onclick="window.OSW_I18N && OSW_I18N.set('en')">EN</button>
4145
</li>
4246
</ul>
4347
</div>
4448
</div>
45-
46-
</nav>
49+
50+
</nav>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<% if (slug) { %>
2-
<h4>开发活动</h4>
2+
<h4 data-i18n-zh="开发活动" data-i18n-en="Developer Activity">开发活动</h4>
33
<iframe width="100%" height="500" src="https://osgraph.com/graphs/developer-activity/github/<%= slug %>?user-limit=10" title="" frameborder="0"></iframe>
44
5-
<h4>开源伙伴</h4>
5+
<h4 data-i18n-zh="开源伙伴" data-i18n-en="Open Source Partners">开源伙伴</h4>
66
<iframe width="100%" height="500" src="https://osgraph.com/graphs/os-partner/github/<%= slug %>?user-limit=10" title="" frameborder="0"></iframe>
77
8-
<h4>开源兴趣</h4>
8+
<h4 data-i18n-zh="开源兴趣" data-i18n-en="Open Source Interests">开源兴趣</h4>
99
<iframe width="100%" height="500" src="https://osgraph.com/graphs/os-interest/github/<%= slug %>?repo-limit=5&topic-limit=3" title="" frameborder="0"></iframe>
10-
<% } %>
10+
<% } %>

ossheroes/themes/OpenSourceWin/layout/_partial/ranking_detail.ejs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
<!-- 头部 -->
22
<div class="header" id="head">
33
<%- partial('_partial/menu') %>
4-
<!-- 头部内容 -->
5-
<div class="container">
6-
<%- image_tag('img/banner-index-new.png', {class: 'home-head', alt: '中国开源码力榜', loading: 'lazy'}) %>
7-
</div>
4+
<!-- 头部内容:与首页一致的终端风 hero,年份取当前榜单 -->
5+
<%- partial('_partial/hero', {year: item.data_year}) %>
86
</div>
97

108
<div class="container">
11-
<%- partial('_partial/split') %>
9+
<%- partial('_partial/split') %>
1210

1311
<div class="list" id="detail">
14-
<div class="main-title">榜单详情-<%- item.data_year %></div>
12+
<div class="main-title"><span data-i18n-zh="榜单详情" data-i18n-en="Rankings">榜单详情</span>-<%- item.data_year %></div>
1513
<%
1614
const rankingArr = site.data.rankingList?.find((a)=> a.year == item.data_year) || [];
1715
const userMap = new Map();
@@ -39,9 +37,9 @@
3937
4038
<%- partial('_partial/split') %>
4139
<div class="list" id="partner">
42-
<div class="main-title">合作伙伴</div>
40+
<div class="main-title" data-i18n-zh="合作伙伴" data-i18n-en="Partners">合作伙伴</div>
4341
44-
<div class="subtitle mt-4">联合发起方</div>
42+
<div class="subtitle mt-4" data-i18n-zh="联合发起方" data-i18n-en="Co-founders">联合发起方</div>
4543
<div class="icons-wrap">
4644
<%- image_tag('img/logo-sf.png', {class: 'icons mb-3', alt: '思否', loading: 'lazy'}) %>
4745
<%- image_tag('img/logo-kys.png', {class: 'icons mb-3', alt: '开源社', loading: 'lazy'}) %>
@@ -52,11 +50,11 @@
5250
</div>
5351
5452
<% if (item.data_year == 2021) {%>
55-
<div class="subtitle mt-4">官方支持</div>
53+
<div class="subtitle mt-4" data-i18n-zh="官方支持" data-i18n-en="Official Support">官方支持</div>
5654
<div class="icons-wrap">
5755
<a href="https://github.com" title="GitHub" target="_blank"><%- image_tag('img/logo-github.png', {class: 'icons mb-3', alt: 'GitHub', loading: 'lazy'}) %></a>
5856
</div>
59-
<div class="subtitle mt-4">合作社区</div>
57+
<div class="subtitle mt-4" data-i18n-zh="合作社区" data-i18n-en="Community Partners">合作社区</div>
6058
<div class="icons-wrap">
6159
<%- image_tag('img/logo-kyuubi.png', {class: 'icons2 m-2', alt: 'Kyuubi', loading: 'lazy'}) %>
6260
<%- image_tag('img/logo-gitops.png', {class: 'icons2 m-2', alt: 'GITOPS', loading: 'lazy'}) %>
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<article class="row justify-content-center">
2-
<p class="col-12 col-md-8">
3-
中国开源码力榜是由 SegmentFault 思否、开源社、X-lab 开放实验室共同发起的中国开源开发者榜单。
2+
<p class="col-12 col-md-8" data-i18n-zh="中国开源码力榜是由 SegmentFault 思否、开源社、X-lab 开放实验室共同发起的中国开源开发者榜单。" data-i18n-en="China Open Source HeroRank is an annual ranking of Chinese open source developers, co-founded by SegmentFault, KAIYUANSHE and X-lab.">
3+
中国开源码力榜是由 SegmentFault 思否、开源社、X-lab 开放实验室共同发起的中国开源开发者榜单。
44
</p>
5-
<p class="col-12 col-md-8">
6-
该榜单的评选基于开源贡献度评价算法 OpenRank,通过开源社区、广大开发者、志愿者的开放协作,共同核实标注信息、排除机器人账号,甄选了每年排名前 99 位的中国开发者。
5+
<p class="col-12 col-md-8" data-i18n-zh="该榜单的评选基于开源贡献度评价算法 OpenRank,通过开源社区、广大开发者、志愿者的开放协作,共同核实标注信息、排除机器人账号,甄选了每年排名前 99 位的中国开发者。" data-i18n-en="The ranking is powered by OpenRank, an open source contribution evaluation algorithm. Through open collaboration among communities, developers and volunteers, we verify contributor information, filter out bot accounts, and select the top 99 Chinese developers each year.">
6+
该榜单的评选基于开源贡献度评价算法 OpenRank,通过开源社区、广大开发者、志愿者的开放协作,共同核实标注信息、排除机器人账号,甄选了每年排名前 99 位的中国开发者。
77
</p>
8-
<p class="col-12 col-md-8">
9-
通过中国开源码力榜,我们希望开源世界的超级“码”丽、开源项目背后的开发者们可以被更多人知道、认识和 respect。让更多人关注开源、关注开源开发者成长。
8+
<p class="col-12 col-md-8" data-i18n-zh="通过中国开源码力榜,我们希望开源世界的超级“码”丽、开源项目背后的开发者们可以被更多人知道、认识和 respect。让更多人关注开源、关注开源开发者成长。" data-i18n-en="Through HeroRank, we hope the super coding heroes behind open source projects can be seen, known and respected by more people — inspiring broader attention to open source and to the growth of open source developers.">
9+
通过中国开源码力榜,我们希望开源世界的超级“码”丽、开源项目背后的开发者们可以被更多人知道、认识和 respect。让更多人关注开源、关注开源开发者成长。
1010
</p>
1111
</article>

ossheroes/themes/OpenSourceWin/layout/index.ejs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
<!-- 头部 -->
22
<div class="header" id="head">
33
<%- partial('_partial/menu') %>
4-
<!-- 头部内容 -->
5-
<div class="container">
6-
<%- image_tag('img/banner-index-new.png', {class: 'home-head', alt: '中国开源码力榜', loading: 'lazy'}) %>
7-
</div>
4+
<!-- 头部内容:纯 HTML 终端风 hero(banner 图片仅保留给 twitter:image,页面不再展示) -->
5+
<%- partial('_partial/hero') %>
86
</div>
97

108
<div class="container">
119
<div class="list" id="ranking">
12-
<div class="main-title">中国开源码力榜</div>
10+
<div class="main-title" data-i18n-zh="中国开源码力榜" data-i18n-en="China Open Source HeroRank">中国开源码力榜</div>
1311

1412
<div class="mt-4">
1513
<%- partial('_partial/slogan') %>
@@ -20,14 +18,14 @@
2018
<%- partial('_partial/split') %>
2119

2220
<div class="list" id="standard">
23-
<div class="main-title">评选标准</div>
21+
<div class="main-title" data-i18n-zh="评选标准" data-i18n-en="Selection Criteria">评选标准</div>
2422

2523
<div class="text text2">
2624
<div class="row justify-content-center mt-4">
2725
<ol class="col-12 col-md-8">
28-
<li>中国开发者的辨别主要依据 OpenDigger 项目中持续收录的开发者地理位置标签,初始标签依据其 GitHub 上公开的信息由志愿者手工标注辨别,如有错漏,欢迎通过提 <a href="https://github.com/X-lab2017/open-digger/issues" target="_blank">issue</a> 贡献标签。</li>
29-
<li>开发者的贡献度基于 GitHub 全域开发者在当年的协作关系数据计算得到,是一种基于图的开源贡献度计算方法。关于算法的详细介绍可以参考 <a href="https://dl.acm.org/doi/10.1145/3639477.3639734" target="_blank">ICSE 2024 收录论文</a>。</li>
30-
<li>开发者的贡献度取决于其贡献仓库的协作影响力以及其在这些仓库中的贡献比例。一个开发者在高影响力仓库中的贡献比例高,或大量参与不同的仓库,都可以有效提升自己的贡献度。</li>
26+
<li data-i18n-zh="中国开发者的辨别主要依据 OpenDigger 项目中持续收录的开发者地理位置标签,初始标签依据其 GitHub 上公开的信息由志愿者手工标注辨别,如有错漏,欢迎通过提 <a href='https://github.com/X-lab2017/open-digger/issues' target='_blank'>issue</a> 贡献标签。" data-i18n-en="Chinese developers are identified primarily through the geographic location labels continuously maintained in the OpenDigger project. Initial labels are manually annotated by volunteers based on public GitHub information. If you spot any errors or omissions, please contribute labels by filing an <a href='https://github.com/X-lab2017/open-digger/issues' target='_blank'>issue</a>.">中国开发者的辨别主要依据 OpenDigger 项目中持续收录的开发者地理位置标签,初始标签依据其 GitHub 上公开的信息由志愿者手工标注辨别,如有错漏,欢迎通过提 <a href="https://github.com/X-lab2017/open-digger/issues" target="_blank">issue</a> 贡献标签。</li>
27+
<li data-i18n-zh="开发者的贡献度基于 GitHub 全域开发者在当年的协作关系数据计算得到,是一种基于图的开源贡献度计算方法。关于算法的详细介绍可以参考 <a href='https://dl.acm.org/doi/10.1145/3639477.3639734' target='_blank'>ICSE 2024 收录论文</a>。" data-i18n-en="Developer contribution scores are computed from the collaboration network of all GitHub developers within the year — a graph-based open source contribution metric. See the <a href='https://dl.acm.org/doi/10.1145/3639477.3639734' target='_blank'>ICSE 2024 paper</a> for a detailed description of the algorithm.">开发者的贡献度基于 GitHub 全域开发者在当年的协作关系数据计算得到,是一种基于图的开源贡献度计算方法。关于算法的详细介绍可以参考 <a href="https://dl.acm.org/doi/10.1145/3639477.3639734" target="_blank">ICSE 2024 收录论文</a>。</li>
28+
<li data-i18n-zh="开发者的贡献度取决于其贡献仓库的协作影响力以及其在这些仓库中的贡献比例。一个开发者在高影响力仓库中的贡献比例高,或大量参与不同的仓库,都可以有效提升自己的贡献度。" data-i18n-en="A developer's score depends on the collaborative influence of the repositories they contribute to and their share of contributions in those repositories. Contributing a large share to high-impact repositories, or contributing broadly across many repositories, both effectively raise the score.">开发者的贡献度取决于其贡献仓库的协作影响力以及其在这些仓库中的贡献比例。一个开发者在高影响力仓库中的贡献比例高,或大量参与不同的仓库,都可以有效提升自己的贡献度。</li>
3129
</ol>
3230
</div>
3331
</div>
@@ -36,7 +34,7 @@
3634
<%- partial('_partial/split') %>
3735

3836
<div class="list" id="detail">
39-
<div class="main-title">榜单详情</div>
37+
<div class="main-title" data-i18n-zh="榜单详情" data-i18n-en="Rankings">榜单详情</div>
4038

4139
<ol class="list-unstyled mt-4">
4240
<%
@@ -46,12 +44,12 @@
4644
for(let rankingItem of site.pages.data) {
4745
if (rankingItem.slug) {
4846
userMap.set(rankingItem.slug.toString(), rankingItem)
49-
}
47+
}
5048
}
5149
%>
5250
5351
<li id="<%= rankingArr.year %>">
54-
<p class="text-center text-secondary">最近更新于 <%- rankingArr.update %></p>
52+
<p class="text-center text-secondary"><span data-i18n-zh="最近更新于" data-i18n-en="Last updated:">最近更新于</span> <%- rankingArr.update %></p>
5553
<div class="row mt-4">
5654
<% for (let user of rankingArr.annualRanking) { %>
5755
<% const userInfo = userMap.get(user.login.toString()) %>
@@ -65,9 +63,9 @@
6563
<%- partial('_partial/split') %>
6664
6765
<div class="list" id="partner">
68-
<div class="main-title">合作伙伴</div>
66+
<div class="main-title" data-i18n-zh="合作伙伴" data-i18n-en="Partners">合作伙伴</div>
6967
70-
<div class="subtitle mt-4">联合发起方</div>
68+
<div class="subtitle mt-4" data-i18n-zh="联合发起方" data-i18n-en="Co-founders">联合发起方</div>
7169
<div class="icons-wrap">
7270
<%- image_tag('img/logo-sf.png', {class: 'icons mb-3', alt: '思否', loading: 'lazy'}) %>
7371
<%- image_tag('img/logo-kys.png', {class: 'icons mb-3', alt: '开源社', loading: 'lazy'}) %>

0 commit comments

Comments
 (0)