Skip to content

Commit

Permalink
feat(i18n): do not reset i18n when provided (#154)
Browse files Browse the repository at this point in the history
## Description

Before, the i18n instance was resetted even if it has been provided.
This PR fixes the issue.
  • Loading branch information
BoppLi authored Jan 19, 2024
1 parent 3dddf75 commit 07e862f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/brave-lobsters-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"sit-onyx": patch
---

Ensure that the i18n instance is not reset when it has been provided
4 changes: 2 additions & 2 deletions packages/sit-onyx/src/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ export const provideI18n = (options: ProvideI18nOptions) => {

/**
* Injects the onyx i18n instance.
* Creates a fallback if provide was never called.
*/
export const injectI18n = () => {
const fallbackInstance = createI18n();
return inject(I18N_INJECTION_KEY, fallbackInstance);
return inject(I18N_INJECTION_KEY, () => createI18n(), true);
};

/**
Expand Down

0 comments on commit 07e862f

Please sign in to comment.