Skip to content

Commit

Permalink
link scheda personale lang dipendente
Browse files Browse the repository at this point in the history
  • Loading branch information
paolini committed Mar 25, 2024
1 parent b35c46a commit 1acc796
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/components/LocalizedString.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import i18n from '../i18n'

export const LangContext = createContext('it')

export const useLang = () => {
return useContext(LangContext)
}

export const useLocalization = name => {
const lang = useContext(LangContext)
return i18n[name][lang]
Expand Down
5 changes: 3 additions & 2 deletions src/components/Sidebar.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { clsx } from '../lib/utils.js'
import { LocalizedString } from './LocalizedString.jsx'
import { LocalizedString, useLang } from './LocalizedString.jsx'

export const Sidebar = ({ rooms, ...rest }) => {
const lang = useLang()
const SIDEBAR_LABELS = {
buildings: {
['A']: 'building-a',
Expand Down Expand Up @@ -49,7 +50,7 @@ export const Sidebar = ({ rooms, ...rest }) => {
<li>
<a
target="_blank"
href={`https://www.dm.unipi.it/scheda-personale/?person_id=${assignment.person._id}`}
href={`https://www.dm.unipi.it/${lang==='en'?'en/':''}scheda-personale/?person_id=${assignment.person._id}`}
>
{assignment.person.firstName} {assignment.person.lastName}
</a>
Expand Down

0 comments on commit 1acc796

Please # to comment.