Closed handbremse closed 2 years ago
Sorry, but why should the subdomain detection make sense on localhost?
For tests on localhost ... e.g. ReactCreateApp in default working on http://localhost:3000 http://fr.localhost:3000 is working fine. The current detection is not finding any subdomain so the default language is displayed .. first gues: The whole translation is not working.
Would you like to send a Pull Request to address this?
v6.1.5
🚀 Feature Proposal
The subdomain detection only works on public domains. In a development area is often localhost the domain. Then the subdomain detection is not working.
Motivation
The detection should also work on localhost development.
Example
The regex detection is based on the full URL. However, this is slightly unnecessary, since it is about your domain recognition. So you can take protocols or paths out of the detection.
The window.location object provides a property for this, which only outputs the hostname.
We assume that public domains always have at least one dot in them. The remaining characters are "word characters".
Everything that is before the Publik domain and has at least 2 and up to 5 characters (word characters) is the subdomain.
For the development area there is the or option "localhost" to the Publik Domain in the RegEx.
The regex option "g" (global) can be removed - on the kind of regex is has no impact.