Skip to content

Commit

Permalink
export type TranslationState
Browse files Browse the repository at this point in the history
  • Loading branch information
KishiTheMechanic committed Oct 26, 2024
1 parent 2a002ac commit bf5d316
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
14 changes: 2 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ import { i18nPlugin } from '@elsoul/fresh-i18n'
export const app = new App({
root: import.meta.url,
})
.use(staticFiles()) // Serve static files
.use(trailingSlashes('never')) // Do not add trailing slashes to URLs
.use(staticFiles())
.use(trailingSlashes('never'))
.use(i18nPlugin({
languages: ['en', 'ja'], // Supported languages
defaultLocale: 'en', // Default language
Expand Down Expand Up @@ -109,16 +109,6 @@ export default function Home() {
}
```

### Step 4: Dynamically Change Language

Use the `changeLanguage()` function from the `useLocale()` hook to dynamically
switch between languages.

```tsx
const { changeLanguage } = useLocale()
changeLanguage('ja') // Switch to Japanese
```

## Contributing

Contributions are welcome! Please feel free to submit issues or pull requests on
Expand Down
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@elsoul/fresh-i18n",
"version": "0.3.0",
"version": "0.4.0",
"description": "A simple and flexible internationalization (i18n) plugin for Deno's Fresh framework.",
"runtimes": ["deno", "browser"],
"exports": "./mod.ts",
Expand Down
6 changes: 5 additions & 1 deletion mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ export { i18nPlugin } from '@/src/i18nPlugin.ts'
export { useTranslation } from '@/src/useTranslation.ts'
export { setInitialLocale, useLocale } from '@/src/useLocale.ts'
export type { I18nOptions } from '@/src/initI18n.ts'
export type { FreshContext, MiddlewareFn } from '@/src/types.ts'
export type {
FreshContext,
MiddlewareFn,
TranslationState,
} from '@/src/types.ts'

0 comments on commit bf5d316

Please sign in to comment.