-
Notifications
You must be signed in to change notification settings - Fork 90
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
Fix translation extraction #1776
Conversation
v-tooltip.auto=" | ||
t('Close')" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems weird, and most likely invalid with our styleguide 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, however linter does not complain, i checked that as i was also expecting some problems... 🤔
Alternative approach would be this, it's just a bit more of code...
data {
return {
closeTranslation: t('Close')
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need the newline anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npm run l10n:extract
respectively gettext-extractor
(build/extract-l10n.js) did not recognise it within an html-tag. So no extraction, no translations on transifex... 😢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we fix the gettext-extractor
directly? No one is going to remember putting new lines :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't find a way... A PR on the repo seems not worth the work, as there are other PRs that just didn't get merged (see linked issue above and this PR).
Only other way, that i could imagine would be to use a html-parser with specific html-tags t and n to put the translations in a second time, but thats even more hacky.
Or just some completely different parser-package... 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any preferences? As i said - i don't see us currently fixing the extractor.
- Using the given way or the proposed data/prop way? The latter is probably a bit cleaner, but 5 LoC more. The prop could also be done as object
l10n.close = t('Close')
- Just came to my mind that i could additionally add a workflow spitting a warning if some pattern
="t(
is found. This is how i found those three occurences.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data {
return {
closeTranslation: t('Close')
}
}
Let's use this syntax instead then, will be cleaner and easier to manage
The other option I could think of would be to build the dev webpack and parse the results
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so it's this version now.
The webpack-dev-build i looked into for moment, but it seems to be not fully straight forward.
43ecfc2
to
ec733aa
Compare
Signed-off-by: Jonas Rittershofer <[email protected]>
ec733aa
to
50e88a1
Compare
Two small things:
n('%n Action', '%n Actions', n)
the extraction needs to use parameters 0 and 1. Didn't get recognized, as there are currently no plural-translations on this repo.