cancel
Showing results for 
Search instead for 
Did you mean: 

in the store language selection in the header

in the store language selection in the header

Hello

 

We want to make our shop in several languages.
When we add a store and a store view
this will be shown at the bottom of the footer
we would have it better in the header with country flag
Is that possible?
if yes how?

 

greeting

Matthias

4 REPLIES 4

Re: in the store language selection in the header

Hi Matthias

 

To move the store view switcher from footer to header you need to follow below steps.

 

1) Assuming you have created custom theme and activates it for your webstore.

 

2) how to create custom theme refer this link - https://webkul.com/blog/show-different-language-flags-instead-of-dropdown-magento/

 

3) Once the custom theme is active - create directory called "Magento_Theme" in app/design/frontend/Theme_Vendorname/Theme_name directory

 

4) Now In Magento_Theme directory create a directory called "layout" and in layout directory create a file called "default.xml".

 

5) So full path should be like this - app/design/frontend/Theme_Vendorname/Theme_name/Magento_Theme/layout/default.xml

 

6) Put below code in default.xml

  

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<move element="store_switcher" destination="header-wrapper" after="top.links" />
</body> 
</page>

7) run php bin/magento cache:clean command


8) run php bin/magento cache:flush command

 

Now store switcher will show on the header part.

 

To display the store flags instead of store view name , later on you can use this extension - https://github.com/magekey/module-stores-flags

 

if issue solved, Click kudos/Accept as solutions.

if issue solved,Click Kudos & Accept as Solution

Re: in the store language selection in the header

This would be possible but it would require a developer. I don't think I've seen an Do you have Magento development experience or are in touch with someone that is?

 

There are some "Store-switching" tools, e.g. https://marketplace.magento.com/mageworx-module-storecurrencymeta.html but it doesn't provide the country dropdown.

----
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution" as appropriate. Thanks!

Re: in the store language selection in the header

To do it the easy way, use the following extension. It's easy to install, feature-rich and will allow you to display prompt box in header from where you can choose to switch to the desired store with local language and currency. 

 

https://www.fmeextensions.com/geo-ip-default-language-currency-magento-2.html

Re: in the store language selection in the header

I already have multiple stores

When a customer opens a website in France, that time website translates into French.

Store name:

en

it

es

fr

zh-CN

 

For the language dropdown, I have used the google translate script.

See the below code:

<div class="google-language" id="switcher-language<?= $block->escapeHtmlAttr($id) ?>">
<label for="select-language"><?= $block->escapeHtml(__('Language:')) ?> </label>

<!-- Google Element Translator Styling-->
<style>
.goog-te-combo{width: px !important;}
.goog-te-balloon-frame{display: none !important;}
font{background: transparent !important;}
a font:hover{ color: !important;}
#google_translate_element{height: 26px !important;overflow: hidden !important;}
.goog-te-banner-frame{display: none !important;}
body{top: 0px !important;}
</style>

<!-- Google Element Translator -->
<div id="google_language_drop">
<div id="google_translate_element"></div>
</div>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({
includedLanguages: 'en,it,es,fr,zh-CN',
}, 'google_translate_element');
}
</script>
<script type="text/javascript" src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
</div>

How to auto select dropdown as per customer geolocation.

 

URL: https://wearemotorsportnation.com/