fix(i18n): Add optional chaining
This commit is contained in:
parent
d53bb8e6fb
commit
d7f6613345
1 changed files with 3 additions and 4 deletions
|
@ -86,15 +86,14 @@ for (let pattern of Object.keys(patterns)) {
|
||||||
if (typeof value === 'object') options[pattern][option] = value
|
if (typeof value === 'object') options[pattern][option] = value
|
||||||
else {
|
else {
|
||||||
if (typeof value === 'undefined') {
|
if (typeof value === 'undefined') {
|
||||||
if (typeof patterns[shared[pattern].dflt][option] === 'object')
|
if (typeof patterns?.[shared?.[pattern]?.dflt]?.[option] === 'object')
|
||||||
options[pattern][option] = patterns[shared[pattern].dflt][option]
|
options[pattern][option] = patterns[shared[pattern].dflt][option]
|
||||||
else if (
|
else if (
|
||||||
typeof shared[pattern].other !== 'undefined' &&
|
typeof shared?.[pattern]?.other !== 'undefined' &&
|
||||||
typeof shared[pattern].other[option] === 'string'
|
typeof shared?.[pattern]?.other?.[option] === 'string'
|
||||||
)
|
)
|
||||||
options[pattern][option] = patterns[shared[pattern].other[option]][option]
|
options[pattern][option] = patterns[shared[pattern].other[option]][option]
|
||||||
else {
|
else {
|
||||||
console.log(options[pattern])
|
|
||||||
throw new Error(`No option translation found for ${option} in ${pattern}`)
|
throw new Error(`No option translation found for ${option} in ${pattern}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue