refactor: move from next-international to next-intl (#1368)
* refactor: move from next-international to next-intl * refactor: restructure translation package, * chore: change i18n-allay framework to next-intl * fix: add missing bold html tag to translation * fix: format issue * fix: address deepsource issues * fix: remove international-types dependency * fix: lint and typecheck issues * fix: typecheck issue * fix: typecheck issue * fix: issue with translations
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
"use client";
|
||||
|
||||
import type { BadgeProps } from "@mantine/core";
|
||||
import { Badge } from "@mantine/core";
|
||||
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { useTranslations } from "@homarr/translation/client";
|
||||
|
||||
interface BetaBadgeProps {
|
||||
size: BadgeProps["size"];
|
||||
}
|
||||
|
||||
export const BetaBadge = ({ size }: BetaBadgeProps) => {
|
||||
const t = useI18n();
|
||||
const t = useTranslations();
|
||||
return (
|
||||
<Badge size={size} color="green" variant="outline">
|
||||
{t("common.beta")}
|
||||
|
||||
@@ -1,22 +1,14 @@
|
||||
import type { MRT_RowData, MRT_TableOptions } from "mantine-react-table";
|
||||
import { useMantineReactTable } from "mantine-react-table";
|
||||
import { MRT_Localization_EN } from "mantine-react-table/locales/en/index.cjs";
|
||||
|
||||
import { objectKeys } from "@homarr/common";
|
||||
import { useScopedI18n } from "@homarr/translation/client";
|
||||
import { useI18nMessages } from "@homarr/translation/client";
|
||||
|
||||
export const useTranslatedMantineReactTable = <TData extends MRT_RowData>(
|
||||
tableOptions: Omit<MRT_TableOptions<TData>, "localization">,
|
||||
) => {
|
||||
const t = useScopedI18n("common.mantineReactTable");
|
||||
const messages = useI18nMessages();
|
||||
return useMantineReactTable<TData>({
|
||||
...tableOptions,
|
||||
localization: objectKeys(MRT_Localization_EN).reduce(
|
||||
(acc, key) => {
|
||||
acc[key] = t(key);
|
||||
return acc;
|
||||
},
|
||||
{} as typeof MRT_Localization_EN,
|
||||
),
|
||||
localization: messages.common.mantineReactTable,
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user