vue3-gettext icon indicating copy to clipboard operation
vue3-gettext copied to clipboard

Translation seems fails with & symbol

Open Wewill opened this issue 1 year ago • 6 comments

In a vue3 project, this code fails translating :

<translate>Use 8 or more characters with a mix of letters, numbers & symbols.</translate>

Best !

Wewill avatar Apr 04 '23 18:04 Wewill

Does the same message string work using {{ $gettext("myMessage") }}? <translate> is deprecated and will be removed soon.

lzurbriggen avatar Apr 05 '23 06:04 lzurbriggen

Hi @lzurbriggen,

It fails too with $gettext(), exact message is :

msgid "Use 8 or more characters with a mix of letters, numbers & symbols." ( two spaces after & = &spacespace ) ( working well with = &space )

  <translate>Use 8 or more characters with a mix of letters, numbers &  symbols.</translate>
  {{ $gettext("Use 8 or more characters with a mix of letters, numbers &  symbols.") }}

Wewill avatar Apr 06 '23 08:04 Wewill

Hi,

I am experiencing the same issue with newlines (\n) in keys. The culprit seems to be the fact that translation files have their keys normalised, while the msgid is not normalised when trying to get the translation.

I'm unsure if this is intended or not, but it is definitely creating an issue for us too

TripleM-AoC avatar Feb 08 '24 09:02 TripleM-AoC

@TripleM-AoC thanks for the additional info.

we're planning to finally do the bigger update we wanted to do a long time ago (https://github.com/jshmrtn/vue3-gettext/pull/41) in the coming weeks and will try to fix this as well.

lzurbriggen avatar Feb 08 '24 10:02 lzurbriggen

I implemented a new extraction parser and tested it with {{ $gettext("Use 8 or more characters with a mix of letters, numbers & symbols.") }}, it seems to parse correctly. I wrote a test that extracts a unicode sample so it seems to have no issues with most characters.

Make sure to check the breaking changes, e.g. <translate> has finally been removed: v4.0.0-alpha.4 and v4.0.0-alpha.2

I am experiencing the same issue with newlines (\n) in keys. The culprit seems to be the fact that translation files have their keys normalised, while the msgid is not normalised when trying to get the translation.

I'm not exactly sure what caused OPs issue, but I believe I fixed this particular issue in v4.0.0-alpha.4.

lzurbriggen avatar Aug 08 '24 16:08 lzurbriggen

I'm not exactly sure what caused OPs issue, but I believe I fixed this particular issue in v4.0.0-alpha.4.

Thanks! I will give the alpha version a test drive when I get a chance :)

TripleM-AoC avatar Aug 08 '24 17:08 TripleM-AoC