Skip to content

Commit

Permalink
Fix locale.json path
Browse files Browse the repository at this point in the history
  • Loading branch information
Dianliang233 committed Feb 24, 2024
1 parent edbdaa7 commit e5fae14
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/mediawiki.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ declare module 'vue' {

declare global {
const __non_webpack_require__: <T = any>(id: string) => T
const __webpack_runtime_id__: string
}
5 changes: 3 additions & 2 deletions src/utils/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ function resolveFallback(
localMessages: Record<string, Record<string, string>>,
): Record<string, string> {
const messages = findMessages(resolvedLanguage, localMessages) as Record<string, string>
console.log(localMessages)
const fallbackChain = isKeyOfObject(resolvedLanguage, FALLBACK_CHAIN)
? FALLBACK_CHAIN[resolvedLanguage]
: FALLBACK_CHAIN.default
Expand All @@ -59,7 +58,9 @@ function findMessages(language: string, localMessages: Record<string, Record<str
} else {
const json =
process.env.NODE_ENV == 'production'
? __non_webpack_require__<Record<string, Record<string, string>>>(`./locale.json`)
? __non_webpack_require__<Record<string, Record<string, string>>>(
`./mcw-calc-${__webpack_runtime_id__}-locales.json`,
)
: {}

return isKeyOfObject(language, json) ? json[language] : {}
Expand Down

0 comments on commit e5fae14

Please sign in to comment.