From f9508544df690d5f2cea37d017e2853595a45629 Mon Sep 17 00:00:00 2001 From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com> Date: Tue, 11 Jun 2024 10:54:30 -0500 Subject: [PATCH] update docs for deps --- packages/localizer/index.mdx | 40 +++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/packages/localizer/index.mdx b/packages/localizer/index.mdx index eda90fa..dff7641 100644 --- a/packages/localizer/index.mdx +++ b/packages/localizer/index.mdx @@ -6,8 +6,6 @@ sidebar: --- -# @sern/localizer - A localization module for managing translations and providing localized content in your application. ## Installation @@ -16,21 +14,43 @@ A localization module for managing translations and providing localized content npm i @sern/localizer ``` + +import { Tabs, TabItem } from "@astrojs/starlight/components"; + + ## Usage **Initializing the Localizer** -```ts -import { makeDependencies } from '@sern/handler'; -import { Localization } from '@sern/localizer'; -await makeDependencies(({ add }) => { - add('localizer', Localization()); -}); -``` + + + ```ts {2} {6} + import { makeDependencies } from '@sern/handler'; + import { Localization } from '@sern/localizer'; + + await makeDependencies(({ add }) => { + // add other deps + add('localizer', Localization()); + }); + ``` + + + ```ts {5} + import type { Logging, CoreDependencies } from '@sern/handler' + import type { Localizer } from '@sern/localizer' + declare global { + interface Dependencies extends CoreDependencies { + localizer: Localizer; + } + } + export {} + ``` + + + This localizer is **FILE BASED**. Create the directory `assets/locals`. Each json file in here must be named after the `locale` -import { Tabs, TabItem } from "@astrojs/starlight/components";