-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(i18n): globally mocks translation function
- Loading branch information
Showing
11 changed files
with
52 additions
and
52 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
5 changes: 2 additions & 3 deletions
5
src/Apps/Artwork/Components/ArtworkSidebar2/__tests__/ArtworkSidebar2ArtsyGuarantee.jest.tsx
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
3 changes: 1 addition & 2 deletions
3
src/Apps/Settings/Routes/Insights/Components/__tests__/InsightsHeader.jest.tsx
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
3 changes: 1 addition & 2 deletions
3
src/Components/Notifications/__tests__/MarkAllAsReadPanel.jest.tsx
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,15 @@ | ||
import i18n from "i18next" | ||
import config from "System/i18n/config" | ||
|
||
i18n.init(config) | ||
|
||
export const useTranslation = () => { | ||
return { | ||
t: i18n.t, | ||
} | ||
} | ||
|
||
export const initReactI18next = { | ||
type: "3rdParty", | ||
init: () => {}, | ||
} |
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,24 @@ | ||
import { getENV } from "Utils/getENV" | ||
|
||
// TODO: Serve static assets on the server-side | ||
const translations = require("System/i18n/locales/en-US/translation.json") | ||
|
||
export default { | ||
debug: getENV("ENABLE_I18N_DEBUG") === "true", | ||
resources: { | ||
["en-US"]: { | ||
translation: translations, | ||
}, | ||
}, | ||
detection: { | ||
order: ["querystring"], | ||
lookupQuerystring: "locale", | ||
}, | ||
supportedLngs: ["en-US"], | ||
fallbackLng: "en-US", | ||
defaultNS: "translation", | ||
fallbackNS: "translation", | ||
interpolation: { | ||
escapeValue: false, | ||
}, | ||
} |
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,28 +1,7 @@ | ||
import i18n from "i18next" | ||
import { initReactI18next } from "react-i18next" | ||
import { getENV } from "Utils/getENV" | ||
import config from "System/i18n/config" | ||
|
||
// TODO: Serve static assets on the server-side | ||
const translations = require("System/i18n/locales/en-US/translation.json") | ||
|
||
i18n.use(initReactI18next).init({ | ||
debug: getENV("ENABLE_I18N_DEBUG") === "true", | ||
resources: { | ||
["en-US"]: { | ||
translation: translations, | ||
}, | ||
}, | ||
detection: { | ||
order: ["querystring"], | ||
lookupQuerystring: "locale", | ||
}, | ||
supportedLngs: ["en-US"], | ||
fallbackLng: "en-US", | ||
defaultNS: "translation", | ||
fallbackNS: "translation", | ||
interpolation: { | ||
escapeValue: false, | ||
}, | ||
}) | ||
i18n.use(initReactI18next).init(config) | ||
|
||
export default i18n |