jshmrtn / vue3-gettext

Translate Vue 3 applications with gettext.
https://jshmrtn.github.io/vue3-gettext/
MIT License
70 stars 24 forks source link

Cannot extract messages from code #59

Closed huynamboz closed 1 month ago

huynamboz commented 3 months ago

i'm using window 11, pnpm and my current vue3-gettext's version is 3.0.0-beta.6 I have tried many times, but it still can't be exact

image image image My config image

Thanks

huynamboz commented 3 months ago

i tried with ubuntu and it worked but window is not image

fjeddy commented 2 months ago

I got the same issue, it's been working fine until a recent update.

lzurbriggen commented 1 month ago

Hey everyone. I just implemented a new extraction parser that should be a bit more robust. Nobody has really used it yet, but if you still have extraction issues on Windows it may be worth a try.

Make sure to check the breaking changes though, e.g. the long-deprecated <translate>/v-translate are not available anymore in v4: v4.0.0-alpha.4 and v4.0.0-alpha.2

Please let me know if you tried the new version and include your gettext-config file if you still have issues.

fjeddy commented 1 month ago

I can't get this to work. The new version gives me

vue-gettext-extract' is not recognized as an internal or external command, operable program or batch file.

module.exports = {

  input: {
    exclude: [
      './assets/images',
      './assets/locale',
      './assets/scss'
    ]
  },

  output: {
    locales: [
      'nb'
    ],
    path: './src/assets/locale',
    potPath: './locale.pot',
    jsonPath: '../../../public/locale',
    splitJson: true,
    flat: false,
    linguas: false
  }

}
lzurbriggen commented 1 month ago

@fjeddy Sorry, I messed up the bin paths. Please try again with 4.0.0-alpha.6

fjeddy commented 1 month ago

It's running now, but it's not actually extracting anything, same result as before, empty files. It's also so fast, so incredibly fast, that it doesn't seem like it's actually parsing any files. It spits out a response just as fast as I hit enter on the command.

gettext.config.cjs

module.exports = {

  input: {
    exclude: [
      './assets/images',
      './assets/locale',
      './assets/scss'
    ]
  },

  output: {
    locales: [
      'nb'
    ],
    path: './src/assets/locale',
    potPath: './locale.pot',
    jsonPath: '../../../public/locale',
    splitJson: true,
    flat: false,
    linguas: false
  }

}

output

Input directory: ./src
Output directory: ./src/assets/locale
Output POT file: src\assets\locale\locale.pot
Locales: nb

Searching: src\**\*.js
Searching: src\**\*.ts
Searching: src\**\*.vue
Excluding: src\assets\images
Excluding: src\assets\locale
Excluding: src\assets\scss

Extraction successful, src\assets\locale\locale.pot created.
Merged: src\assets\locale\nb\app.po
lzurbriggen commented 1 month ago

@fjeddy I managed to reproduce this and pushed a fix with v4.0.0-alpha.7, please let me know if it works!

fjeddy commented 1 month ago

Nice, everything seems to be working fine now!

As a sidenote, before it would spit out how many strings it found and it's now spitting out a list of all the files it searched through, spamming the console a bit. Is the removal of the "summary" that was there in 2.4.0 on purpose?

lzurbriggen commented 1 month ago

@fjeddy Nice!

Is the removal of the "summary" that was there in 2.4.0 on purpose?

Iirc that was a feature of https://github.com/lukasgeiter/gettext-extractor that I now replaced with a custom parser and would have to implement myself. Probably a good idea, thanks for the input.

huynamboz commented 1 month ago

Newest version worked for me, thanks @lzurbriggen ❤️