i18next#getFixedT TypeScript Examples

The following examples show how to use i18next#getFixedT. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WidgetI18n.ts    From next-core with GNU General Public License v3.0 5 votes vote down vote up
export function widgetI18nFactory(widgetId: string): TFunction {
  return getFixedT(null, getI18nNamespace("widget", widgetId));
}
Example #2
Source File: getGeneralGlobals.ts    From next-core with GNU General Public License v3.0 5 votes vote down vote up
function getIndividualGlobal(
  variableName: string,
  {
    collectCoverage,
    widgetId,
    app,
    storyboardFunctions,
    isStoryboardFunction,
  }: GeneralGlobalsOptions
): unknown {
  switch (variableName) {
    case "BASE_URL":
      return collectCoverage ? "/next" : getBasePath().replace(/\/$/, "");
    case "FN":
      return storyboardFunctions;
    case "IMG":
      return collectCoverage
        ? fakeImageFactory()
        : widgetId
        ? widgetImagesFactory(widgetId)
        : imagesFactory(app.id, app.isBuildPush);
    case "I18N":
      return collectCoverage
        ? identity
        : widgetId
        ? widgetI18nFactory(widgetId)
        : getFixedT(null, getI18nNamespace("app", app.id));
    case "I18N_TEXT":
      return collectCoverage ? fakeI18nText : i18nText;
    case "PERMISSIONS":
      return {
        check: collectCoverage ? fakeCheckPermissions : checkPermissions,
      };
    case "THEME":
      return {
        getTheme: collectCoverage ? () => "light" : getTheme,
      };
    case "console":
      return isStoryboardFunction ? getReadOnlyProxy(console) : undefined;
    case "location":
      return collectCoverage
        ? {
            href: "http://localhost:3000/functions/test",
            origin: "http://localhost:3000",
          }
        : { href: location.href, origin: location.origin };
  }
}