add language toggle
This commit is contained in:
18
src/lib/contexts/languageContext.js
Normal file
18
src/lib/contexts/languageContext.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import { setContext, getContext } from 'svelte';
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
const LANGUAGE_CONTEXT_KEY = Symbol('language');
|
||||
|
||||
export function createLanguageContext() {
|
||||
const showLatin = writable(true); // true = bilingual, false = monolingual
|
||||
|
||||
setContext(LANGUAGE_CONTEXT_KEY, {
|
||||
showLatin
|
||||
});
|
||||
|
||||
return { showLatin };
|
||||
}
|
||||
|
||||
export function getLanguageContext() {
|
||||
return getContext(LANGUAGE_CONTEXT_KEY);
|
||||
}
|
||||
Reference in New Issue
Block a user