-
Notifications
You must be signed in to change notification settings - Fork 55
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
Handling of leading and trailing whitespace in templates inconsistent #80
Comments
More research show, it is a formatting challenge with vue-gettext, see where <template>
<div id="app">
<a href="https://vuejs.org/">Vue.js</a>
<translate> is nice</translate>
<br />
<a href="https://vuejs.org/">Vue.js</a>
<translate> is very nice</translate>
<br />
<a href="https://vuejs.org/">Vue.js</a>
<translate>is wonderful</translate>
</div>
</template> with {
"en_US": {
"is nice": "is nice"
}
} leads to
expected would be
|
I am not sure that this is a vue-gettext issue. Using your code sample without any <template>
<div id="app">
<a href="https://vuejs.org/">Vue.js</a>
<span>is nice</span>
</div>
</template> I'm getting Did you use Btw, you can read more about spaces in issue #65 |
@kemar thanks for responding! I'm not sure either where to search for the problem. Just using a plain .html file will not display the problem, so vue (and potentially vue-gettext) is still needed to reproduce the issue. Just to confirm: we there is no I've read #65 before, but it hasn't gotten me the right idea. workaroundin cases where a leading space is needed, we are now using <span v-translate class="fix-trans-space">to be translated</a> and in style.sass .fix-trans-space
&:before
content: " " so we can centrally remove the style, once the rest is working as expected again. |
Yes, there seems to be a general vue.js problem, so I've opened an issue with them (see automatic link). Still the inconsistency remains as an issue for vue-gettext |
@bernhardreiter you should have a look at this comment vuejs/vue#9021 (comment) (referenced in the issue you opened on Vue repo). You have to configure your stack correctly at some point, with This isn't a bug with vue-gettext at all :) |
To your comment I've followed the link to https://github.com/vuejs/vue/tree/dev/packages/vue-template-compiler#options which reads
I've grepped my source files and did not find Still I believe that for users of vue-gettext this poses and issue which should be documented and the inconsistency between translated and untranslated should be removed. Both is surprising to a vue-gettext users and eats time to find out. |
Leading and trailing whitespaces are stripped with [email protected] and [email protected]
only if a translation is available. This is an inconsistency which can be a problem together with some styling.
example
We have code like
Case 1:
If there is no translation available, this get expanded to something like
which in our style sheet formats with space as expected like
Vue.js is nice
.Case 2
there is a translation, this becomes
which in our style sheet formats without space between like
Vue.jsist nett
.Inconsistency
Case 1 and 2 are inconsistent, the behaviour should be the same
and not depending on if there is a translation available for a language or not,
because it is reasonable to leave the default translation untranslated in the .po file.
formatting problem
My expectation would be that the rendering of
is as similiar to those of
as possible.
But now of course I go looking into our style sheet to see where the difference
comes from.
Thanks for creating vue-gettext as Free Software! :)
The text was updated successfully, but these errors were encountered: