Skip to content
This repository was archived by the owner on Apr 22, 2024. It is now read-only.
This repository was archived by the owner on Apr 22, 2024. It is now read-only.

i18n:report overlooks missing in ts file #247

@LukasWallisch

Description

@LukasWallisch

Reporting a bug?

If i use a i18n in a pure ts file in my assets foulder the Missing Entry detection from i18n:report doesn't work correctly:

import i18n from "@/i18n";
const { t } = i18n.global;

export const Toasts = {
    debug(message: string) {
        # detected
        debugToast(message, t("toast.Debug"))
    },
    registered() {
        # NOT detected
        infoToast(t("toast.register"))
    },
    unregistered() {
        # detected
        infoToast( t("toast.unregister"))
    },
}
> vue-cli-service i18n:report --src "./src/assets/ts/helpers/toasts*.ts" --locales "./src/locales/**/*.json" --type missing

┌────┬────────────┬────────────────────────────────────────┬────────┬──────────────────────────────┐
│ #  │ Language   │ File                                   │ Line   │ Missing i18n Entry           │
├────┼────────────┼────────────────────────────────────────┼────────┼──────────────────────────────┤
│ 0  │ de         │ /src/assets/ts/helpers/toasts.ts       │ 50     │ toast.Debug                  │
│ 1  │ de         │ /src/assets/ts/helpers/toasts.ts       │ 56     │ toast.unregister             │
│ 2  │ en         │ /src/assets/ts/helpers/toasts.ts       │ 50     │ toast.Debug                  │
│ 3  │ en         │ /src/assets/ts/helpers/toasts.ts       │ 56     │ toast.unregister             │
└────┴────────────┴────────────────────────────────────────┴────────┴──────────────────────────────┘

And yes toast.register is definitly not defined anywhere!

It seems that if there is no space infront of the t then its not detected -.- But with correct Formating must not be a space... so hmm.... not perfect...

Version
"vue-i18n": "^9.1.0",

Expected behavior

The not detected one in the example should be detected...

Reproduction

like in the minimal example

System Info

System:
    OS: Linux 5.4 Ubuntu 20.04.3 LTS (Focal Fossa)
    CPU: (4) x64 Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
    Memory: 1.45 GB / 15.53 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 14.17.3 - /usr/local/bin/node
    npm: 7.20.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 94.0.4606.61
    Firefox: 92.0
  npmPackages:
    vue: ^3.0.0 => 3.0.11 
    vue-i18n: ^9.1.0 => 9.1.6

Screenshot

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions