-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3131 from hLinx/hotfix_3.9.x
Hotfix 3.9.x
- Loading branch information
Showing
190 changed files
with
5,158 additions
and
3,395 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// const fs = require('fs'); | ||
// const path = require('path'); | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import { fileURLToPath } from 'url'; | ||
|
||
const recur = async (target) => { | ||
const state = fs.statSync(target); | ||
if (state.isFile()) { | ||
if (/local.js$/.test(target)) { | ||
console.log(`JAVASCRIPT: ${target}`); | ||
const distDir = path.join(path.dirname(target), 'language'); | ||
const stats = fs.statSync(distDir); | ||
if (!stats.isDirectory()) { | ||
await fs.mkdirSync(distDir); | ||
} | ||
|
||
|
||
const data = await import(target); | ||
|
||
const { message, namespace } = data.default; | ||
const znData = {}; | ||
const enData = {}; | ||
console.log('data = ', data); | ||
Object.keys(message).forEach((key) => { | ||
if (typeof message[key] === 'string') { | ||
znData[key] = key; | ||
enData[key] = message[key]; | ||
} else if (typeof message[key] === 'object') { | ||
Object.keys(message[key]).forEach((key2) => { | ||
znData[`${key}_${key2}`] = key; | ||
enData[`${key}_${key2}`] = message[key][key2]; | ||
}); | ||
} | ||
}); | ||
fs.writeFileSync( | ||
path.join(distDir, 'index.js'), | ||
` | ||
import zhCN from './zh.json'; | ||
import enUS from './en.json'; | ||
export default { | ||
${namespace}: { | ||
'zh-CN': zhCN, | ||
'en-US': enUS, | ||
} | ||
} | ||
`, | ||
); | ||
fs.writeFileSync(path.join(distDir, 'zh.json'), JSON.stringify(znData, null, 2)); | ||
fs.writeFileSync(path.join(distDir, 'en.json'), JSON.stringify(enData, null, 2)); | ||
console.log('lang = ', znData, enData, '\n'); | ||
} | ||
} else if (state.isDirectory()) { | ||
const dirList = fs.readdirSync(target); | ||
dirList.forEach((item) => { | ||
recur(path.join(target, item)); | ||
}); | ||
} | ||
}; | ||
|
||
recur(path.join(path.dirname(fileURLToPath(import.meta.url)), './src/views')); | ||
|
||
const { default: message } = await import(path.join(path.dirname(fileURLToPath(import.meta.url)), './src/i18n/local.js')); | ||
|
||
|
||
const znData = {}; | ||
const enData = {}; | ||
Object.keys(message).forEach((key) => { | ||
if (typeof message[key] === 'string') { | ||
znData[key] = key; | ||
enData[key] = message[key]; | ||
} else if (typeof message[key] === 'object') { | ||
Object.keys(message[key]).forEach((key2) => { | ||
znData[`${key}_${key2}`] = key; | ||
enData[`${key}_${key2}`] = message[key][key2]; | ||
}); | ||
} | ||
}); | ||
|
||
fs.writeFileSync(path.join(path.join(path.dirname(fileURLToPath(import.meta.url)), 'src/i18n/language'), 'zh.json'), JSON.stringify(znData, null, 2)); | ||
fs.writeFileSync(path.join(path.join(path.dirname(fileURLToPath(import.meta.url)), 'src/i18n/language'), 'en.json'), JSON.stringify(enData, null, 2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -508,7 +508,7 @@ | |
border: none; | ||
outline: none; | ||
|
||
&:placeholder { | ||
&::placeholder { | ||
color: #c4c6cc; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.