-
Notifications
You must be signed in to change notification settings - Fork 3
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
dc8f002
commit 3ad9aed
Showing
10 changed files
with
239 additions
and
51 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
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,10 @@ | ||
export default { | ||
debugger: true, | ||
// This is the list of languages your application supports | ||
supportedLngs: ["en", "ja"], | ||
// This is the language you want to use in case | ||
// if the user language is not in the supportedLngs | ||
fallbackLng: "en", | ||
// The default namespace of i18next is "translation", but you can customize it here | ||
defaultNS: "common", | ||
}; |
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,28 @@ | ||
import Backend from "i18next-fs-backend"; | ||
import { resolve } from "node:path"; | ||
import { RemixI18Next } from "remix-i18next/server"; | ||
import i18n from "~/i18n"; // your i18n configuration file | ||
|
||
/** | ||
* This is the i18next instance that will be used to translate messages server-side | ||
*/ | ||
const i18next = new RemixI18Next({ | ||
detection: { | ||
supportedLanguages: i18n.supportedLngs, | ||
fallbackLanguage: i18n.fallbackLng, | ||
}, | ||
// This is the configuration for i18next used | ||
// when translating messages server-side only | ||
i18next: { | ||
...i18n, | ||
backend: { | ||
loadPath: resolve("./public/locales/{{lng}}/{{ns}}.json"), | ||
}, | ||
}, | ||
// The i18next plugins you want RemixI18next to use for `i18n.getFixedT` inside loaders and actions. | ||
// E.g. The Backend plugin for loading translations from the file system | ||
// Tip: You could pass `resources` to the `i18next` configuration and avoid a backend here | ||
plugins: [Backend], | ||
}); | ||
|
||
export default i18next; |
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,3 @@ | ||
{ | ||
"title": "remix-i18n is awesome" | ||
} |
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,3 @@ | ||
{ | ||
"title": "remix-i18n は凄い!" | ||
} |
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.