Giter Site home page Giter Site logo

jako / langrouter Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 4.0 6.05 MB

Language context router for use with Babel in MODX Revolution

Home Page: https://jako.github.io/LangRouter/

License: GNU General Public License v2.0

PHP 94.77% JavaScript 5.23%
modx-revolution modx modx-extra i18n multilingual multilingual-websites

langrouter's Introduction

LangRouter

Language context router for use with Babel.

Features

LangRouter is a language routing plugin for MODx Revolution that is meant to be used with Babel. It takes care of switching contexts that hold the translations, depending on the URL requested by the client.

LangRouter is an installable and extended version of https://gist.github.com/gadamiak/3812853. Thanks to gadamiak for the permission to use his code.

Installation

MODX Package Management

Usage

Install via package manager and prepare the contexts according to the documentation.

Documentation

For more information please read the documentation.

License

The project is licensed under the GPLv2 license.

Translations

Translations of the package can be made for the Default Lexicon

langrouter's People

Contributors

dependabot[bot] avatar enigmatic-user avatar jako avatar jenswittmann avatar zaigham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

langrouter's Issues

500 error in IE for root URI

Hi,

I hope you can help.

In IE, when I go to http://mydomain.com I get a 500 error. This is a 2 language site that works fine in other browsers.

I turned debug on, and this is what's displayed> Note where I loaded IE and where I loaded Chrome. Thanks in advance.


------------------------------------------
LOADED IE (WHICH FAILS)
------------------------------------------


[2016-10-06 06:50:34] (ERROR in LangRouter @ /home/villa/public_html/XXXXXXXXXXX.com/core/components/langrouter/model/langrouter/langrouter.class.php : 147) Unhandled request:
REQUEST_URI:   /
REDIRECT_URI:  
QUERY_STRING:  
q:             
Context:       web
Site start:    1
[2016-10-06 06:50:34] (ERROR in LangRouter @ /home/villa/public_html/XXXXXXXXXXX.com/core/components/langrouter/model/langrouter/langrouter.class.php : 164) contextmap: array(2) {
  ["en"]=>
  string(3) "web"
  ["fr"]=>
  string(2) "fr"
}

[2016-10-06 06:50:34] (ERROR in LangRouter @ /home/villa/public_html/XXXXXXXXXXX.com/core/components/langrouter/model/langrouter/langrouter.class.php : 164) Default culture key: string(3) "web"

[2016-10-06 06:50:34] (ERROR @ /home/villa/public_html/XXXXXXXXXXX.com/core/model/modx/modx.class.php : 2310) No valid context specified: 
[2016-10-06 06:50:34] (ERROR in LangRouter @ /home/villa/public_html/XXXXXXXXXXX.com/core/components/langrouter/model/langrouter/langrouter.class.php : 147) Culture key not found in URI:
REQUEST_URI:   /
REDIRECT_URI:  
QUERY_STRING:  
q:             
Context:       - none -
Site start:    1
[2016-10-06 06:50:34] (ERROR in LangRouter @ /home/villa/public_html/XXXXXXXXXXX.com/core/components/langrouter/model/langrouter/langrouter.class.php : 176) Context switch was not valid.
[2016-10-06 06:50:34] (ERROR in LangRouter @ /home/villa/public_html/XXXXXXXXXXX.com/core/components/langrouter/model/langrouter/langrouter.class.php : 176) Query is empty.

------------------------------------------
LOADED CHROME AT THIS POINT (WHICH WORKS)
------------------------------------------


[2016-10-06 06:54:47] (ERROR in LangRouter @ /home/villa/public_html/XXXXXXXXXXX.com/core/components/langrouter/model/langrouter/langrouter.class.php : 147) Unhandled request:
REQUEST_URI:   /
REDIRECT_URI:  
QUERY_STRING:  
q:             
Context:       web
Site start:    1
[2016-10-06 06:54:47] (ERROR in LangRouter @ /home/villa/public_html/XXXXXXXXXXX.com/core/components/langrouter/model/langrouter/langrouter.class.php : 164) contextmap: array(2) {
  ["en"]=>
  string(3) "web"
  ["fr"]=>
  string(2) "fr"
}

[2016-10-06 06:54:47] (ERROR in LangRouter @ /home/villa/public_html/XXXXXXXXXXX.com/core/components/langrouter/model/langrouter/langrouter.class.php : 164) Detected culture key: string(2) "en"

[2016-10-06 06:54:47] (ERROR in LangRouter @ /home/villa/public_html/XXXXXXXXXXX.com/core/components/langrouter/model/langrouter/langrouter.class.php : 147) Culture key not found in URI:
REQUEST_URI:   /
REDIRECT_URI:  
QUERY_STRING:  
q:             
Context:       web
Site start:    1
[2016-10-06 06:54:47] (ERROR in LangRouter @ /home/villa/public_html/XXXXXXXXXXX.com/core/components/langrouter/model/langrouter/langrouter.class.php : 176) Context switch was not valid.
[2016-10-06 06:54:47] (ERROR in LangRouter @ /home/villa/public_html/XXXXXXXXXXX.com/core/components/langrouter/model/langrouter/langrouter.class.php : 176) Query is empty.


routing problem to homepages

Setup

Modx 2.72, Babel 3.0.0 and LangRouter 1.3.3

Problem

I've setup a multilang website with babel and langrouter, i followed the installation guide. but when i go to the doman i will get redirected to domain.local/de instead of domain.local/de/ . so the last slash is missing and i get a 404 page instead of the start page (thats a correct behaviour because rhe resource de is not existing). With a rightclick view in the manager i get the same result when i show the homepage of each context, all other resources get redirected correct.

After i've moved the site from windows to a mac i was not able to reproduce the error. Then i moved it to a debian webserver and it was still working. Moving it to another Windows machine brings up the error again. i think that is a windows problem. i've got another site with modx 2.65, Babel and Langrouter 1.3.0 and this works without any problems on Windows. Dunno if it's modx 2.72 or Langrouter who causes that error.

Debug Log when entering domain.local/en/

[2020-02-13 19:10:59] (ERROR in LangRouter @ website\src\web\core\components\langrouter\model\langrouter\langrouter.class.php : 158) Unhandled request: REQUEST_URI: /en REDIRECT_URI: QUERY_STRING: q=en q: en Context: de Site start: 9 [2020-02-13 19:10:59] (ERROR in LangRouter @ website\src\web\core\components\langrouter\model\langrouter\langrouter.class.php : 175) contextmap: array(2) { ["de"]=> string(2) "de" ["en"]=> string(2) "en" } [2020-02-13 19:10:59] (ERROR in LangRouter @ website\src\web\core\components\langrouter\model\langrouter\langrouter.class.php : 158) Culture key found in URI: REQUEST_URI: /en REDIRECT_URI: QUERY_STRING: q=en q: en Context: en Site start: 1

Error log

First than all, excellent extra Jako, thank you very much!
There is an error in the error log, any ideas how to solve it?
thanks!

[2020-01-10 18:05:39] (ERROR @ /home/user/public_html/core/components/langrouter/model/langrouter/langrouter.class.php : 230) PHP warning: array_flip(): Can only flip STRING and INTEGER values!

Error log shows warning: Use of undefined constant with php 7.3.11

Modx 3.01, modxCloud, LangRouter langrouter-1.4.0-pl, php 7.3.11

[2022-06-30 10:24:27] (ERROR @ .../www/core/components/langrouter/src/Plugins/Events/OnHandleRequest.php : 16) PHP warning: Use of undefined constant MODX_API_MODE - assumed 'MODX_API_MODE' (this will throw an Error in a future version of PHP)

Errors using LangRouter

I have installed latest version of LangRouter 1.1.3-pl on MODX 2.5.2 with Babel 3.0.0-rc1.

I am using two contexts: web and english (en as context key). When switching to view my site with English agent I notice that the tag is not showing the en cultureKey. The language still remains default.

My code in the template is:

<base href="[[!++site_url]]">

In the system settings the option for logging is turned on. In the error log I do notice this error:

`[2016-12-06 16:02:35] (ERROR in LangRouter @ /home/deb75895n2/domains/codeplaza.com/public_html/ontwikkel/core/components/langrouter/model/langrouter/langrouter.class.php : 148) Unhandled request:
REQUEST_URI: /portfolio/
REDIRECT_URI:
QUERY_STRING: q=portfolio/
q: portfolio/
Context: web
Site start: 1
[2016-12-06 16:02:35] (ERROR in LangRouter @ /home/deb75895n2/domains/codeplaza.com/public_html/ontwikkel/core/components/langrouter/model/langrouter/langrouter.class.php : 165) contextmap: array(0) {
}

[2016-12-06 16:02:35] (ERROR in LangRouter @ /home/deb75895n2/domains/codeplaza.com/public_html/ontwikkel/core/components/langrouter/model/langrouter/langrouter.class.php : 165) Default context key: string(3) "web"

[2016-12-06 16:02:35] (ERROR in LangRouter @ /home/deb75895n2/domains/codeplaza.com/public_html/ontwikkel/core/components/langrouter/model/langrouter/langrouter.class.php : 148) Culture key not found in URI:
REQUEST_URI: /portfolio/
REDIRECT_URI:
QUERY_STRING: q=portfolio/
q: portfolio/
Context: web
Site start: 1
[2016-12-06 16:02:35] (ERROR in LangRouter @ /home/deb75895n2/domains/codeplaza.com/public_html/ontwikkel/core/components/langrouter/model/langrouter/langrouter.class.php : 177) Context switch to "web" was not valid.`

What could be wrong?

get a 500 error with deeper structure

i've installed like written in the manual.
everything seemed to work fine until i made a deeper structure in the resourcetree.

i.e.
mydomain.com/de/page1.html
mydomain.com/en/page1.html
both work fine, also i get redirecred to the right context when i go to my web context
mydomain.com/ redirects me to mydomain.com/de/ like exepted.

but when i make
mydomain.com/en/subfolder/page1.html
i get a 500 error after a while because the php has a timeout.

My Context Settings look like this:
grafik

My Nginx rewrite looks like this:
location @modx { rewrite ^/(.*)$ /index.php?q=$1&$args; }

System:
Modx 2.5.7-pl, Babel 3.0.0-pl, LangRouter 1.2.0-pl
PHP 7.1.4
nginx 1.13.0
MariaDB

Possibility for Language Aliases

How can we make it possible to put alias to existing Languages?

I have existing Russian language context, which is being served at site/ru/, but I want to serve Ukraine with Russian language too, but dont want to duplicate the whole context. I just need a way to server site/ru/ as site/ua/.

This way I only need to maintain single context (ru) for both countries.

Possible duplicated content.

Hello mate.
It's possible to access to the main context via / and /cultureKey/ creating two different addresses to get to the same point.

domain.com/ and domain.com/en/
or
domain.com/page-four.html and domain.com/en/page-four.html
will open the same page without changing the address.

I think (unless I'm wrong) that is duplicated content and might be penalised by SEO rules.
should be redirected via 301 to one or the other all the time.

Cheers.

Enhancement: Disable langrouter on certain contexts

It would be fantastic to have a system setting where you could list contexts that are not part of the routing. This would allow for a separate regular context.

At the moment I've added a context check to the top of the plugin which exits early.

Compatibility with debugParser

When using LangRouter, I am unable to use debugParser unless I set the LangRouter plugin priority to 1.

Not sure if its a bug, or some race condition.

index of non-default language

Hello,

I'm on modx 2.5.4
babel 3.0.0
and langRouter 1.2.0

I have 2 contexts: web and en. They both seem to work fine and babel is doing it's thing.
But if I visit the homepage of my non-default language (by using 'view' in the manager) the url becomes /en/index. If I then manually change my url to /en/ it shows a 404. Is there a way to make that /index disappear?

Many thanks

Errors in Modx error log

(Modx cloud Modx 3.01) php 7.3 - langrouter-1.4.0-pl

[2022-05-17 13:13:01] (ERROR @ /paas/c0xxx/www/core/components/langrouter/src/Plugins/Events/OnHandleRequest.php : 16) PHP warning: Use of undefined constant MODX_API_MODE - assumed 'MODX_API_MODE' (this will throw an Error in a future version of PHP)

[Q] PHP Fatal Error on L74 setlocale

I am occasionally getting php fatal error on this line:

setlocale(LC_ALL, $this->modx->context->getOption('locale', $locale));

I am unable to reproduce it with normal browsing etc. But it seems when some kind of bot hits the site, this error appears.

Any ideas why it would happen?

Error details:

Call to a member function getOption() on a non-object in /*/core/components/langrouter/model/langrouter/events/langrouteronhandlerequest.class.php on line 74" while reading response header from upstream, client: ***, server: www.site, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "www.site", referrer: "www.site"

Redirector and LangRouter

If I am setting up a redirector as following:

Pattern: contactus.php
Target: contact-us.html
Context: en-us

It gives me 404+503 error.


If I do the following:

Pattern: en-us/contactus.php
Target: `contact-us.html`
Context: en-us

It works.

Redirector fires on OnPageNotFound so I think LangRouter has already taken the control of the request by then.

Can you give some clues on how to make it work? ๐Ÿ˜„

How to make this work?

I've changed the plugin code to

return include MODX_CORE_PATH . 'components/langrouter/elements/plugins/langrouter.plugin.php';

just to catch error's line, and this is my FATAL error in front-end:

Fatal error: Call to a member function getOption() on a non-object in D:\localhost\modx-revo-babel\2.3\core\components\langrouter\elements\plugins\langrouter.plugin.php on line 141

And this log in error log:

[2015-02-14 00:49:46] (ERROR @ /modx-revo-babel/2.3/index.php) Could not prepare context: en

I've read the readme, and I've set these as well:

  • base_url : /
  • site_url : http://localhost/modx-revo-babel/2.3/en/

I used MODX's original .htaccess, with this common adjustment for my localhost:

RewriteEngine On
RewriteBase /modx-revo-babel/2.3/

other than that stayed intact.

So, how to make this work?

modx not in webroot

Greetings!

I would like to know how to configure LangRouter if MODX is installed to a subfolder on the webserver (for example: /modx/ ) ? I tried setting the context url settings (set base_url to /modx/) and also to modify RewriteBase to /modx2/ in .htaccess but it doesn't work. What can I do in this case? Thank you!

Wrong redirect on Samsung-Browser

Hello @Jako ,
i detect a wrong redirect on Samsung-Browser. The Browser sends the correct Languages with $_SERVER['HTTP_ACCEPT_LANGUAGE'], but the result is flip before use. I send a pull request for my change, now it works. Can you tell me why the array is fliped?

site_status issues

Hi, I hope you can help me out.

MODX Revo 2.5
Babel 3.0.0-rc1
LangRouter 1.0.6-pl

site_status is set to No, in default System Settings and also context settings for both 'en' and 'fr' contexts.

Visitors to http://domain.com/ are still seeing the english front page! (tested on other computers).
Visitors to http://domain.com/en are getting the Site unavailable message.
Visitors to http://domain.com/en/ (notice the slash) are seeing the english front page.

Same for fr (but with french front page as expected)

How? Why?

I have to workaround this by creating a snippet that checks the SCRIPT_URI so both http://domain.com/ and http://domain.com/en/ redirect to http://domain.com/en

Any ideas how this can be fixed without the snippet?

Thanks!

issue with pdoPage snippet of pdoTools component

Hello!
I have two: contexts: web(english) and de(german).

I have an issue with langRouter + pdoPage. It works correctly with web context until I haven't german language in the settings of my browser, but when I add it, the langRouter returns an empty result.
Could you help me resolve this issue?

MODx: 3.0.1-pl
langRouter: 1.4.2

English version located on url: http://localhost:8081/en/
German version located on url: http://localhost:8081/de/

my context settings:
base_url: /
cultureKey: en and de in the de context
url_scheme: https://
site_url: {url_scheme}{http_host}{base_url}{cultureKey}/

here is the langRouter log:
[2023-04-26 18:09:41] (ERROR @ /www/core/components/langrouter/src/LangRouter.php : 164) PHP warning: Undefined array key "REDIRECT_URI"
[2023-04-26 18:09:41] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 169) Unhandled request:
REQUEST_URI: /en/profile/
REDIRECT_URI:
QUERY_STRING: q=en/profile/
q: en/profile/
Context: web
Site start: 1
[2023-04-26 18:09:41] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 186) contextmap: array(2) {
["en"]=>
string(3) "web"
["de"]=>
string(2) "de"
}

[2023-04-26 18:09:41] (ERROR @ /www/core/components/langrouter/src/LangRouter.php : 164) PHP warning: Undefined array key "REDIRECT_URI"
[2023-04-26 18:09:41] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 169) Culture key found in URI:
REQUEST_URI: /profile/
REDIRECT_URI:
QUERY_STRING: q=en/profile/
q: profile/
Context: web
Site start: 1
[2023-04-26 18:09:43] (ERROR @ /www/core/components/langrouter/src/LangRouter.php : 164) PHP warning: Undefined array key "REDIRECT_URI"
[2023-04-26 18:09:43] (ERROR @ /www/core/components/langrouter/src/LangRouter.php : 166) PHP warning: Undefined array key "q"
[2023-04-26 18:09:43] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 169) Unhandled request:
REQUEST_URI: /assets/components/pdotools/connector.php
REDIRECT_URI:
QUERY_STRING:
q:
Context: web
Site start: 1
[2023-04-26 18:09:43] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 186) contextmap: array(2) {
["en"]=>
string(3) "web"
["de"]=>
string(2) "de"
}

[2023-04-26 18:09:43] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 186) Detected culture key: string(2) "de"

[2023-04-26 18:09:43] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 186) Detected context key: string(2) "de"

[2023-04-26 18:09:43] (ERROR @ /www/core/components/langrouter/src/LangRouter.php : 164) PHP warning: Undefined array key "REDIRECT_URI"
[2023-04-26 18:09:43] (ERROR @ /www/core/components/langrouter/src/LangRouter.php : 164) PHP warning: Undefined array key "REDIRECT_URI"[2023-04-26 18:09:43] (ERROR @ /www/core/components/langrouter/src/LangRouter.php : 166) PHP warning: Undefined array key "q"

[2023-04-26 18:09:43] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 169) Culture key not found in URI:
REQUEST_URI: /assets/components/pdotools/connector.php
REDIRECT_URI:
QUERY_STRING:
q:
Context: de
Site start: 114
[2023-04-26 18:09:43] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 198) Redirect to http://localhost:8081/de/?pdotreat3=1&pageId=6&hash=b5edf689092779b36e96e2bdc4b3cbc95f1be8e0
[2023-04-26 18:09:43] (ERROR @ /www/core/components/langrouter/src/LangRouter.php : 164) PHP warning: Undefined array key "REDIRECT_URI"
[2023-04-26 18:09:43] (ERROR @ /www/core/components/langrouter/src/LangRouter.php : 166) PHP warning: Undefined array key "q"
[2023-04-26 18:09:43] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 169) Unhandled request:
REQUEST_URI: /assets/components/pdotools/connector.php
REDIRECT_URI:
QUERY_STRING:
q:
Context: web
Site start: 1
[2023-04-26 18:09:43] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 186) contextmap: array(2) {
["en"]=>
string(3) "web"
["de"]=>
string(2) "de"
}

[2023-04-26 18:09:43] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 186) Detected culture key: string(2) "de"

[2023-04-26 18:09:43] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 186) Detected context key: string(2) "de"

[2023-04-26 18:09:43] (ERROR @ /www/core/components/langrouter/src/LangRouter.php : 166) PHP warning: Undefined array key "q"
[2023-04-26 18:09:43] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 169) Unhandled request:
REQUEST_URI: /assets/components/pdotools/connector.php
REDIRECT_URI:
QUERY_STRING:
q:
Context: web
Site start: 1
[2023-04-26 18:09:43] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 186) contextmap: array(2) {
["en"]=>
string(3) "web"
["de"]=>
string(2) "de"
}

[2023-04-26 18:09:43] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 186) Detected culture key: string(2) "de"

[2023-04-26 18:09:43] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 186) Detected context key: string(2) "de"

[2023-04-26 18:09:43] (ERROR @ /www/core/components/langrouter/src/LangRouter.php : 164) PHP warning: Undefined array key "REDIRECT_URI"
[2023-04-26 18:09:43] (ERROR @ /www/core/components/langrouter/src/LangRouter.php : 166) PHP warning: Undefined array key "q"
[2023-04-26 18:09:43] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 169) Culture key not found in URI:
REQUEST_URI: /assets/components/pdotools/connector.php
REDIRECT_URI:
QUERY_STRING:
q:
Context: de
Site start: 114
[2023-04-26 18:09:43] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 198) Redirect to http://localhost:8081/de/?pdouser=1&pageId=6&hash=0f7a4ea631e722615e70cfd727eef12ae0193c54
[2023-04-26 18:09:43] (ERROR @ /www/core/components/langrouter/src/LangRouter.php : 164) PHP warning: Undefined array key "REDIRECT_URI"
[2023-04-26 18:09:43] (ERROR @ /www/core/components/langrouter/src/LangRouter.php : 166) PHP warning: Undefined array key "q"
[2023-04-26 18:09:43] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 169) Culture key not found in URI:
REQUEST_URI: /assets/components/pdotools/connector.php
REDIRECT_URI:
QUERY_STRING:
q:
Context: de
Site start: 114
[2023-04-26 18:09:43] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 198) Redirect to http://localhost:8081/de/?pdotreat1=1&pageId=6&hash=6b61654128b5084c489de49dcf1c40c4881ba6af
[2023-04-26 18:09:44] (ERROR @ /www/core/components/langrouter/src/LangRouter.php : 164) PHP warning: Undefined array key "REDIRECT_URI"
[2023-04-26 18:09:44] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 169) Unhandled request:
REQUEST_URI: /de/?pdouser=1&pageId=6&hash=0f7a4ea631e722615e70cfd727eef12ae0193c54
REDIRECT_URI:
QUERY_STRING: q=de/&amp;pdouser=1&amp;pageId=6&amp;hash=0f7a4ea631e722615e70cfd727eef12ae0193c54
q: de/
Context: web
Site start: 1
[2023-04-26 18:09:44] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 186) contextmap: array(2) {
["en"]=>
string(3) "web"
["de"]=>
string(2) "de"
}

[2023-04-26 18:09:44] (ERROR @ /www/core/components/langrouter/src/LangRouter.php : 164) PHP warning: Undefined array key "REDIRECT_URI"
[2023-04-26 18:09:44] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 169) Unhandled request:
REQUEST_URI: /de/?pdotreat3=1&pageId=6&hash=b5edf689092779b36e96e2bdc4b3cbc95f1be8e0
REDIRECT_URI:
QUERY_STRING: q=de/&amp;pdotreat3=1&amp;pageId=6&amp;hash=b5edf689092779b36e96e2bdc4b3cbc95f1be8e0
q: de/
Context: web
Site start: 1
[2023-04-26 18:09:44] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 186) contextmap: array(2) {
["en"]=>
string(3) "web"
["de"]=>
string(2) "de"
}

[2023-04-26 18:09:44] (ERROR @ /www/core/components/langrouter/src/LangRouter.php : 164) PHP warning: Undefined array key "REDIRECT_URI"
[2023-04-26 18:09:44] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 169) Culture key found in URI:
REQUEST_URI: /?pdotreat3=1&pageId=6&hash=b5edf689092779b36e96e2bdc4b3cbc95f1be8e0
REDIRECT_URI:
QUERY_STRING: q=de/&amp;pdotreat3=1&amp;pageId=6&amp;hash=b5edf689092779b36e96e2bdc4b3cbc95f1be8e0
q:
Context: de
Site start: 114
[2023-04-26 18:09:44] (ERROR @ /www/core/components/langrouter/src/LangRouter.php : 164) PHP warning: Undefined array key "REDIRECT_URI"
[2023-04-26 18:09:44] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 169) Culture key found in URI:
REQUEST_URI: /?pdouser=1&pageId=6&hash=0f7a4ea631e722615e70cfd727eef12ae0193c54
REDIRECT_URI:
QUERY_STRING: q=de/&amp;pdouser=1&amp;pageId=6&amp;hash=0f7a4ea631e722615e70cfd727eef12ae0193c54
q:
Context: de
Site start: 114
[2023-04-26 18:09:44] (ERROR @ /www/core/src/Revolution/modParser.php : 509) Could not find snippet with name !++site_start.
[2023-04-26 18:09:44] (ERROR @ /www/core/src/Revolution/modParser.php : 509) Could not find snippet with name !++site_start.
[2023-04-26 18:09:44] (ERROR @ /www/core/components/langrouter/src/LangRouter.php : 164) PHP warning: Undefined array key "REDIRECT_URI"
[2023-04-26 18:09:44] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 169) Unhandled request:
REQUEST_URI: /de/?pdotreat1=1&pageId=6&hash=6b61654128b5084c489de49dcf1c40c4881ba6af
REDIRECT_URI:
QUERY_STRING: q=de/&amp;pdotreat1=1&amp;pageId=6&amp;hash=6b61654128b5084c489de49dcf1c40c4881ba6af
q: de/
Context: web
Site start: 1
[2023-04-26 18:09:44] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 186) contextmap: array(2) {
["en"]=>
string(3) "web"
["de"]=>
string(2) "de"
}

[2023-04-26 18:09:44] (ERROR @ /www/core/components/langrouter/src/LangRouter.php : 164) PHP warning: Undefined array key "REDIRECT_URI"
[2023-04-26 18:09:44] (ERROR in LangRouter @ /www/core/components/langrouter/src/LangRouter.php : 169) Culture key found in URI:
REQUEST_URI: /?pdotreat1=1&pageId=6&hash=6b61654128b5084c489de49dcf1c40c4881ba6af
REDIRECT_URI:
QUERY_STRING: q=de/&amp;pdotreat1=1&amp;pageId=6&amp;hash=6b61654128b5084c489de49dcf1c40c4881ba6af
q:
Context: de
Site start: 114
`

Feature Request: Save last loaded cultureKey in a cookie

Currently LangRouter detects the browser language and routes the user to the most appropriate context. This is great but would be even better if it could set a cookie (perhaps a system setting option to enable) and remember the last selected language.
If there was no language selected then it falls back to detecting browser language.

My reasoning for this is that in Hong Kong for example many people use English browsers but would prefer to read a website's content in Chinese. This means that every time they return to the site they need to select the preferred language again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.