Skip to content

Commit

Permalink
Add more url params
Browse files Browse the repository at this point in the history
  • Loading branch information
dprslt committed Jul 8, 2024
1 parent ace22b3 commit 473d0a9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import tily from "./static/tily.png";
const App: FC<React.PropsWithChildren<unknown>> = () => {
const { t } = useTranslation();

const url = new URL(window.location.href);
const defaultLang = url.searchParams.get("lang");

return (
<div className="App">

Expand Down
7 changes: 6 additions & 1 deletion src/components/ResumePage/PersonnalData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ import { useTranslation } from "react-i18next";


const PersonnalData = () => {
const [clear, setClear] = useState(false);

const url = new URL(window.location.href);
const showData = url.searchParams.get("showData");


const [clear, setClear] = useState(showData ? true : false);
useEffect(() => {
window.onbeforeprint = () => {
setClear(true);
Expand Down
5 changes: 4 additions & 1 deletion src/setupI18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import { initReactI18next } from "react-i18next";
import { en } from "./data/en";
import { fr } from "./data/fr";

const url = new URL(window.location.href);
const defaultLang = url.searchParams.get("lang");

i18n
.use(initReactI18next) // passes i18n down to react-i18next
.init({
resources: { fr, en },
lng: "fr",
lng: defaultLang || 'fr',
fallbackLng: "fr",
load: "all",
debug: false,
Expand Down

0 comments on commit 473d0a9

Please sign in to comment.