Skip to content

Latest commit

 

History

History
50 lines (39 loc) · 1.24 KB

File metadata and controls

50 lines (39 loc) · 1.24 KB

@we-make-websites/common-i18n

build

Intro

One possible way to share locales amongst apps in the monorepo.

Usage

Add the workspace dependency to the consuming app or package.

yarn add @we-make-websites/common-locales:"workspace:^"

Add an alias in tsconfig.js to enable fast-refresh.

{
  "compilerOptions": {
    "paths": {
      "@we-make-websites/common-i18n": [
        "../../../packages/common-i18n/src/index",
      ],
      "@we-make-websites/common-i18n/locales/*": [
        "../../../packages/common-i18n/src/locales/*",
      ],
    },
  },
}

Optionally create a file named ./types.d/react-i18next.d.ts to enable typechecks and autocompletion of keys.

import "react-i18next";
import type { I18nNamespaces } from "@we-make-websites/common-i18n";

declare module "react-i18next" {
  interface CustomTypeOptions {
    defaultNS: "common";
    resources: I18nNamespaces;
  }
}