vue-cli-plugin-i18n
vue-cli-plugin-i18n copied to clipboard
i18n:report overlooks missing in ts file
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
- [X] Read the Contributing Guidelines
- [X] Read the Documentation
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion
Thank you for your reporting!
This issue is vue-cli-plugin-i18n
.
So, transfer it
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