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

Vuejs templates #201

Open
dy opened this issue Jul 15, 2020 · 2 comments
Open

Vuejs templates #201

dy opened this issue Jul 15, 2020 · 2 comments

Comments

@dy
Copy link

dy commented Jul 15, 2020

What's the right way to use ttag with vue templates?
Would be useful to be able to just

<template>
  {{ t`Hello World!` }}
</template>

But for now .vue files are not even taken to consideration.

@AlexMost
Copy link
Member

Hi @dy,
.vue files were added recently to ttag-cli ttag-org/ttag-cli#93. @eavae probably can help here, because I haven't used ttag and vue still.

@dy
Copy link
Author

dy commented Jul 16, 2020

Ok, I see @eavae's method, it implies passing all strings as data:

<template>
<div id="app">
  <p>{{ messageHello }}</p>
</div>
</template>
<script>
import { t } from "ttag";
export default {
    data() {
        return {
            messageHello: t`Hello World`
        };
    }
};
</script>

which is a bit of overhead, similar to vue-i18n:

<template>
<div id="app">
  <p>{{ $t("message.hello") }}</p>
</div>
</template>

I wonder if there's a way to make vue + ttag as natural as just

<template>
<div id="app">
  <p>{{ t`String to translate` }}</p>
</div>
</template>

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

2 participants