This script uses the great message extraction library gettext-extractor by lukasgeiter.
The script assumes that the location of the source files is ./src
. It parses both .js
and .vue
files. It writes the PO template file in ./i18n/messages.pot
.
Some things to note:
- It assumes that interpolations in the templates use the delimieters
{{}}
(it is the most commmon case). - It assumes that both the template and the script sections of the
.vue
single file components are defined inline, and not referenced by asrc
attribue (it is the most common case). - Expressions to extract are hardcoded. Currently they are
['$t', '[this].$t', 'i18n.t']
.
hello, thanks for the gist.
can you include htmlextractor for attributes in html tags?
like:
with this code i can get values from attribute per example:
<div v-translate="'value'"></div>