Skip to content
Snippets Groups Projects
Commit 7b262425 authored by Chloé JACOB's avatar Chloé JACOB :alien:
Browse files

mise en place de i18n

parent c4707e9d
No related merge requests found
.env 0 → 100644
VITE_API_ENDPOINT="https://api.instalike.fr"
\ No newline at end of file
node_modules/
dist/
.prettierrc
.eslintrc
\ No newline at end of file
{
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:import/recommended",
"plugin:jsx-a11y/recommended",
"plugin:@typescript-eslint/recommended",
"eslint-config-prettier"
],
"settings": {
"react": {
"version": "detect"
},
"import/resolver": {
"node": {
"paths": ["src"],
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
}
},
"rules": {
"react/react-in-jsx-scope": "off",
"import/named": "off"
}
}
\ No newline at end of file
node_modules/
dist/
\ No newline at end of file
{
"endOfLine": "lf",
"trailingComma": "es5",
"arrowParens": "always",
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"printWidth": 120,
"bracketSameLine": false,
"bracketSpacing": true,
"importOrder": ["<THIRD_PARTY_MODULES>", "^@src/(.*)$", "^[./]"],
"importOrderSeparation": true
}
\ No newline at end of file
README 0 → 100644
npm run dev -> pour lancer l'application
\ No newline at end of file
enum Language {
FR = 'fr',
EN = 'en',
}
export default Language;
\ No newline at end of file
{
"followers": "followers {{ count }}",
"actions": {
"follow": "follow"
}
}
\ No newline at end of file
{
"followers": "Abonnés {{ count }}",
"actions": {
"follow": "suivre"
}
}
\ No newline at end of file
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import commonEN from "./assets/locales/en/common.json";
import commonFR from "./assets/locales/fr/common.json";
import Language from "./assets/enums/Language";
import I18nextBrowserLanguageDetector from "i18next-browser-languagedetector";
i18n
.use(initReactI18next)
.use(I18nextBrowserLanguageDetector)
.init({
ns: 'common',
defaultNS: 'common',
fallbackLng: Language.EN,
supportedLngs: Object.values(Language),
resources: {
[Language.EN]: {
common: commonEN,
},
[Language.FR]: {
common: commonFR,
},
},
interpolation: {
escapeValue: false,
},
detection: {
order: ['querystring', 'localStorage'],
caches: ['localStorage'],
lookupQuerystring: "lang",
}
});
\ No newline at end of file
import axios from "axios";
import { createInstalikeApi } from "@jmetterrothan/instalike";
const instalikeApi = createInstalikeApi(
axios.create({
baseURL: import.meta.env.VITE_API_ENDPOINT,
headers: {
"Content-Type": "application/json;charset=utf-8",
Accept: "application/json",
},
})
);
export default instalikeApi;
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment