Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jarda-svoboda committed Jul 12, 2023
1 parent b96543e commit ee52360
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,12 @@ export const { t, locale, locales, loading, loadTranslations } = new i18n(config
...load your translations in `+layout.js`...

```javascript
import { locale, loadTranslations } from '$lib/translations';
import { loadTranslations } from '$lib/translations';

export const load = async ({ url }) => {
const { pathname } = url;

const defaultLocale = 'en'; // get from cookie, user session, ...

const initLocale = locale.get() || defaultLocale; // set default if no locale already set
const initLocale = 'en'; // get from cookie, user session, ...

await loadTranslations(initLocale, pathname); // keep this just before the `return`

Expand Down

0 comments on commit ee52360

Please sign in to comment.