add prettier code formater
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
export const Config = {
|
||||
backend_uri: import.meta.env.VITE_API_URL,
|
||||
debug: import.meta.env.NODE_ENV === "development"
|
||||
}
|
||||
debug: import.meta.env.NODE_ENV === "development",
|
||||
};
|
||||
|
||||
@@ -8,46 +8,42 @@ import fr from "@/../locales/fr.json";
|
||||
import { Config } from "@/config/config";
|
||||
|
||||
const resources = {
|
||||
en: { translation: en },
|
||||
fr: { translation: fr },
|
||||
en: { translation: en },
|
||||
fr: { translation: fr },
|
||||
};
|
||||
|
||||
i18next
|
||||
.use(initReactI18next)
|
||||
.init({
|
||||
resources: resources,
|
||||
fallbackLng: "fr",
|
||||
debug: Config.debug,
|
||||
detection: {
|
||||
caches: [],
|
||||
},
|
||||
interpolation: {
|
||||
escapeValue: false,
|
||||
},
|
||||
ns: ["translation"],
|
||||
defaultNS: "translation",
|
||||
})
|
||||
.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);
|
||||
}
|
||||
);
|
||||
});
|
||||
.use(initReactI18next)
|
||||
.init({
|
||||
resources: resources,
|
||||
fallbackLng: "fr",
|
||||
debug: Config.debug,
|
||||
detection: {
|
||||
caches: [],
|
||||
},
|
||||
interpolation: {
|
||||
escapeValue: false,
|
||||
},
|
||||
ns: ["translation"],
|
||||
defaultNS: "translation",
|
||||
})
|
||||
.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, unknown>) {
|
||||
const result = i18next.t(message, params);
|
||||
if (params?.capfirst && typeof result === "string" && result.length) {
|
||||
return result.charAt(0).toUpperCase() + result.slice(1);
|
||||
}
|
||||
return result;
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user