Closed
Description
Terms
- I have read the guidelines for Contributing to Roots Projects
- This request is not a duplicate of an existing issue
- This is not a personal support request that should be posted on the Roots Discourse community
Summary
I wish there a way of translating blade files easily
Motivation
Why are we doing this?
blade files are central for the theme
What use cases does it support?
translation
What is the expected outcome?
pot files for translation
Potential conflicts / foreseeable issues
may need wp-cli fixing
Additional Context
In order to translate a theme there's the wp-cli command
wp i18n make-pot . ./resources/lang/sage.pot --ignore-domain --include="app,resources"
however, this doesn't work on blade files as wp-cli doesn't support them:
one workaround I tried is compiling to php and then referencing php cache
wp acorn view:cache && wp i18n make-pot . ./resources/lang/sage.pot --ignore-domain --include="app,../../cache/acorn/framework/views"
however, this doesn't work either, (because such folder is outside I guess)
So, there's this workaround: compiling, copying to current folder and translating
wp acorn view:cache
cp -r ../../cache/acorn/framework/views ./viewscache
wp i18n make-pot . ./resources/lang/sage.pot --ignore-domain --include="app,viewscache"
rm -rf viewscache
if being used in package.json with yarn translate:pot
"scripts": {
...
"translate:pot": "wp acorn view:cache && cp -r ../../cache/acorn/framework/views ./viewscache && wp i18n make-pot . ./resources/lang/sage.pot --ignore-domain --include='app,viewscache' && rm -rf viewscache"
},
It works, but is so ugly.
Is there a recommended approach for translation?