https://github.com/happyuky7/automatic-language-detection-redirect.js
automatic-language-detection-redirect.js
https://github.com/happyuky7/automatic-language-detection-redirect.js
Last synced: 3 months ago
JSON representation
automatic-language-detection-redirect.js
- Host: GitHub
- URL: https://github.com/happyuky7/automatic-language-detection-redirect.js
- Owner: Happyuky7
- License: mit
- Created: 2022-06-14T23:25:04.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-06-14T23:44:57.000Z (almost 3 years ago)
- Last Synced: 2025-01-06T14:21:30.514Z (5 months ago)
- Language: JavaScript
- Size: 116 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# automatic-language-detection-redirect.js
[My website](https://happyrogelio7.xyz), My website
[Discord](https://discord.gg/3EebYUyeUX), Support My Server Discord
[Kaory Studios](https://kaorystudios.xyz), Support Kaoty Studios
[Kaory Studios Discord](https://discord.gg/Gw7m8kC), Support Kaoty Studios
## Using:
```html```
```javascript
//automatic-language-detection-redirect.js//original code: https://gist.github.com/fv0/f8acf201faee95cf02e9365dcd0d46a0
// Set of supported languages
var supportedLanguages = { en: "en", en: "en-US", es: "es", es: "es-ES", es: "es-MX", es: "es-CL", jp: "jp", fr: "fr", de: "de", it: "it", pt: "pt", ru: "ru", zh: "zh", tr: "tr" };
var fallbackLanguage = "en";// Check if the users browser language is a supported language of the website. Otherwise go to fallback.
var language = supportedLanguages[(navigator.language || navigator.userLanguage).substring(0,2)] || fallbackLanguage;// Go to the language version of your website. Example: https://domain.com/en/
// Place the "." by your web domain, since the point is to test it in a local file
location.replace("." + "/" + language + "/" + "index.html");
```
---
## Special Thanks To

[Visual Studio Code](https://code.visualstudio.com/), Code editing. Redefined. Free. Built on open source. Runs everywhere