Skip to content

Commit

Permalink
fix: translation cached file structure fix
Browse files Browse the repository at this point in the history
  • Loading branch information
web-mi committed Feb 2, 2024
1 parent a7783e2 commit 86ffd90
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions proxy/routes/weblate.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module.exports = (storagePath) => {
fs.promises
.writeFile(
localeFilePath,
JSON.stringify({ ts: new Date().getTime(), ...data })
JSON.stringify({ ...data, ts: new Date().getTime() })
)
.then(() => {
console.log(`Translation ${cacheFile} renewed`);
Expand Down Expand Up @@ -186,7 +186,10 @@ module.exports = (storagePath) => {

// Save the new loaded data to file system and reset require cache
try {
saveFilesystem(`${ns}.${lng}.json`, data);
saveFilesystem(
`${ns}.${lng}.json`,
translationData
);
} catch {
// Do nothing we already show an error on loading
}
Expand Down

0 comments on commit 86ffd90

Please sign in to comment.