mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-21 03:03:25 -05:00
75315ea2c5
Co-authored-by: Piyush Gupta <piyushguptaa2z123@gmail.com>
27 lines
764 B
TypeScript
27 lines
764 B
TypeScript
import { createServerInstance } from "@tolgee/react/server";
|
|
import { getLocale } from "./language";
|
|
import { TolgeeBase } from "./shared";
|
|
|
|
// Try to import branch.json, but handle the case where it doesn't exist
|
|
let branchName: string | undefined;
|
|
try {
|
|
const branch = require("../../../branch.json");
|
|
branchName = branch.branchName;
|
|
} catch (e) {
|
|
// File doesn't exist in production, so we'll use undefined
|
|
branchName = undefined;
|
|
}
|
|
|
|
export const { getTolgee, getTranslate, T } = createServerInstance({
|
|
getLocale: getLocale,
|
|
createTolgee: async (language) => {
|
|
return TolgeeBase().init({
|
|
tagNewKeys: branchName ? [`draft:${branchName}`] : [],
|
|
observerOptions: {
|
|
fullKeyEncode: true,
|
|
},
|
|
language,
|
|
});
|
|
},
|
|
});
|