Default locale to en
This commit is contained in:
parent
0ed10658a3
commit
01f96fe6af
1 changed files with 2 additions and 1 deletions
|
@ -19,10 +19,11 @@ const getExtensionMetadata = (extensionId) => {
|
||||||
|
|
||||||
const getMessagesPath = (extensionId, language) => {
|
const getMessagesPath = (extensionId, language) => {
|
||||||
const {srcDirectory, default_locale} = getExtensionMetadata(extensionId)
|
const {srcDirectory, default_locale} = getExtensionMetadata(extensionId)
|
||||||
|
const defaultLocale = default_locale != null ? default_locale : 'en'
|
||||||
const localesDirectory = path.join(srcDirectory, '_locales')
|
const localesDirectory = path.join(srcDirectory, '_locales')
|
||||||
let messagesPath = path.join(localesDirectory, language, 'messages.json')
|
let messagesPath = path.join(localesDirectory, language, 'messages.json')
|
||||||
if (!fs.statSyncNoException(messagesPath)) {
|
if (!fs.statSyncNoException(messagesPath)) {
|
||||||
messagesPath = path.join(localesDirectory, default_locale, 'messages.json')
|
messagesPath = path.join(localesDirectory, defaultLocale, 'messages.json')
|
||||||
}
|
}
|
||||||
return messagesPath
|
return messagesPath
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue