Change Tolgee integration
All checks were successful
forgejo/Procyon/procyon/pipeline/head This commit looks good
All checks were successful
forgejo/Procyon/procyon/pipeline/head This commit looks good
This commit is contained in:
parent
47f8118fdc
commit
50e9ef4246
5 changed files with 50 additions and 29 deletions
|
@ -12,7 +12,7 @@ import {
|
|||
Stories,
|
||||
} from '@storybook/blocks';
|
||||
|
||||
import { tolgee, TolgeeProvider } from '@procyon/localization/tolgee';
|
||||
import { TolgeeProvider, useTolgee, TolgeeChain } from '@procyon/localization/tolgee';
|
||||
|
||||
export const globalTypes = {
|
||||
locale: {
|
||||
|
@ -29,19 +29,27 @@ export const globalTypes = {
|
|||
},
|
||||
};
|
||||
|
||||
const tolgee = TolgeeChain.init({
|
||||
apiKey: process.env.TOLGEE_API_KEY,
|
||||
apiUrl: process.env.TOLGEE_API_URL,
|
||||
language: 'en',
|
||||
ns: ['button', 'common'],
|
||||
});
|
||||
|
||||
export const decorators = [
|
||||
(Story, context) => {
|
||||
const { locale } = context.globals;
|
||||
const tolgee = useTolgee();
|
||||
tolgee.changeLanguage(locale);
|
||||
return <Story />;
|
||||
},
|
||||
(Story) => {
|
||||
return (
|
||||
<TolgeeProvider>
|
||||
<TolgeeProvider tolgee={tolgee}>
|
||||
<Story />
|
||||
</TolgeeProvider>
|
||||
);
|
||||
},
|
||||
(Story, context) => {
|
||||
const { locale } = context.globals;
|
||||
tolgee.changeLanguage(locale);
|
||||
return <Story />;
|
||||
},
|
||||
];
|
||||
|
||||
export const parameters = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue