jshmrtn / vue3-gettext

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

Fix extracted line numbers #50

Closed FedorSherbakov closed 8 months ago

FedorSherbakov commented 10 months ago

A couple of fixes:

embeddedJS

Change way of extracting embedded JS to look for "#text" nodes, as serializer drops original line breaks and results with wrong line numbers

Such example was giving wrong line numbers:

<div>
  <button
    class="something"
    type="button"
  >
    {{ $gettext('Hello there!') }}
  </button>
</div>

attributeEmbeddedJS

Prevent scope leak for lineNumberStart variable, so result is correct for all attributes in tag, not only the first one

Such example was giving wrong line numbers:

<button
  class="something"
  v-text="$gettext('Hello there!')"
/>
FedorSherbakov commented 10 months ago

Hi @lzurbriggen!

Could you take a look please? This one pretty much reduces noise in po files 🙂

jeremyzahner commented 10 months ago

@lzurbriggen LGTM.