mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add en localeMessages to test states.
This commit is contained in:
parent
ca5bce477e
commit
edf63f8b51
@ -1,6 +1,7 @@
|
|||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const promisify = require('pify')
|
const promisify = require('pify')
|
||||||
|
const getLocaleMessages = require('./get-locale-messages')
|
||||||
|
|
||||||
start().catch(console.error)
|
start().catch(console.error)
|
||||||
|
|
||||||
@ -12,6 +13,10 @@ async function start () {
|
|||||||
const stateFilePath = path.join(__dirname, 'states', stateFileName)
|
const stateFilePath = path.join(__dirname, 'states', stateFileName)
|
||||||
const stateFileContent = await promisify(fs.readFile)(stateFilePath, 'utf8')
|
const stateFileContent = await promisify(fs.readFile)(stateFilePath, 'utf8')
|
||||||
const state = JSON.parse(stateFileContent)
|
const state = JSON.parse(stateFileContent)
|
||||||
|
|
||||||
|
const enLocaleMessages = await getLocaleMessages()
|
||||||
|
state.localeMessages = { en: enLocaleMessages, current: {} }
|
||||||
|
|
||||||
const stateName = stateFileName.split('.')[0].replace(/-/g, ' ', 'g')
|
const stateName = stateFileName.split('.')[0].replace(/-/g, ' ', 'g')
|
||||||
states[stateName] = state
|
states[stateName] = state
|
||||||
}))
|
}))
|
||||||
|
12
development/get-locale-messages.js
Normal file
12
development/get-locale-messages.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
|
const promisify = require('pify')
|
||||||
|
|
||||||
|
async function getLocaleMessages () {
|
||||||
|
const localeMessagesPath = path.join(process.cwd(), 'app', '_locales', 'en', 'messages.json')
|
||||||
|
const enLocaleMessagesJSON = await promisify(fs.readFile)(localeMessagesPath)
|
||||||
|
const enLocaleMessages = JSON.parse(enLocaleMessagesJSON)
|
||||||
|
return enLocaleMessages
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = getLocaleMessages
|
Loading…
x
Reference in New Issue
Block a user