equinor / attenuation-app

0 stars 0 forks source link

`useDictionary` hook #12

Closed tormodAase closed 4 days ago

tormodAase commented 5 days ago

Language state is NOT needed at the moment.

Should return norwegian JSON.

In the future this might be updated to support english as well.

Reference from code of conduct client

import { useLanguage } from "@equinor/mad-core"
import * as no from '../resources/language/no.json'
import * as en from '../resources/language/en.json'
import * as pt from '../resources/language/pt.json'

export const useDictionary = () => {
    const {language} = useLanguage();
    switch (language.code) {
        case "no":
            return no;
        case "pt":
            return pt
        default:
            return en
    }
}