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

Problem with CLI 3 configuration and html tags #75

Open
kevingobert opened this issue Sep 27, 2018 · 7 comments
Open

Problem with CLI 3 configuration and html tags #75

kevingobert opened this issue Sep 27, 2018 · 7 comments

Comments

@kevingobert
Copy link

kevingobert commented Sep 27, 2018

Translations don't match because VueJS adds the data-v attribute.

screenshot 2018-09-27 17 42 52

screenshot 2018-09-27 17 44 09

screenshot 2018-09-27 17 45 10

Config
screenshot 2018-09-27 17 49 27

<template>
  <div class="home">
    <p v-translate>Hello!</p>
    <translate :translate-n="count" translate-plural="%{ count } cars">%{ count } car</translate>
    <p v-translate='{count: carNumbers}' :translate-n="carNumbers" translate-plural="<strong>%{ count }</strong> cars" translate-comment="My comment for translators">
      <strong>%{ count }</strong> car
    </p>
  </div>
</template>

Edit 28/09
I only have this problem when using it in a component with html tags in string

Thanks

@kevingobert
Copy link
Author

kevingobert commented Oct 2, 2018

I have the problem when the style is "scoped". Do you have a solution for this?

@mantasdaraciunas
Copy link

@kevingobert Have you solved this issue?

@kevingobert
Copy link
Author

@mantasdaraciunas No, I have not found a solution.

@wjdp
Copy link

wjdp commented Dec 4, 2019

Just come across this.

Seems if you have <style scoped> in your Vue SFC Vue will inject these data attributes on every HTML element.

e.g.

<p v-translate>Hello <strong>World</strong></p>

becomes

<p v-translate data-v-abc123>Hello <strong data-v-abc123>World</strong></p>

and translations no longer match.

@kevingobert Did you find a solution?

@idekov-hf
Copy link

I'm experiencing the same issue and wanted to check if there are any updates on this.

@codebykenny
Copy link

codebykenny commented Sep 15, 2020

We are experiencing the same exact issue, the data-v variable with scoped styles changes the msgid and therefore the translation is not found.

A solution to this problem might be using regex, remove the randomly generated data-v-* variables

For example msgid = msgid.replace(/(data-v-([0-9a-z]*)="" )/gm, '');

@Getz85
Copy link

Getz85 commented Dec 15, 2020

Same issue here, any news on this ?
Or a workaround ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants