From 8658981c3eeeb8ffb5f025c496bbdf22de81bd34 Mon Sep 17 00:00:00 2001 From: Timofei Iatsenko Date: Fri, 17 Mar 2023 10:54:18 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Andrii Bodnar --- website/docs/ref/loader.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/website/docs/ref/loader.md b/website/docs/ref/loader.md index 37a4db556..7e2444d4b 100644 --- a/website/docs/ref/loader.md +++ b/website/docs/ref/loader.md @@ -1,6 +1,6 @@ # Webpack Loader -Webpack loader which compiles catalogs on the fly. In summary, `lingui compile` command isn't required when using this loader +The Webpack loader compiles catalogs on the fly. In summary, the `lingui compile` command isn't needed when using this loader. ## Installation @@ -14,7 +14,8 @@ npm install --save-dev @lingui/loader Simply prepend `@lingui/loader!` in front of path to message catalog you want to import. Here's an example of dynamic import: -Extension is mandatory. +The extension is mandatory. + ```ts export async function dynamicActivate(locale: string) { const { messages } = await import(`@lingui/loader!./locales/${locale}/messages.po`) @@ -24,10 +25,10 @@ export async function dynamicActivate(locale: string) { ``` :::note -Catalogs with `.json` extension treated differently by Webpack. They loaded as ES module with default export, so your import should look like that: +Catalogs with the `.json` extension are treated differently by Webpack. They load as ES module with default export, so your import should look like this: ```ts -const { messages } = (await import(`@lingui/loader!./locales/${locale}/messages.po`)).default +const { messages } = (await import(`@lingui/loader!./locales/${locale}/messages.json`)).default ``` :::