Skip to content

Commit

Permalink
remove default language, rename option name for SSR
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneBalabai committed Sep 17, 2024
1 parent 704ed61 commit 00ad6f4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/vue/src/TolgeeProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export const TolgeeProvider = defineComponent({
},
staticData: {
type: Object as PropType<TolgeeStaticData>,
default: undefined,
required: false,
},
language: {
type: String as PropType<string>,
default: 'en',
required: false,
},
},

Expand Down
8 changes: 4 additions & 4 deletions packages/vue/src/VueTolgee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { TolgeeVueContext } from './types';

type Options = {
tolgee?: TolgeeInstance;
isSSR?: boolean;
enableSSR?: boolean;
};

type TolgeeT = TolgeeInstance['t'];
Expand All @@ -24,16 +24,16 @@ export const VueTolgee = {
throw new Error('Tolgee instance not passed in options');
}

const isSSR = Boolean(options?.isSSR);
const isSsrEnabled = Boolean(options?.enableSSR);

const reactiveContext = ref<TolgeeVueContext>({
tolgee: tolgee,
isInitialRender: isSSR,
isInitialRender: isSsrEnabled,
});

app.provide('tolgeeContext', reactiveContext);

if (isSSR) {
if (isSsrEnabled) {
const getOriginalTolgeeInstance = (): TolgeeInstance => ({
...reactiveContext.value.tolgee,
t: ((...args: Parameters<TolgeeT>) => {
Expand Down
2 changes: 1 addition & 1 deletion testapps/vue-ssr/renderer/+onCreateApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export const onCreateApp = (pageContext) => {
const { app } = pageContext;
const tolgee = createTolgee();

app.use(VueTolgee, { tolgee, isSSR: true });
app.use(VueTolgee, { tolgee, enableSSR: true });
};

0 comments on commit 00ad6f4

Please sign in to comment.