diff --git a/docs/dist/CONTRIBUTION_GUIDELINES.md b/docs/dist/CONTRIBUTION_GUIDELINES.md
index 6716e77..044f4fd 100644
--- a/docs/dist/CONTRIBUTION_GUIDELINES.md
+++ b/docs/dist/CONTRIBUTION_GUIDELINES.md
@@ -2,6 +2,6 @@
# Contribution Guidelines
First of all, a warm welcome to those who want to participate in this project 👏🏻👏🏻👏🏻
-But sorry, the current document is still being planned and improved... (maybe you can start from this document)
+But sorry, the current document is still being planned and improved... (Maybe you can start from this document, writing documents is not an easy task 😂)
Finally, please don't lose your enthusiasm, please continue to pay attention!
\ No newline at end of file
diff --git a/docs/dist/CONTRIBUTION_GUIDELINES_zh-CN.md b/docs/dist/CONTRIBUTION_GUIDELINES_zh-CN.md
index 9a27fcd..4c40e13 100644
--- a/docs/dist/CONTRIBUTION_GUIDELINES_zh-CN.md
+++ b/docs/dist/CONTRIBUTION_GUIDELINES_zh-CN.md
@@ -2,6 +2,6 @@
# 贡献指南
首先,对各位想要参与到本项目来表示热烈欢迎👏🏻👏🏻👏🏻
-但是抱歉的是,当前文档还在规划完善中...(也许可以从该文档开始)
+但是抱歉的是,当前文档还在规划完善中...(也许你可以从该文档开始,写文档绝不是一件容易的事😂)
最后,请不要丢失你的热情,请持续保持关注!
\ No newline at end of file
diff --git a/docs/src/changelog/index.tsx b/docs/src/changelog/index.tsx
index 6d64273..d47934d 100644
--- a/docs/src/changelog/index.tsx
+++ b/docs/src/changelog/index.tsx
@@ -6,6 +6,7 @@ import {
getTranslationText,
getVariableInterpolation,
initI18n,
+ renderLanguage,
} from '../utils'
import Template from './ChangeLog'
@@ -294,7 +295,7 @@ function V_2_0_0() {
return (
{tr('更新日志')}
+ {renderLanguage('CHANGELOG')}
diff --git a/docs/src/contribution-guidelines/index.tsx b/docs/src/contribution-guidelines/index.tsx
index ab1df49..25e357d 100644
--- a/docs/src/contribution-guidelines/index.tsx
+++ b/docs/src/contribution-guidelines/index.tsx
@@ -10,7 +10,9 @@ export default function OutputLog(props) {
{tr('首先,对各位想要参与到本项目来表示热烈欢迎{0}', '👏🏻👏🏻👏🏻')}
- {tr('但是抱歉的是,当前文档还在规划完善中...(也许可以从该文档开始)')}
+ {tr(
+ '但是抱歉的是,当前文档还在规划完善中...(也许你可以从该文档开始,写文档绝不是一件容易的事😂)',
+ )}
{tr('最后,请不要丢失你的热情,请持续保持关注!')}
diff --git a/docs/src/i18n/en.json b/docs/src/i18n/en.json
index d247e3a..41335e2 100644
--- a/docs/src/i18n/en.json
+++ b/docs/src/i18n/en.json
@@ -330,7 +330,6 @@
"开发者朋友们": "developer friends",
"这是{0},欢迎{1},如果你觉得{2},请给予{3}支持": "This is {0}, welcome to {1}. If you think {2}, please give {3} your support",
"使用": "use",
- "不错": "it's good",
"hello {0}world{1}": "hello {0}world{1}",
"格式": "Format",
"例如": "For example",
@@ -386,6 +385,7 @@
"不能正常提取{0}": "Can't extract {0}",
"贡献指南": "Contribution Guidelines",
"首先,对各位想要参与到本项目来表示热烈欢迎{0}": "First of all, a warm welcome to those who want to participate in this project {0}",
- "但是抱歉的是,当前文档还在规划完善中...(也许可以从该文档开始)": "But sorry, the current document is still being planned and improved... (maybe you can start from this document)",
- "最后,请不要丢失你的热情,请持续保持关注!": "Finally, please don't lose your enthusiasm, please continue to pay attention!"
+ "最后,请不要丢失你的热情,请持续保持关注!": "Finally, please don't lose your enthusiasm, please continue to pay attention!",
+ "但是抱歉的是,当前文档还在规划完善中...(也许你可以从该文档开始,写文档绝不是一件容易的事😂)": "But sorry, the current document is still being planned and improved... (Maybe you can start from this document, writing documents is not an easy task 😂)",
+ "对你有帮助": "it's helpful for you"
}
diff --git a/docs/src/readme/Principle.tsx b/docs/src/readme/Principle.tsx
index a679388..6ac0618 100644
--- a/docs/src/readme/Principle.tsx
+++ b/docs/src/readme/Principle.tsx
@@ -62,7 +62,9 @@ t(\`hello world\`)
t('hello {0}', '${tr('开发者朋友们')}'),
t('${tr(
'这是{0},欢迎{1},如果你觉得{2},请给予{3}支持',
- )}', ' \`i18n-pro\` ', '${tr('使用')}', \`${tr('不错')}\`, ' ⭐️ ')
+ )}', ' \`i18n-pro\` ', '${tr('使用')}', \`${tr(
+ '对你有帮助',
+ )}\`, ' ⭐️ ')
/** ${tr(
diff --git a/docs/src/readme/Top.tsx b/docs/src/readme/Top.tsx
index 1530f8c..d86f07e 100644
--- a/docs/src/readme/Top.tsx
+++ b/docs/src/readme/Top.tsx
@@ -1,37 +1,6 @@
import { Image, Link, Break } from 'jsx-to-md'
-import { linkObj, imageObj, langs } from '../constants'
-import { homepage, version } from '../../../package.json'
-
-const separator = ' | '
-
-function renderLanguage() {
- const res = langs.reduce((res, item, index) => {
- const { code, locale, name } = item
- const EN_URL = `${homepage}/tree/v${version}#readme`
- const OTHER_URL = `${homepage}/blob/v${version}/README_${locale}.md`
-
- if (global.docLocale == code) {
- res.push(name)
- } else {
- res.push({name})
- }
-
- if (index != langs.length - 1) {
- res.push(separator)
- }
-
- return res
- }, [])
- return (
- <>
-
-
- {res}
-
-
- >
- )
-}
+import { linkObj, imageObj } from '../constants'
+import { renderLanguage } from '../utils'
export default function Top() {
const props = {
@@ -45,7 +14,7 @@ export default function Top() {
- {renderLanguage()}
+ {renderLanguage('README')}
{tr('适用于 JavaScript 的轻量、简单、灵活、自动翻译的国际化工具')}
diff --git a/docs/src/utils.tsx b/docs/src/utils.tsx
index 0d3f18e..f4b30a2 100644
--- a/docs/src/utils.tsx
+++ b/docs/src/utils.tsx
@@ -1,8 +1,9 @@
-import { getAnchor } from 'jsx-to-md'
+import { Break, getAnchor, Link } from 'jsx-to-md'
import { initI18n as originInitI18n } from '@lib'
import { readFileSync } from 'fs'
import en from './i18n/en.json'
import packageInfo from '../../package.json'
+import { langs } from './constants'
const { t, setI18n } = originInitI18n({ namespace: 'default' })
@@ -19,10 +20,14 @@ export function initI18n({ locale }) {
global.docLocale = locale
}
-export function getDocHref(filename: string, anchorProp?: string) {
+export function getDocHref(
+ filename: string,
+ anchorProp?: string,
+ localeProp?: string,
+) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const { version: originVersion, codeNameMap, homepage } = packageInfo
- const locale = global.docLocale
+ const locale = localeProp || global.docLocale
let name = codeNameMap[locale]
name = name ? `_${name}` : ''
const anchor = anchorProp ? getAnchor(anchorProp) : ''
@@ -37,7 +42,7 @@ export function getDocHref(filename: string, anchorProp?: string) {
if (filename === 'README') {
return locale === 'en'
- ? `${homepage}/tree/${version}${anchor}`
+ ? `${homepage}/tree/${version}${anchor || '#readme'}`
: `${homepage}/blob/${version}/${filename}${name}.md${anchor}`
} else {
return `${homepage}/blob/${version}/docs/dist/${filename}${name}.md${anchor}`
@@ -118,3 +123,32 @@ t('${tr(
)}', 5, 4, 3) `
return text
}
+
+export function renderLanguage(filename: string) {
+ const separator = ' | '
+
+ const res = langs.reduce((res, item, index) => {
+ const { code, name } = item
+
+ if (global.docLocale == code) {
+ res.push(name)
+ } else {
+ res.push({name})
+ }
+
+ if (index != langs.length - 1) {
+ res.push(separator)
+ }
+
+ return res
+ }, [])
+ return (
+ <>
+
+
+ {res}
+
+
+ >
+ )
+}