1

We have a site that has been designed with a new theme for each language and each language on a different URL.

It's not how I would have built it but we have to "run what you brung".

The problem I have is deploying static content takes hours as it does every language (12) for each theme (18? Some themes are for dual language countries like China in Chinese and English) plus the base themes like Luma and Blank.

I know once the initial compile is done I can target re-deployments with -theme and -l but I am wondering if I can do a full compile but specify "only compile this theme in this language and this theme in this language"

Edit for clarity To be 100% clear, I am well versed in the Magento CLI and how to select different languages and restrict to different theme's and areas, how to exclude themes etc.

I am looking specifically to see if there's a way to issue a deploy command that deploys each theme but only in the languages they are designed for, not all the languages declared as available.

As per above, 12 langs and 18 themes causes 216 deployments (plus base themes!) and takes a long time. In fact, the language to theme map means we only need to compile about 20-30 of these combinations as the other languages are useless in the context of all but the specific theme designed for them...

I am also well aware that this site is not correctly structured and that is the root cause for this SNAFU, that a base theme should be used with internationalization to provide translation and sub-themes for lang specific layouts and blocks, but I'm not working on my own creation but rather deploying changes to an existing production environment, so I can't really rebuild it all from scratch (much as I'd like to!)

PS> Thanks for the grammar check @Evince, typing too quick again!

4
  • Did you ever find the solution for this?
    – Prateek
    Commented Jun 23, 2020 at 19:06
  • Hey @Prateek, sadly no, in fact we rebuilt our strategy. We ended up building a set of 3 translatable themes (one with checkout, one with a full catalog and one more info only) and assigned different locales to the relevant theme (with all strings translatable of course). We also maintain a spreadsheet of the locales and which theme they are assigned so I can filter the lang codes per theme and copy paste them into a command like setup:static-content:deploy --theme="Vendor/Theme_1" la_NG la_NG2 .... Commented Jun 25, 2020 at 8:42
  • Yeah, I am going about this in same way, list of deploy commands with language-theme pairs. Thought I'd ask, if there is a better alternate to maintaining such list.
    – Prateek
    Commented Jun 25, 2020 at 13:57
  • Yeah, sadly I didn't find one. I mean you might be able to script the commands by doing a database query on the theme and store tables... One thing the above did do for me though, is forced me to review the theme's to see if they were reusable, I highly recommend this! We went from 15 dedicated themes (one per lang) to 1 parent and 2 child themes! Most langs assigned to parent with a few assigned to the variants! Saves alot of compile time too. All the best Prateek! Commented Jun 26, 2020 at 11:26

2 Answers 2

-1

You can use

For different language

php bin/magento setup:static-content:deploy en_US

For different theme (Working on 2.1.1 or later)

php bin/magento setup:static-content:deploy --theme="Magento/backend"
1
  • Thanks however as per question I'm looking to combine different languages and themes at the same time, without every listed language for every listed theme... Commented Oct 10, 2018 at 11:56
-1

Yes you can do it using below command.

php bin/magento setup:static-content:deploy --theme Vendor/theme1 --theme Vendor/theme2

Exclude themes By this command:

php bin/magento setup:static-content:deploy --exclude-theme Vendor/yourtheme

For specific theme and specific language:

php bin/magento setup:static-content:deploy --theme Magento/backend --theme Vendor/theme1 en_US ko_KR
1
  • Thanks however as per my question I know how to deploy a specific theme for a specific languages, I'm looking for a way (might not be possible) to compile specific themes for specific languages. For instance Theme-en for en_US and en_GB and Theme-Swiss for de_CH and fr_CH without chaining like 12 different compile commands. Almost like declaring what languages the theme is for in the theme config. At the moment 12 languages and 18 themes causes deploy to process 216 theme & lang combinations and takes hours even though most languages in the list are not used in each theme Commented Oct 10, 2018 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.