-
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
templates string support #81
Comments
Hi, you should use https://github.com/Polyconseil/easygettext for string extraction. It's not part of vue-gettext as stated in the readme ;) But it's totally capable of extracting template strings, and much more ES6 constructs. |
Well, I used it, and I installed the Makefile that it shipped with vue-gettext, if I read it correctly it calls easygettext in the beginning and then it calls xgettext:
It's that part that complains:
So when you say that I shoud use easygettext, do you mean I shouldn't use the Makefile shipped with vue-gettext? BTW, easygettext in the home page does not report any single example with template strings built with backtits as in my example... |
You're right, I'll update both tomorrow!
…On Mon, Dec 10, 2018, 20:14 Sandro Dentella ***@***.*** wrote:
Well, I used it, and I installed the Makefile that it shipped with
vue-gettext, if I read it correctly it calls easygettext in the beginning
and then it calls xgettext:
# Extract gettext strings from JavaScript files.
xgettext --language=JavaScript --keyword=npgettext:1c,2,3 \
--from-code=utf-8 --join-existing --no-wrap \
--package-name=$(shell node -e "console.log(require('./package.json').name);") \
--package-version=$(shell node -e "console.log(require('./package.json').version);") \
--output $@ $(GETTEXT_JS_SOURCES)
It's that part that complains:
$ cat templateString.js
let title = `<h6 class="display-4">${translatedTitle}</h6>`
$ xgettext --language=JavaScript --keyword=npgettext:1c,2,3 --from-code=utf-8 --join-existing --no-wrap --output /tmp/output.pot templateString.js
templateString.js:3: warning: RegExp literal terminated too early
So when you say that I shoud use easygettext, do you mean I shouldn't use
the Makefile shipped with vue-gettext? BTW, easygettext in the home page
does not report any single example with template strings built with
backtits as in my example...
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#81 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAFaKncjTs3dcpg-6tlVCgcEhbYIhK-zks5u3rKOgaJpZM4ZKY3Q>
.
|
It's done now. Makefile and docs updated in both packages, on master though, I did not create a release just for this. |
By the way: |
Thank you very much Victor, I do have some more problems with the suggested configuration of easygettext (that's why I write here rather than in the easygettext repo's issue tracker). One of the suggested solutions (@kemar) for attribute translations (inline expression) is not working for me (#9):
while it (almost) works the configuration suggested by @mazavr in that same thread using the filter ():
I say "almost" as on some .js file (note .js not .vue...) it takes a huge quantity of time and once it didn't arrive at the end of the task. So I thought to issue gettext twice as:
But it seems the second run of gettext-extract deletes some of the messages already extracted... |
A Makefile that extracts more translations strings for me:
this allows me to use translation in attributes as per previous message (with filter version). It extracts thought |
Hi, I wanted to start localizing a new project using vue-gettex that strikes me for the rich documentation and the solution 360 degrees (from .vue, to extracting and to json).
I read the limitation in the docs but when I started I discovered that template strings are not supported in any form, I understand that's a limitation of xgettext.
Are you suggesting to avoid using template strings? (In this case I think a mention in the docs should be present) or you have some solution I didn't find?
Just to be more explicit: it will silently ignore:
let home: $gettext(
home)
while it will complain fortitle = `<h6 class="display-4">${translatedTitle}</h6>
with a message like:
attention, not terminated string
.The text was updated successfully, but these errors were encountered: