intlify / vue-i18n-locale-message

:globe_with_meridians: i18n locale messages management tool for vue-i18n
MIT License
73 stars 12 forks source link

`infuse` fails when a directory shares a name with a component at the same level #235

Open allanlewis opened 2 years ago

allanlewis commented 2 years ago

I have a directory structure something like this:

pages/
├── widgets.vue
└── widgets/
    ├── create.vue
    └── list.vue

When I run infuse, I get garbled i18n blocks in widgets.vue, something like this:

<i18n lang="yaml">
en-GB:
  foo: bar
  create:
    foo: bar
  list:
    foo: bar

It seems to be taking the messages from the sub-components - create and list - and putting them into widgets.vue. Presumably it's getting confused between widgets.vue and the widgets directory.

Here are the commands I'm using:

    "i18n:squeeze": "vue-i18n-locale-message squeeze --target src --split --output messages",
    "i18n:infuse": "vue-i18n-locale-message infuse --target src --locales messages --match '^([\\w-]*)\\.json$'",

Is there some additional option I need to use, or do I need to rename my files? I'm using nuxt, so the filenames represent paths; renaming them might be difficult.

stephenhebert commented 6 months ago

I've encountered this also. The workaround I use is to move widgets.vue to widgets/index.vue.