init commit
This commit is contained in:
17
shared/components/src/utils/internal/locale/index.ts
Normal file
17
shared/components/src/utils/internal/locale/index.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
/* istanbul ignore file */
|
||||
|
||||
//TODO rdar://93379311 (Solution for sharing context between app + shared components)
|
||||
import { getContext, setContext } from 'svelte';
|
||||
import type { Locale } from '@amp/web-app-components/src/types';
|
||||
|
||||
const CONTEXT_NAME = 'shared:locale';
|
||||
|
||||
// WARNING these signatures can change after rdar://93379311
|
||||
export function setLocale(context: Map<string, unknown>, locale: Locale) {
|
||||
context.set(CONTEXT_NAME, locale);
|
||||
}
|
||||
|
||||
// WARNING these signatures can change after rdar://93379311
|
||||
export function getLocale(): Locale {
|
||||
return getContext(CONTEXT_NAME) as Locale | undefined;
|
||||
}
|
||||
Reference in New Issue
Block a user