Skip to content
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

Translate blade files #2963

Closed
3 tasks done
eduardoarandah opened this issue Jan 27, 2022 · 2 comments
Closed
3 tasks done

Translate blade files #2963

eduardoarandah opened this issue Jan 27, 2022 · 2 comments

Comments

@eduardoarandah
Copy link

Terms

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:

wp-cli/i18n-command#147

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?

eduardoarandah added a commit to eduardoarandah/sage that referenced this issue Jan 27, 2022
@SergiArias
Copy link

I posted something similar not so long ago and it was a duplicate already. It's planned for the beta.4: #2672 and #2929

@swissspidy
Copy link

however, this doesn't work on blade files as wp-cli doesn't support them:

There is now a WIP PR for adding support in WP-CLI, see wp-cli/i18n-command#304

@retlehs retlehs closed this as completed May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants