Installation and configuration guide for the Magento 2 Language Flags module
Installation
Installation via Composer
composer require kowal/module-language-flagsbin/magento module:enable Kowal_LanguageFlagsbin/magento setup:upgradebin/magento cache:flushInstallation from the Git repository
composer config repositories.kowal-language-flags vcs https://github.com/kowalco/language-flagscomposer require kowal/module-language-flagsbin/magento module:enable Kowal_LanguageFlagsbin/magento setup:upgradebin/magento cache:flushAdditional commands for production mode
bin/magento setup:di:compilebin/magento setup:static-content:deploy -fbin/magento cache:flushConfiguration location
Admin panel:
Stores > Configuration > Kowal > Language FlagsCMS editor widget
The module provides the following widget:
Language Flags SwitcherIt can be inserted in:
Content > BlocksContent > Pages
Editor path:
Edit > Insert Widget > Language Flags SwitcherThe widget supports:
dropdownorinlinemode;- showing or hiding language names;
- an additional CSS class.
Default flags
During bin/magento setup:upgrade, the module copies default SVG files from:
view/frontend/web/images/flags/to the directory:
pub/media/language_flags/Only missing files are copied, without overwriting existing flags.
General configuration
The General Settings section contains fields that control the module behavior.
Enable Module
Path:
language_flags/general/enabledMeaning:
Yesenables the module;Nodisables the module on the frontend.
Replace Native Store View Switcher
Path:
language_flags/general/native_enabledMeaning:
Yesreplaces the native Magento switcher with a flag version;Noleaves the native switcher unchanged.
Native Display Mode
Path:
language_flags/general/native_display_modeAvailable options:
dropdowninline
Meaning:
dropdownshows the current item and a dropdown list of the remaining ones;inlineshows all flags at once in a single line.
Show Language Names
Path:
language_flags/general/show_labelsMeaning:
Yesshows language names next to flags;Nohides the names in the main view, but keeps them for accessibility.
Fallback to Store View Name
Path:
language_flags/general/fallback_to_store_nameMeaning:
Yesuses the store view name whenLabelis not filled in;Nouses the store view code in uppercase.
Inline Flag Gap (px)
Path:
language_flags/general/inline_gapMeaning:
- sets the spacing between switcher elements in
inlinemode; - the value is measured in pixels;
- the default value is
8.
Icon Scale (%)
Path:
language_flags/general/icon_scale_percentMeaning:
100preserves the original image dimensions;- a lower value reduces width and height proportionally;
- scales flags in both rendering modes.
Configuration of flag tables
The module supports three separate sets of entries:
Store View FlagsWebsite FlagsCustom URL Flags
On the frontend, the entries are combined into one set of switcher elements.
Store View Flags
Path:
language_flags/general/flag_configPurpose:
Configuration of flags for store views handled by the native Magento mechanism.
Form columns
Store Code
Selects a store view from the Magento list.
Meaning:
- assigns a flag to a specific store view;
- uses the native Magento store view switching mechanism.
Flag File
The path to the flag file selected from the built-in file picker.
Meaning:
- defines the image displayed on the frontend;
- can be saved as
pl.svgorlanguage_flags/pl.svg; - relative paths are resolved from the directory:
pub/media/language_flags/Label
The full language or market name, for example:
PolishEnglishGerman
Meaning:
- is displayed next to the flag when
Show Language Namesis enabled; - also serves as helper text for accessibility.
Short Label
A shortened label, for example:
PLENDE
Meaning:
- is used in a more compact view;
- can be used instead of the full name.
Website Flags
Path:
language_flags/general/website_flag_configPurpose:
Configuration of flags pointing to other websites in the same Magento instance.
How it works
- clicking does not perform the native
store switch post; - the entry is rendered as a regular link to the target website base URL;
- the current website is not added as a separate option.
Form columns
Website
Selects a Magento website from the list.
Meaning:
- defines the target website for the entry;
- is used to retrieve the base URL of the target storefront.
Flag File
Works the same as in Store View Flags.
Label
The full label displayed on the frontend.
If left empty:
- the module will use the website name.
Short Label
A shortened label, for example:
UKDEFR
If left empty:
- the module will use the website code in uppercase.
Custom URL Flags
Path:
language_flags/general/custom_url_flag_configPurpose:
Configuration of flags pointing to any URLs, for example to another Magento instance or an external store.
Form columns
URL
The target link address.
Examples:
https://example.de/https://en.example.com/https://shop.example.cz/
Meaning:
- the entry is rendered as a regular
hreflink; - it does not use the native Magento store switch mechanism.
Flag File
Works the same as in the other tables.
Label
The full label displayed on the frontend.
If left empty:
- the module will try to use the host from the URL.
Short Label
A shortened label for the compact variant.
If left empty:
- the module will build a shortcut based on the host;
- if that is not possible, it will use the
URLvalue.
Preparing flag files
Recommended location:
pub/media/language_flags/Recommended formats:
svgpng
Examples of file names:
pl.svgen.svgde.svgfr.svgBasic configuration flow
- Enable the module via
Enable Module. - Decide whether you want to replace the native Magento switcher.
- Set
Native Display Mode. - Add flag files to
pub/media/language_flags/. - Complete
Store View Flags. - Add optional entries in
Website Flags. - Add optional entries in
Custom URL Flags. - Save the configuration and clear the cache.
Useful CLI commands
bin/magento module:status Kowal_LanguageFlagsbin/magento cache:cleanbin/magento cache:flush



















