1

Simple question, but can't seem to find anywhere online that explains it.

Using static content deploy, to generate the theme files like so:

bin/magento setup:static-content:deploy

Obviously once the theme is deployed and in developer mode, i don't need to do this again, but...

This deploys to en_US but my store is running under en_GB , is there a default way to deploy to en_GB inside of my theme or anywhere in-particular? or do i have to pass this through each time i want to do a S:S:D

If anyone knows if it can or cannot be done, that'd be a big help.

Thanks

2

I've had a look into this myself in the past. It seems Magento sets the Default Language as a Constant inside the following class:

Magento\Deploy\Console\Command\DeployStaticContentCommand

/**
 * Default language value
 */
const DEFAULT_LANGUAGE_VALUE = 'en_US';

It then references the constant when it prepares the deployable entities, inside private function prepareDeployableEntities($filesUtil).

So without going into too much detail, maybe you could write a preference for your own class and set the constant to en_GB.

See the following for some good instructions on how to set a preference in M2: http://devdocs.magento.com/guides/v2.0/extension-dev-guide/plugins.html

Your extensions etc/di.xml would looks something like below:

<?xml version="1.0" encoding="UTF-8" ?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
        <preference for="Magento\Deploy\Console\Command\DeployStaticContentCommand" type="Namespace\Module\Console\Command\DeployStaticContentCommand" />
    </config>

Another option could be to redefine the argument for staticContentDeployCommand although I'm not too sure how this would work. Possibly just like below in your etc/di.xml:

<type name="Magento\Framework\Console\CommandListInterface">
    <arguments>
        <argument name="commands" xsi:type="array">
            <item name="staticContentDeployCommand" xsi:type="object">Namespace\Module\Console\Command\DeployStaticContentCommand</item>
        </argument>
    </arguments>
</type>

Hope this helps,

Josh

| improve this answer | |
  • Massive help, exactly what i was looking for, thank you josh :) – andy jones May 11 '17 at 11:09
  • You're welcome Andy, glad i could help! – JoshCarter May 11 '17 at 12:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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