prayers: add English translations for all prayer components
Add official Catholic English translations to all prayer components for /faith/* routes. Prayer names on /faith/prayers are now displayed in English. Remove unused Angelus.svelte component.
This commit is contained in:
@@ -1,16 +1,31 @@
|
||||
import { setContext, getContext } from 'svelte';
|
||||
import { setContext, getContext, hasContext } from 'svelte';
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
const LANGUAGE_CONTEXT_KEY = Symbol('language');
|
||||
|
||||
export function createLanguageContext() {
|
||||
const showLatin = writable(true); // true = bilingual, false = monolingual
|
||||
/**
|
||||
* Creates or updates a language context for prayer components
|
||||
* @param {Object} options
|
||||
* @param {'de' | 'en'} options.urlLang - The URL language (de for /glaube, en for /faith)
|
||||
*/
|
||||
export function createLanguageContext({ urlLang = 'de' } = {}) {
|
||||
// Check if context already exists (e.g., during navigation)
|
||||
if (hasContext(LANGUAGE_CONTEXT_KEY)) {
|
||||
const existing = getContext(LANGUAGE_CONTEXT_KEY);
|
||||
// Update the lang store with the new URL language
|
||||
existing.lang.set(urlLang);
|
||||
return existing;
|
||||
}
|
||||
|
||||
const showLatin = writable(true); // true = bilingual (Latin + vernacular), false = monolingual
|
||||
const lang = writable(urlLang); // 'de' or 'en' based on URL
|
||||
|
||||
setContext(LANGUAGE_CONTEXT_KEY, {
|
||||
showLatin
|
||||
showLatin,
|
||||
lang
|
||||
});
|
||||
|
||||
return { showLatin };
|
||||
return { showLatin, lang };
|
||||
}
|
||||
|
||||
export function getLanguageContext() {
|
||||
|
||||
Reference in New Issue
Block a user