First step to use Language .json file in ejs

This commit is contained in:
Kamesuta 2023-08-05 17:25:35 +09:00
parent 92f2aab2a1
commit 1695b51cf8
4 changed files with 16 additions and 1 deletions

View File

@ -18,4 +18,8 @@ exports.query = function(id){
exports.queryJS = function(id){ exports.queryJS = function(id){
return exports.query(`js.${id}`) return exports.query(`js.${id}`)
}
exports.queryEJS = function(id){
return exports.query(`ejs.${id}`)
} }

View File

@ -2,6 +2,11 @@
"html": { "html": {
"avatarOverlay": "Edit" "avatarOverlay": "Edit"
}, },
"ejs": {
"landing": {
"news": "NEWS"
}
},
"js": { "js": {
"login": { "login": {
"error": { "error": {

View File

@ -133,7 +133,7 @@
</defs> </defs>
<polyline class="arrowLine" points="0.71 13.26 12.56 1.41 24.16 13.02"/> <polyline class="arrowLine" points="0.71 13.26 12.56 1.41 24.16 13.02"/>
</svg> </svg>
&#10;<span id="newsButtonText">NEWS</span> &#10;<span id="newsButtonText"><%- lang('landing.news') %></span>
</button> </button>
</div> </div>
</div> </div>

View File

@ -12,6 +12,10 @@ const semver = require('semver')
const { pathToFileURL } = require('url') const { pathToFileURL } = require('url')
const { AZURE_CLIENT_ID, MSFT_OPCODE, MSFT_REPLY_TYPE, MSFT_ERROR, SHELL_OPCODE } = require('./app/assets/js/ipcconstants') const { AZURE_CLIENT_ID, MSFT_OPCODE, MSFT_REPLY_TYPE, MSFT_ERROR, SHELL_OPCODE } = require('./app/assets/js/ipcconstants')
// Setup Lang
const LangLoader = require('./app/assets/js/langloader')
LangLoader.loadLanguage('en_US')
// Setup auto updater. // Setup auto updater.
function initAutoUpdater(event, data) { function initAutoUpdater(event, data) {
@ -237,6 +241,8 @@ function createWindow() {
remoteMain.enable(win.webContents) remoteMain.enable(win.webContents)
ejse.data('bkid', Math.floor((Math.random() * fs.readdirSync(path.join(__dirname, 'app', 'assets', 'images', 'backgrounds')).length))) ejse.data('bkid', Math.floor((Math.random() * fs.readdirSync(path.join(__dirname, 'app', 'assets', 'images', 'backgrounds')).length)))
ejse.data('Lang', LangLoader)
ejse.data('lang', LangLoader.queryEJS)
win.loadURL(pathToFileURL(path.join(__dirname, 'app', 'app.ejs')).toString()) win.loadURL(pathToFileURL(path.join(__dirname, 'app', 'app.ejs')).toString())