All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
- Fixed issue with
_getSitesPerLanguage
Twig method when no language groups are defined
- Added Twig function
getGuessedLanguage
for guessing the user's preferred language - Added Twig function
getSavedLanguage
for getting the language preference that is saved in the user's session - Added Twig function
hasLanguageSuggestion
for getting abool
indicating if a better language match exists for the user - Added Twig function
getInformationForLanguage
for getting Site information from a language string
- Renamed private
_getLanguageFromSession
method togetLanguageFromSession
public method - Renamed private
_getLanguageFromGuess
method togetLanguageFromGuess
public method - Renamed private
_getPreferredLanguage
method togetPreferredLanguage
public method - Turned private
_checkIfSiteIsAlreadyInUse
method into_checkIfSiteIsAlreadyInUse
protected method - Turned private
_setQueryParameters
method into_setQueryParameters
protected method - Turned private
_getQueryParameters
method into_getQueryParameters
protected method - Turned public
_getSiteGroup
method into_getSiteGroup
protected method - Turned public
_getSiteGroupId
method into_getSiteGroupId
protected method
- Renamed
languageSwitcher
Twig extension tolanguageRedirector
- Renamed
languageSwitcher.getUrls
method tolanguageRedirector.getLanguageOptions
- Added support for Craft CMS 5.x
- Fixed language matching issue that would occur when the locales in the config file are not lowercase
- Added support for Craft CMS 4.x
- Fixed issue where visitors where automatically redirected to the defaultEntryId when it is defined. The defaultEntryId should instead only be used when calling the language switcher variable.
- Fixed edge case of $defaultEntryId, when an entry exists in a Site but is disabled
- Fixed release numbering format
- Added
defaultEntryId
setting to default to a specific Entry when the current Entry is disabled in other Sites
- Added
group
parameter to getUrls method so that the list of URLs in a specific language group can be retrieved
- Complied with psr-4 and eliminate composer deprecation warning
- Removed
__construct
method and moved the methods that were inside__construct
aftercanRedirectVisitor
method is called
- Moved the initial check to a public function within the main service
- Replaced request.app.isLivePreview with request.app.livePreview, which was deprecated in Craft CMS since v3.2.1
- Added support for multi-group Sites (multiple Sites inside multiple Site groups)
- Crawlers are now subject to a redirection that only removes the lang URL query parameter
- Fix for initializing plugin in console environment (thanks to @boboldehampsink)
- Added method that defaults to fetching the Sites and languages defined in the Sites table, should the list of Sites be undefined in the plugin's settings (thanks to @jcherniak)
- Added setting to enable/disable the redirection all together, and only keep the language switching feature
- Disable redirection for URLs that contain the ignore-lang parameter
- Added option to overrides URLs per language in the language switcher
- Added setting to enable/disable the redirection for users with CP access
- Used Craft's i18n service instead of the php-intl extension
- Initialize the language match only after the app is fully initialized
- Fixed a bug that would occur if the currently-visited entry wasn’t enable in all Sites
- Called the exit() function after setting the location header
- Fixed a bug that would occur when mixing language-based and country-based locales in the configuration file
- Now using PRS-2 and Symfony code syntax rules
- Fixed a bug that would occur when a redirected URL already contains URL parameters (thanks to @vieko)
- Fixed return value bug when craft.languageSwitcher.getUrls wouldn't return any language
- Prevent redirect if the target Element doesn't exist
- Hide elements for which no entry exist in the language switcher
- The "enabled" setting
- Documented the plugin
- Merged files and classes
- Initial release