-
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.
- Loading branch information
1 parent
62aec1f
commit 9548b43
Showing
18 changed files
with
971 additions
and
42 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"presets": ["next/babel"], | ||
"plugins": [ | ||
[ | ||
"formatjs", | ||
{ | ||
"ast": true | ||
} | ||
] | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"CHu6Xm": "Total Spend (month)", | ||
"HXoCik": "Settings", | ||
"M4hPoZ": "Dashboard", | ||
"a9m3iY": "{amount} $", | ||
"bQAtuf": "Loading...", | ||
"jyUN7v": "Overview", | ||
"kDqURM": "Logout", | ||
"yMjntE": "Dashboard" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"HXoCik": "セッティング", | ||
"M4hPoZ": "ホーム", | ||
"a9m3iY": "{amount} 円", | ||
"bQAtuf": "ローディング中", | ||
"jyUN7v": "Overview", | ||
"kDqURM": "ログアウト", | ||
"yMjntE": "ホーム" | ||
} |
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
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
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
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import fs from "fs/promises"; | ||
import path from "path"; | ||
|
||
type LoadI18nMessagesProps = { | ||
locale: string; | ||
defaultLocale: string; | ||
}; | ||
|
||
type MessageConfig = { [key: string]: string }; | ||
|
||
export default async function loadI18nMessages({ | ||
locale, | ||
defaultLocale, | ||
}: LoadI18nMessagesProps): Promise<MessageConfig> { | ||
// If the default locale is being used we can skip it | ||
if (locale === defaultLocale) { | ||
return {}; | ||
} | ||
|
||
if (locale !== defaultLocale) { | ||
const languagePath = path.join( | ||
process.cwd(), | ||
`compiled-lang/${locale}.json` | ||
); | ||
try { | ||
const contents = await fs.readFile(languagePath, "utf-8"); | ||
return JSON.parse(contents); | ||
} catch (error) { | ||
console.info( | ||
'Could not load compiled language files. Please run "npm run i18n:compile" first"' | ||
); | ||
console.error(error); | ||
} | ||
} | ||
return {}; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"CHu6Xm": { | ||
"defaultMessage": "Total Spend (month)", | ||
"description": "TotalSpendCard title" | ||
}, | ||
"HXoCik": { | ||
"defaultMessage": "Settings", | ||
"description": "navbar dropdown option" | ||
}, | ||
"M4hPoZ": { | ||
"defaultMessage": "Dashboard", | ||
"description": "navbar" | ||
}, | ||
"a9m3iY": { | ||
"defaultMessage": "{amount} $", | ||
"description": "monetary amount readout" | ||
}, | ||
"bQAtuf": { | ||
"defaultMessage": "Loading...", | ||
"description": "default loading" | ||
}, | ||
"jyUN7v": { | ||
"defaultMessage": "Overview", | ||
"description": "index header subTitle" | ||
}, | ||
"kDqURM": { | ||
"defaultMessage": "Logout", | ||
"description": "navbar dropdown option" | ||
}, | ||
"yMjntE": { | ||
"defaultMessage": "Dashboard", | ||
"description": "index header title" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"HXoCik": { | ||
"defaultMessage": "セッティング", | ||
"description": "navbar dropdown option" | ||
}, | ||
"M4hPoZ": { | ||
"defaultMessage": "ホーム", | ||
"description": "navbar" | ||
}, | ||
"jyUN7v": { | ||
"defaultMessage": "Overview", | ||
"description": "index header subTitle" | ||
}, | ||
"kDqURM": { | ||
"defaultMessage": "ログアウト", | ||
"description": "navbar dropdown option" | ||
}, | ||
"yMjntE": { | ||
"defaultMessage": "ホーム", | ||
"description": "index header title" | ||
}, | ||
"bQAtuf": { | ||
"defaultMessage": "ローディング中", | ||
"description": "default loading" | ||
}, | ||
"a9m3iY": { | ||
"defaultMessage": "{amount} 円", | ||
"description": "monetary amount readout" | ||
} | ||
} |
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,4 +1,17 @@ | ||
/** @type {import('next').NextConfig} */ | ||
module.exports = { | ||
reactStrictMode: true, | ||
} | ||
i18n: { | ||
locales: ["en", "ja"], | ||
defaultLocale: "en", | ||
localeDetection: true, | ||
}, | ||
webpack(config, { dev, ...other }) { | ||
if (!dev) { | ||
// https://formatjs.io/docs/guides/advanced-usage#react-intl-without-parser-40-smaller | ||
config.resolve.alias["@formatjs/icu-messageformat-parser"] = | ||
"@formatjs/icu-messageformat-parser/no-parser"; | ||
} | ||
return config; | ||
}, | ||
}; |
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
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.