Flag-based implementation of Locale
| Q | A |
|---|---|
| Is bugfix? | ❌ |
| New feature? | ❌ |
| Breaks BC? | ❌ |
| Fixed issues | Alternative of #97 |
PR Summary
-
Code Refactoring The code has been improved to be more readable and maintainable.
-
New Method: addLocaleCookieToResponseIfNeeded This addition checks for a cookie containing the user's language preference; if it doesn't exist, the method creates one.
-
New Method: getLocaleInfo This function returns an array containing information about the request's language settings, including its presence in the path, query parameters, or cookies, as well as information on the default language.
-
Handling Different Request Types New methods have been implemented to handle various request types based on specific criteria, such as redirecting to a URL with the correct language parameter, setting a response header with language preferences, or returning a response from a handler while properly setting up the URL generator.