Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translation seems fails with & symbol #44

Open
Wewill opened this issue Apr 4, 2023 · 6 comments
Open

Translation seems fails with & symbol #44

Wewill opened this issue Apr 4, 2023 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@Wewill
Copy link

Wewill commented Apr 4, 2023

In a vue3 project, this code fails translating :

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

Best !

@lzurbriggen lzurbriggen added the bug Something isn't working label Apr 5, 2023
@lzurbriggen
Copy link
Collaborator

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

@Wewill
Copy link
Author

Wewill commented Apr 6, 2023

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.") }}

@mph-lessor
Copy link

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

@lzurbriggen
Copy link
Collaborator

@TripleM-AoC thanks for the additional info.

we're planning to finally do the bigger update we wanted to do a long time ago (#41) in the coming weeks and will try to fix this as well.

@lzurbriggen lzurbriggen self-assigned this Feb 8, 2024
@lzurbriggen
Copy link
Collaborator

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.

@mph-lessor
Copy link

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants