Skip to content

Commit 69ea517

Browse files
committed
(@fluent/react) Remove fallbackL10n
1 parent 0f58ae6 commit 69ea517

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

fluent-react/src/useTranslate.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,13 @@ import { useContext } from "react";
22
import { FluentContext } from "./context";
33
import { ReactLocalization } from "./localization";
44

5-
// Implementation of null object pattern for ReactLocalization
6-
const fallbackL10n: ReactLocalization = {
7-
getString: id => id,
8-
getBundle: () => null,
9-
bundles: [],
10-
parseMarkup: null,
11-
reportError: () => undefined,
12-
};
13-
145
/*
156
* The `useTranslate` hook returns the FluentContext
167
*/
178
type useTranslate = () => { l10n: ReactLocalization }
189
export const useTranslate: useTranslate = () => {
1910
const l10n = useContext(FluentContext);
2011

21-
if (!l10n) {
22-
return { l10n: fallbackL10n };
23-
}
24-
2512
return { l10n };
2613
};
2714

0 commit comments

Comments
 (0)