Buckets:
| import { createMemo } from "solid-js" | |
| import { createSimpleContext } from "@opencode-ai/ui/context" | |
| import { i18n, type Key } from "~/i18n" | |
| import { useLanguage } from "~/context/language" | |
| function resolve(text: string, params?: Record<string, string | number>) { | |
| if (!params) return text | |
| return text.replace(/\{\{(\w+)\}\}/g, (raw, key) => { | |
| const value = params[key] | |
| if (value === undefined || value === null) return raw | |
| return String(value) | |
| }) | |
| } | |
| export const { use: useI18n, provider: I18nProvider } = createSimpleContext({ | |
| name: "I18n", | |
| init: () => { | |
| const language = useLanguage() | |
| const dict = createMemo(() => i18n(language.locale())) | |
| return { | |
| t(key: Key, params?: Record<string, string | number>) { | |
| return resolve(dict()[key], params) | |
| }, | |
| } | |
| }, | |
| }) | |
Xet Storage Details
- Size:
- 816 Bytes
- Xet hash:
- e95a1e2282bf80a64a51aad23604a4a7e814cbd5a8ee8547e076c7eec5410934
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.