BugFix: fixed translation formating

This commit is contained in:
2024-02-17 09:41:35 +01:00
parent 716fda63f1
commit fcd94408fe
8 changed files with 17 additions and 21 deletions

View File

@@ -11,11 +11,11 @@ export interface AddLocationButtonProps {
export const AddLocationButton:React.FC<AddLocationButtonProps> = ({yearMonth}) => {
const t = useTranslations("home-page.add-location-button");
const t = useTranslations("home-page");
return(
<div className="card card-compact card-bordered bg-base-100 shadow-s my-1">
<Link href={`/location/${ formatYearMonth(yearMonth) }/add`} className="card-body tooltip self-center" data-tip={t("tooltip")}>
<Link href={`/location/${ formatYearMonth(yearMonth) }/add`} className="card-body tooltip self-center" data-tip={t("add-location-button.tooltip")}>
<span className='flex self-center mr-[-3em]'>
<HomeIcon className="h-[1em] w-[1em] cursor-pointer text-4xl" />
<PlusCircleIcon className="h-[1em] w-[1em] cursor-pointer text-xl text-green-500 ml-[-.6em] mt-[-.4em]" />

View File

@@ -11,12 +11,12 @@ export interface AddMonthButtonProps {
export const AddMonthButton:React.FC<AddMonthButtonProps> = ({ yearMonth }) => {
const t = useTranslations("home-page.add-month-button");
const t = useTranslations("home-page");
const locale = useLocale();
return(
<div className="card card-compact shadow-s mb-4">
<Link href={`/${locale}/year-month/${formatYearMonth(yearMonth)}/add`} className='grid self-center tooltip' data-tip={t("tooltip")}>
<Link href={`/${locale}/year-month/${formatYearMonth(yearMonth)}/add`} className='grid self-center tooltip' data-tip={t("add-month-button.tooltip")}>
<span className='flex self-center mr-[-3em]'>
<CalendarDaysIcon className="h-[1em] w-[1em] cursor-pointer text-4xl" />
<PlusCircleIcon className="h-[1em] w-[1em] cursor-pointer text-xl text-green-500 ml-[-.4em] mt-[-.4em]" />

View File

@@ -29,7 +29,7 @@ export const BillDeleteForm:FC<BillDeleteFormProps> = ({ bill, location }) => {
t.rich("text", {
bill_name:bill.name,
location_name:location.name,
strong: (chunks:ReactNode) => `<strong>${chunks}</strong>`,
strong: (chunks:ReactNode) => <strong>${chunks}</strong>,
})
}
</p>

View File

@@ -38,11 +38,7 @@ export const LocationCard:FC<LocationCardProps> = ({location: { _id, name, yearM
{
monthlyExpense > 0 ?
<p>
{
t.rich("payed-total", {
amount: formatCurrency(monthlyExpense),
strong: (chunks:ReactNode) => `<strong>${chunks}</strong>`
})}
{ t("payed-total") } <strong>${monthlyExpense}</strong>
</p>
: null
}

View File

@@ -8,9 +8,9 @@ import { defaultLocale, localeNames, locales } from "../i18n";
export const SelectLanguage: React.FC = () => {
const currentPathname = usePathname();
const locale = useLocale();
const secondLocale = locales.find((l) => l !== locale) as string;
const secondLocalePathname = defaultLocale === locale ? `/${secondLocale}${currentPathname}` : currentPathname.replace(`/${locale}/`, `/${secondLocale}/`);
const currentLocale = useLocale();
const secondLocale = locales.find((l) => l !== currentLocale) as string;
const secondLocalePathname = defaultLocale === currentLocale ? `/${secondLocale}${currentPathname}` : currentPathname.replace(`/${currentLocale}/`, `/${secondLocale}/`);
return (<Link className="btn btn-ghost text-xl self-end" href={secondLocalePathname}>{localeNames[secondLocale]}</Link>);
}