Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First judge is always used regardless of preferred language set in browser #59

Closed
gpazout opened this issue Jul 4, 2024 · 3 comments
Closed

Comments

@gpazout
Copy link

gpazout commented Jul 4, 2024

No matter what I do the extension always picks the first judge, no matter the preferred language set in the browser. Because of this, the extension redirects to the Chinese page even though users do not have Chinese in their preferred languages!

I have the following languages on my website:

  • German (Default)
  • English
  • Chinese
  • Russian

For testing, I have the following preferred languages set in my browser (Chrome) in the following order (1 being the top priority)

  1. Russian
  2. German

The configuration of the verdicts and judges looks like this:

# TABLE: sys_language
#
# | uid | title     | flag | language_isocode |
# ---------------------------------------------
# |  1  | English   | en   | en               |
# |  2  | Chinese   | cn   | zh               |
# |  3  | Russisch  | ru   | ru               |
# |  4  | Arabisch  | sa   | ar               |
# |  5  | Deutsch   | de   | de               |


# verdicts
config.tx_locate {
    sessionHandling = 1
    overrideSessionValue = 1

    verdicts {
        # Redirect the user to the default language version of the current page
        redirectToPageEN = Leuchtfeuer\Locate\Verdict\Redirect
        redirectToPageEN {
            sys_language = 1
        }

        redirectToPageDE = Leuchtfeuer\Locate\Verdict\Redirect
        redirectToPageDE {
            sys_language = 5
        }

        redirectToPageCN = Leuchtfeuer\Locate\Verdict\Redirect
        redirectToPageCN {
            sys_language = 2
        }

        redirectToPageRU = Leuchtfeuer\Locate\Verdict\Redirect
        redirectToPageRU {
            sys_language = 3
        }

        redirectToPageDEFAULT = Leuchtfeuer\Locate\Verdict\Redirect
        redirectToPageDEFAULT {
            sys_language = 0
        }
    }
}
# judges
config.tx_locate.judges {    

    # chinese
    30 = Leuchtfeuer\Locate\Judge\Condition
    30 {
        verdict = redirectToPageCN
        fact = browserAcceptLanguage
        prosecution = cn
    }

    # russian
    40 = Leuchtfeuer\Locate\Judge\Condition
    40 {
        verdict = redirectToPageRU
        fact = browserAcceptLanguage
        prosecution = ru
    }

    # german
    100 = Leuchtfeuer\Locate\Judge\Condition
    100 {
        verdict = redirectToPageDE
        fact = browserAcceptLanguage
        prosecution = de
    }

    # english
    300 = Leuchtfeuer\Locate\Judge\Condition
    300 {
        verdict = redirectToPageEN
        fact = browserAcceptLanguage
        prosecution = en
    }

    # default language
    999999 = Leuchtfeuer\Locate\Judge\Fixed
    999999.verdict = redirectToPageDEFAULT
}
@gpazout
Copy link
Author

gpazout commented Jul 4, 2024

It seems like the configuration of the "facts" was missing


#facts
config.tx_locate.facts {
    browserAcceptLanguage = Leuchtfeuer\Locate\FactProvider\BrowserAcceptedLanguage
    countryByIP = Leuchtfeuer\Locate\FactProvider\IP2Country
}

@LF-Grosser
Copy link

Configuration problem. /fixed

@LF-Grosser
Copy link

Closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants