2021-05-18 00:04:06 +00:00
|
|
|
import { createContext } from "react"
|
2021-05-21 15:35:33 +00:00
|
|
|
import LocalizationStrings from "../LocalizationStrings"
|
2021-05-18 00:04:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A context containing an object with the following values:
|
|
|
|
* - `lang`: a string corresponding to the ISO 639-1 code of the current language
|
|
|
|
* - `setLang`: a function to change the current language
|
|
|
|
* - `strings`: an object containing all strings of the current language
|
2021-05-21 15:35:33 +00:00
|
|
|
*
|
2021-05-22 02:44:08 +00:00
|
|
|
* Defaults to Italian `it`.
|
2021-05-18 00:04:06 +00:00
|
|
|
*/
|
|
|
|
export default createContext({
|
2021-05-21 15:35:33 +00:00
|
|
|
lang: "it",
|
2021-05-18 00:04:06 +00:00
|
|
|
setLang: () => console.error("Trying to setLang while outside a ContextServer.Provider!"),
|
2021-05-21 15:35:33 +00:00
|
|
|
strings: LocalizationStrings.it,
|
2021-05-18 00:04:06 +00:00
|
|
|
})
|