Skip to content

Commit 3de8a5c

Browse files
authored
fix: compatible with lower version node (#732)
1 parent 105e0fd commit 3de8a5c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

utils/getLanguage.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,12 @@ function getLocale() {
107107
}
108108

109109
async function loadLanguageFile(filePath: string): Promise<Language> {
110-
return (await import(pathToFileURL(filePath).toString(), { with: { type: 'json' } })).default
110+
return await fs.promises.readFile(filePath, 'utf-8').then((data) => {
111+
const parsedData = JSON.parse(data)
112+
if (parsedData) {
113+
return parsedData
114+
}
115+
})
111116
}
112117

113118
export default async function getLanguage(localesRoot: string) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy