mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
15
.github/workflows/publish-docs-deploy-manual.yml
vendored
15
.github/workflows/publish-docs-deploy-manual.yml
vendored
@@ -69,7 +69,7 @@ jobs:
|
||||
git-config-email: element-plus@outlook.com
|
||||
commit-message: website deploy
|
||||
|
||||
- name: Deploy to vercel
|
||||
- name: Deploy to Vercel
|
||||
uses: JamesIves/github-pages-deploy-action@v4.4.1
|
||||
with:
|
||||
token: ${{ secrets.EP_BOT_TOKEN }}
|
||||
@@ -79,7 +79,12 @@ jobs:
|
||||
git-config-name: ElementPlusBot
|
||||
git-config-email: element-plus@outlook.com
|
||||
|
||||
- name: Sync
|
||||
env:
|
||||
TRIGGERSYNCURL: ${{ secrets.TRIGGERSYNCURL }}
|
||||
run: curl -k "$TRIGGERSYNCURL"
|
||||
- name: Deploy to Vercel Main
|
||||
uses: JamesIves/github-pages-deploy-action@v4.4.1
|
||||
with:
|
||||
token: ${{ secrets.EP_BOT_TOKEN }}
|
||||
branch: main
|
||||
folder: docs/.vitepress/dist
|
||||
repository-name: element-plus/vercel-publish-main
|
||||
git-config-name: ElementPlusBot
|
||||
git-config-email: element-plus@outlook.com
|
||||
|
||||
15
.github/workflows/publish-docs-deploy.yml
vendored
15
.github/workflows/publish-docs-deploy.yml
vendored
@@ -76,7 +76,7 @@ jobs:
|
||||
git-config-email: element-plus@outlook.com
|
||||
commit-message: website deploy
|
||||
|
||||
- name: Deploy to vercel
|
||||
- name: Deploy to Vercel
|
||||
uses: JamesIves/github-pages-deploy-action@v4.4.1
|
||||
with:
|
||||
token: ${{ secrets.EP_BOT_TOKEN }}
|
||||
@@ -86,7 +86,12 @@ jobs:
|
||||
git-config-name: ElementPlusBot
|
||||
git-config-email: element-plus@outlook.com
|
||||
|
||||
- name: Sync
|
||||
env:
|
||||
TRIGGERSYNCURL: ${{ secrets.TRIGGERSYNCURL }}
|
||||
run: curl -k "$TRIGGERSYNCURL"
|
||||
- name: Deploy to Vercel Main
|
||||
uses: JamesIves/github-pages-deploy-action@v4.4.1
|
||||
with:
|
||||
token: ${{ secrets.EP_BOT_TOKEN }}
|
||||
branch: main
|
||||
folder: docs/.vitepress/dist
|
||||
repository-name: element-plus/vercel-publish-main
|
||||
git-config-name: ElementPlusBot
|
||||
git-config-email: element-plus@outlook.com
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import { vpRoot } from '@element-plus/build-utils'
|
||||
import { languages } from '../utils/lang'
|
||||
|
||||
import type { HeadConfig } from 'vitepress'
|
||||
|
||||
export const head: HeadConfig[] = [
|
||||
@@ -49,15 +44,6 @@ export const head: HeadConfig[] = [
|
||||
content: 'codeva-q5gBxYcfOs',
|
||||
},
|
||||
],
|
||||
[
|
||||
'script',
|
||||
{},
|
||||
`;(() => {
|
||||
window.supportedLangs = ${JSON.stringify(languages)}
|
||||
})()`,
|
||||
],
|
||||
|
||||
['script', {}, fs.readFileSync(path.resolve(vpRoot, 'lang.js'), 'utf-8')],
|
||||
[
|
||||
'script',
|
||||
{
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
;(() => {
|
||||
const supportedLangs = window.supportedLangs
|
||||
const cacheKey = 'preferred_lang'
|
||||
const defaultLang = 'en-US'
|
||||
const handleNavigatorLang = (navLang) => {
|
||||
const { language, region } = new Intl.Locale(navLang).maximize()
|
||||
return `${language}-${region}`
|
||||
}
|
||||
let userPreferredLang =
|
||||
localStorage.getItem(cacheKey) || handleNavigatorLang(navigator.language)
|
||||
const language = supportedLangs.includes(userPreferredLang)
|
||||
? userPreferredLang
|
||||
: defaultLang
|
||||
localStorage.setItem(cacheKey, language)
|
||||
userPreferredLang = language
|
||||
if (!location.pathname.startsWith(`/${userPreferredLang}`)) {
|
||||
const toPath = [`/${userPreferredLang}`]
|
||||
.concat(location.pathname.split('/').slice(2))
|
||||
.join('/')
|
||||
location.pathname =
|
||||
toPath.endsWith('.html') || toPath.endsWith('/')
|
||||
? toPath
|
||||
: toPath.concat('/')
|
||||
}
|
||||
})()
|
||||
Reference in New Issue
Block a user