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

i18n:report overlooks missing in ts file #247

Open
4 tasks done
LukasWallisch opened this issue Sep 30, 2021 · 2 comments
Open
4 tasks done

i18n:report overlooks missing in ts file #247

LukasWallisch opened this issue Sep 30, 2021 · 2 comments

Comments

@LukasWallisch
Copy link

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

Copy link
Member

kazupon commented Oct 1, 2021

Thank you for your reporting!
This issue is vue-cli-plugin-i18n.
So, transfer it

@kazupon kazupon transferred this issue from intlify/vue-i18n Oct 1, 2021
@kazupon
Copy link
Member

kazupon commented Oct 1, 2021

vue-cli-service i18n:report is experimental.
I have planned the drop this feature because we can realize with using eslint-plugin-vue-i18n
We recommend that you will to use eslint-plugin-vue-i18n

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants