What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hi all! I have a problem with adding additional locale on frontend to the existing store. I want to

U03U5EQCQKH
U03U5EQCQKH Posts: 3 πŸ§‘πŸ»β€πŸš€ - Cadet
edited August 2022 in Help

Hi all!

I have a problem with adding additional locale on frontend to the existing store. I want to add pl_PL locale to the demo US store. After adding it to the config/Shared/stores.php file

$templates['US'] = [
        // different contexts
        'contexts' => [
            // shared settings for all contexts
            '*' => [
                'timezone' => 'America/Los_Angeles',
                'dateFormat' => [
                    // short date (11.14.12)
                    'short' => 'm/d/Y',
                    // medium Date (Feb 01. 2012)
                    'medium' => 'M d. Y',
                    // date formatted as described in RFC 2822
                    'rfc' => 'r',
                    'datetime' => 'Y-m-d H:i:s',
                ],
            ],
            // settings for contexts (overwrite shared)
            'yves' => [],
            'zed' => [
                'dateFormat' => [
                    // short date (12-28-2012)
                    'short' => 'm-d-Y',
                ],
            ],
        ],
        'locales' => [
            // first entry is default
            'en' => 'en_US',
            'pl' => 'pl_PL',
        ],
        // first entry is default
        'countries' => ['US'],
        // internal and shop
        'currencyIsoCode' => 'USD',
        'currencyIsoCodes' => ['USD'],
    ] + $templates['default'];
$stores['US'] = [
    // different contexts
    'contexts' => [
        // shared settings for all contexts
        '*' => [
            'timezone' => 'America/Los_Angeles',
            'dateFormat' => [
                // short date (11.14.12)
                'short' => 'm/d/Y',
                // medium Date (Feb 01. 2012)
                'medium' => 'M d. Y',
                // date formatted as described in RFC 2822
                'rfc' => 'r',
                'datetime' => 'Y-m-d H:i:s',
            ],
        ],
        // settings for contexts (overwrite shared)
        'yves' => [],
        'zed' => [
            'dateFormat' => [
                // short date (12-28-2012)
                'short' => 'm-d-Y',
            ],
        ],
    ],
    'locales' => [
        // first entry is default
        'en' => 'en_US',
        'pl' => 'pl_PL',
    ],
    // first entry is default
    'countries' => ['US'],
    // internal and shop
    'currencyIsoCode' => 'USD',
    'currencyIsoCodes' => ['USD'],
    'queuePools' => [
        'synchronizationPool' => [
            'US-connection',
        ],
    ],
    'storesWithSharedPersistence' => [],
];

it show up in the dropdown on the page, but when I'm choosing it, I'm getting below error.
No route found for "GET <http://yves.us.spryker.local/pl>" (from "<http://yves.us.spryker.local/>")

Any idea why is it happening? I cannot find anything in the docs regarding this.

Comments

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    Did you edit product data in import files to have this additional locale?

  • U03U5EQCQKH
    U03U5EQCQKH Posts: 3 πŸ§‘πŸ»β€πŸš€ - Cadet

    Nope, I didn't touch anything besides the glossary and store config itself. Does spryker need this to run the HP?

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    This is an internal usage doc I created a while ago and I'm not sure if it's still up-to-date.
    But it can direct you in the right direction probably.

    [Internal usage] How to add a new store + locale
    
    This guide is not intended to add new store into already running system. It will work only during development and only with expectation that complete project resetup is acceptable.
    
    In this how-to I was adding FR store and fr_FR locale for testing needs.
    In general, to add a new store and a new locale next steps need to be done:
    
    1. You need to modify next files with product data to add new localized attributes and entries:
    
    data/import/common/common/category.csv
    data/import/common/common/cms_block.csv
    data/import/common/common/cms_page.csv
    data/import/common/common/content_banner.csv
    data/import/common/common/content_navigation.csv
    data/import/common/common/content_product_abstract_list.csv
    data/import/common/common/content_product_set.csv
    data/import/common/common/glossary.csv
    data/import/common/common/navigation_node.csv
    data/import/common/common/product_abstract.csv
    data/import/common/common/product_concrete.csv
    data/import/common/common/product_discontinued.csv
    data/import/common/common/product_image.csv
    data/import/common/common/product_image_internal.csv
    data/import/common/common/product_label.csv
    data/import/common/common/product_management_attribute.csv
    data/import/common/common/product_option.csv
    data/import/common/common/product_search_attribute.csv
    data/import/common/common/product_set.csv
    
    2. Copy data/import/common/DE to data/import/common/FR with all its content and change all files inside to reflect FR store.
    
    3. Modify install recipes to add new folder you created\copied at the previous steps:
    
    data/import/common/catalog_setup_import_config_EU.yml
    data/import/common/combined_product_import_config_EU.yml
    data/import/common/commerce_setup_import_config_EU.yml
    data/import/common/content_management_import_config_EU.yml
    data/import/common/merchandising_import_config_EU.yml
    data/import/common/special_product_types_import_config_EU.yml
    data/import/local/full_EU.yml
    
    4. Modify config/Shared/stores.php to add new store and locale.
    
    5. Modify src/SprykerConfig/CodeBucketConfig.php to add new store.
    
    6. Modify deploy.dev.yml to add new ES and Redis indexes, endpoints, DB and RMQ vhosts.
    
    7. If your project has store-specific configuration, adjust it as well in config_default_*_FR.php
    
    8. Run docker/sdk boot deploy.dev.yml and docker/sdk reset to re-create all containers with all the changes you made.
    
  • U03U5EQCQKH
    U03U5EQCQKH Posts: 3 πŸ§‘πŸ»β€πŸš€ - Cadet

    thanks! will try it!

  • U035GSLDLVD
    U035GSLDLVD Posts: 90 πŸ§‘πŸ»β€πŸš€ - Cadet

    @valerii.trots Super helpful! Did you mean if we create a store through above steps can not be deployed on production? What's the right approach to add a new store to existing running system?

  • U03S89PFA6R
    U03S89PFA6R Posts: 1 πŸ§‘πŸ»β€πŸš€ - Cadet

    Think you also need to update Router configuration:

    vendor/spryker/router/src/Spryker/Yves/Router/RouterConfig.php
    

    and add new Locales and Stores