add i18n, products, productors and forms as tables

This commit is contained in:
2026-02-12 00:30:28 +01:00
parent 1813e2893e
commit 025b78d5dd
43 changed files with 1623 additions and 527 deletions

View File

@@ -5,9 +5,9 @@ import LanguageDetector from "i18next-browser-languagedetector";
import { Settings } from "luxon";
import { initReactI18next } from "react-i18next";
import en from "../../locales/en.json";
import fr from "../../locales/fr.json";
import { Config } from "./config";
import en from "@/../locales/en.json";
import fr from "@/../locales/fr.json";
import { Config } from "@/config/config";
const resources = {
en: { translation: en },
@@ -32,10 +32,25 @@ i18next
})
.then(() => {
[Settings.defaultLocale] = i18next.language.split("-");
i18next.services.formatter?.add(
"capfirst",
(value) => {
if (typeof value !== "string" || !value.length) {
return value;
}
return value.charAt(0).toUpperCase() + value.slice(1);
}
);
});
export function t(message: string, params?: Record<string, any>) {
return i18next.t(message, params);
export function t(message: string, params?: Record<string, any> & {capfirst?: boolean}) {
const result = i18next.t(message, params);
if (params?.capfirst && typeof result === "string" && result.length) {
return result.charAt(0).toUpperCase() + result.slice(1);
}
return result;
}
export default i18next;