Monorepo

How to use Locadex with a monorepo

Setup

Locadex can be used with a monorepo setup. To do this, simply provide the --app-dir flag with the path to your app directory when running any locadex command.

npx locadex start --app-dir packages/my-app

Important: Make sure you are running the command in the root of your monorepo!

Multiple apps

Currently, Locadex only supports internationalizing a single app at a time.

If your monorepo contains multiple apps you want to internationalize, you can run the command multiple times, once for each app.

You'll need to also specify the --match-files flag with the path to the files you want to internationalize.

npx locadex start --app-dir packages/my-app \
  --match-files "packages/my-app/**/*.{tsx,ts}"

npx locadex start --app-dir packages/my-other-app \
  --match-files "packages/my-other-app/**/*.{tsx,ts}"

Shared UI libraries

If your monorepo contains shared UI libraries, you can specify additional, comma-separated glob patterns to match the files you want to internationalize.

npx locadex start --app-dir packages/my-app \
  --match-files "packages/my-app/**/*.{tsx,ts}, packages/ui-library/**/*.{tsx,ts}"

Make sure to specify the --app-dir flag! Without an app directory, Locadex may not be able to find the correct app configuration.

How is this guide?