File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -3,13 +3,18 @@ import languageES from "@/dictionaries/es.json";
33import languageEN from "@/dictionaries/en.json" ;
44import Button from "../../button" ;
55import { IconEC , IconEEUU } from "../../icons" ;
6+ import type { Dictionary } from "@/types/dictionary" ;
67
78const BtnLanguage = ( ) => {
89 const { language, setLanguage, setData } = useLanguageStore ( ) ;
910
1011 const handleLanguage = ( ) => {
1112 setLanguage ( language === "ES" ? "EN" : "ES" ) ;
12- setData ( language === "ES" ? languageEN : languageES ) ;
13+ setData (
14+ language === "ES"
15+ ? ( languageEN as unknown as Dictionary )
16+ : ( languageES as unknown as Dictionary )
17+ ) ;
1318 } ;
1419
1520 return (
Original file line number Diff line number Diff line change 11import { create } from "zustand" ;
2- import type { Dictionary } from "../types/dictionary" ;
2+ import type { Dictionary , Project } from "../types/dictionary" ;
33import spanish from "../dictionaries/es.json" ;
44
55interface LanguageState {
@@ -11,7 +11,12 @@ interface LanguageState {
1111
1212export const useLanguageStore = create < LanguageState > ( ( set , get ) => ( {
1313 language : "ES" ,
14- data : spanish ,
14+ data : {
15+ ...spanish ,
16+ projects : spanish . projects . map ( ( project : any ) => ( {
17+ ...project
18+ } ) ) as Project [ ]
19+ } ,
1520 setLanguage : ( value : string ) =>
1621 set ( ( state : LanguageState ) => ( { ...state , language : value } ) ) ,
1722 setData : ( value : Dictionary ) =>
You can’t perform that action at this time.
0 commit comments