Skip to content

Commit 8c61122

Browse files
committed
(@fluent/react) Rename useTranslate to useLocalization
1 parent 69ea517 commit 8c61122

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

fluent-react/example/src/SignIn.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from "react";
2-
import { Localized, useTranslate } from "@fluent/react";
2+
import { Localized, useLocalization } from "@fluent/react";
33

44
export function SignIn() {
5-
const { l10n } = useTranslate()
5+
const { l10n } = useLocalization()
66

77
function showAlert(id: string) {
88
alert(l10n.getString(id));

fluent-react/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ export { LocalizationProvider } from "./provider";
2222
export { withLocalization, WithLocalizationProps } from "./with_localization";
2323
export { Localized, LocalizedProps } from "./localized";
2424
export { MarkupParser } from "./markup";
25-
export { useTranslate } from "./useTranslate";
25+
export { useLocalization } from "./use_localization";

fluent-react/src/useTranslate.ts renamed to fluent-react/src/use_localization.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import { FluentContext } from "./context";
33
import { ReactLocalization } from "./localization";
44

55
/*
6-
* The `useTranslate` hook returns the FluentContext
6+
* The `useLocalization` hook returns the FluentContext
77
*/
8-
type useTranslate = () => { l10n: ReactLocalization }
9-
export const useTranslate: useTranslate = () => {
8+
type useLocalization = () => { l10n: ReactLocalization }
9+
export const useLocalization: useLocalization = () => {
1010
const l10n = useContext(FluentContext);
1111

1212
return { l10n };
1313
};
1414

15-
export default useTranslate;
15+
export default useLocalization;

0 commit comments

Comments
 (0)