Skip to content

Commit

Permalink
update docs for deps
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoobes committed Jun 11, 2024
1 parent 6227be6 commit f950854
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions packages/localizer/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ sidebar:
---


# @sern/localizer

A localization module for managing translations and providing localized content in your application.

## Installation
Expand All @@ -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());
});
```
<Tabs>
<TabItem label ="src/index.js">
```ts {2} {6}
import { makeDependencies } from '@sern/handler';
import { Localization } from '@sern/localizer';

await makeDependencies(({ add }) => {
// add other deps
add('localizer', Localization());
});
```
</TabItem>
<TabItem label="src/dependencies.d.ts">
```ts {5}
import type { Logging, CoreDependencies } from '@sern/handler'
import type { Localizer } from '@sern/localizer'
declare global {
interface Dependencies extends CoreDependencies {
localizer: Localizer;
}
}
export {}
```
</TabItem>
</Tabs>

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";

<Tabs>
<TabItem label="Spanish">
Expand Down

0 comments on commit f950854

Please sign in to comment.