Fix translation extraction#1776
Conversation
| v-tooltip.auto=" | ||
| t('Close')" |
There was a problem hiding this comment.
Seems weird, and most likely invalid with our styleguide 🤔
There was a problem hiding this comment.
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.
Why do you need the newline anyway?
There was a problem hiding this comment.
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.
Can't we fix the gettext-extractor directly? No one is going to remember putting new lines :/
There was a problem hiding this comment.
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.
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.
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.
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 <jotoeri@users.noreply.github.com>
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.