-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from vordgi/nt-85
nt-85 release 2.0.0
- Loading branch information
Showing
38 changed files
with
1,281 additions
and
727 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,2 @@ | ||
const withI18n = require('@nimpl/i18n/withI18n').default; | ||
|
||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {}; | ||
|
||
module.exports = async (phase) => { | ||
const withTranslation = await withI18n(phase); | ||
return withTranslation(nextConfig); | ||
}; | ||
module.exports = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
const fs = require('fs/promises') | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const fs = require("fs/promises"); | ||
|
||
const memo = {}; | ||
|
||
/** @type {import('@nimpl/i18n/configuration/types').Config} */ | ||
module.exports = { | ||
load: async (lang) => { | ||
const data = await fs.readFile(`./translates/${lang}.json`).then((data) => JSON.parse(data)) | ||
console.log('load ' + lang); | ||
return { data }; | ||
}, | ||
/** | ||
* In development mode, the data will be updated each 10 seconds to load changes in files, | ||
* there is no need to track changes in files during the build and after it. | ||
* For other situations, the option can be configured differently | ||
*/ | ||
revalidate: process.env.NODE_ENV === 'development' ? 10 : false, | ||
languages: ['de', 'fr', 'en'], | ||
} | ||
load: async (language) => { | ||
memo[language] ||= fs | ||
.readFile(`./translates/${language}.json`) | ||
.then((data) => JSON.parse(data)) | ||
.then((data) => { | ||
delete memo[language]; | ||
return data; | ||
}); | ||
const dictionary = await memo[language]; | ||
return dictionary; | ||
}, | ||
getLanguage: async ({ params }) => params.lang || "en", | ||
languages: ["en", "fr", "de"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.