Skip to content

Commit

Permalink
feat(site): the official website temporarily blocks English (#2199)
Browse files Browse the repository at this point in the history
  • Loading branch information
zzcr authored Sep 27, 2024
1 parent 9a6114e commit 41f9ca8
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 21 deletions.
3 changes: 2 additions & 1 deletion examples/sites/src/i18n/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import zh from './zh.json'
import en from './en.json'

const messages = { enUS: en, zhCN: zh }
$local._lang = $local._lang !== 'zhCN' && $local._lang !== 'enUS' ? 'zhCN' : $local._lang
// $local._lang = $local._lang !== 'zhCN' && $local._lang !== 'enUS' ? 'zhCN' : $local._lang
$local._lang = 'zhCN'
const customCreateI18n = ({ locale, messages }) =>
createI18n({
locale, // set locale
Expand Down
3 changes: 2 additions & 1 deletion examples/sites/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ const isZhCn = location.href.includes(`/${zhPath}`)
const isEnUs = location.href.includes(`/${enPath}`)
const notMatchLang = (isZhCn && appData.lang !== ZH_CN_LANG) || (isEnUs && appData.lang !== EN_US_LANG)
if (notMatchLang) {
appData.lang = isEnUs ? EN_US_LANG : ZH_CN_LANG
// appData.lang = isEnUs ? EN_US_LANG : ZH_CN_LANG 官网先屏蔽英文内容
appData.lang = isEnUs ? ZH_CN_LANG : ZH_CN_LANG
i18n.global.locale = appData.lang
}

Expand Down
4 changes: 2 additions & 2 deletions examples/sites/src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ const context = import.meta.env.VITE_CONTEXT
let routes = [
// 组件总览
{
path: `${context}:all?/:lang/:theme/overview`,
path: `${context}:all?/zh-CN/:theme/overview`,
component: Layout,
name: 'overview',
children: [{ name: 'Overview', path: '', component: Overview, meta: { title: '组件总览 | TinyVue' } }]
},
// 组件
{
path: `${context}:all?/:lang/:theme/components/:cmpId`,
path: `${context}:all?/zh-CN/:theme/components/:cmpId`,
component: Layout,
name: 'components',
children: [{ name: 'Components', path: '', component: Components }]
Expand Down
3 changes: 2 additions & 1 deletion examples/sites/src/tools/appData.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const appFn = {
if (name !== appData.lang) {
let url = location.href
url = location.href.replace(LANG_PATH_MAP[appData.lang], LANG_PATH_MAP[name])
appData.lang = name
// appData.lang = name 官网先屏蔽英文内容
appData.lang = ZH_CN_LANG
location.replace(url)
}
},
Expand Down
33 changes: 17 additions & 16 deletions examples/sites/src/tools/useStyleSettings.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
/** 文档显示风格设置 */
const getStyleSettings = (i18nByKey) => {
const styleSettings = [
{
// 语言选择
name: 'localeMode',
defaultValue: 'zhCN',
title: i18nByKey('localeType'),
options: [
{
value: 'zhCN',
text: i18nByKey('zh-cn')
},
{
value: 'enUS',
text: i18nByKey('en-us')
}
]
},
/** 官网英文适配后放开 */
// {
// // 语言选择
// name: 'localeMode',
// defaultValue: 'zhCN',
// title: i18nByKey('localeType'),
// options: [
// {
// value: 'zhCN',
// text: i18nByKey('zh-cn')
// },
// {
// value: 'enUS',
// text: i18nByKey('en-us')
// }
// ]
// },
{
// 示例代码风格
name: 'apiMode',
Expand Down

0 comments on commit 41f9ca8

Please sign in to comment.