Giter VIP home page Giter VIP logo

Comments (9)

mikehaertl avatar mikehaertl commented on May 27, 2024

What is the default language configured in your browser? Also check the Yii logs for trace messages of the extension (YII_DEBUG must be true).

from yii2-localeurls.

yoyhosoft avatar yoyhosoft commented on May 27, 2024

"language configured in your browser" <-- my browser language setting is Thai (it's can change yii default language settings )?

and in app.log after clean and enter website again, it's not appear anything.

Thanks,

from yii2-localeurls.

mikehaertl avatar mikehaertl commented on May 27, 2024

Make sure, that YII_DEBUG is really enabled and that you use the latest version. You should see messages like:

Level Category Message
trace codemix\localeurls\UrlManager::processLocaleUrl Language code found in URL. Setting application language to 'de'.
trace codemix\localeurls\UrlManager::processLocaleUrl Persisting language 'de' in session.
trace codemix\localeurls\UrlManager::processLocaleUrl Persisting language 'de' in cookie.

Also make sure, that you check all previous requests. You should see redirect messages there

Level Category Message
trace codemix\localeurls\UrlManager::redirectToLanguage Redirecting to /de.

from yii2-localeurls.

yoyhosoft avatar yoyhosoft commented on May 27, 2024

8 12:05:28.466 trace yii\base\Application::bootstrap Bootstrap with yii\gii\Module::bootstrap()
9 12:05:28.467 trace codemix\localeurls\UrlManager::processLocaleUrl Language code found in URL. Setting application language to 'en-US'.

C:\xampp\htdocs\dusitthanicollege.local\vendor\codemix\yii2-localeurls\UrlManager.php (271)
C:\xampp\htdocs\dusitthanicollege.local\vendor\codemix\yii2-localeurls\UrlManager.php (165)

10 12:05:28.469 info yii\web\Session::open Session started

C:\xampp\htdocs\dusitthanicollege.local\vendor\codemix\yii2-localeurls\UrlManager.php (273)
C:\xampp\htdocs\dusitthanicollege.local\vendor\codemix\yii2-localeurls\UrlManager.php (165)

11 12:05:28.469 trace codemix\localeurls\UrlManager::processLocaleUrl Persisting language 'en-US' in session.

C:\xampp\htdocs\dusitthanicollege.local\vendor\codemix\yii2-localeurls\UrlManager.php (274)
C:\xampp\htdocs\dusitthanicollege.local\vendor\codemix\yii2-localeurls\UrlManager.php (165)

12 12:05:28.472 trace codemix\localeurls\UrlManager::processLocaleUrl Persisting language 'en-US' in cookie.

C:\xampp\htdocs\dusitthanicollege.local\vendor\codemix\yii2-localeurls\UrlManager.php (286)
C:\xampp\htdocs\dusitthanicollege.local\vendor\codemix\yii2-localeurls\UrlManager.php (165)

from yii2-localeurls.

mikehaertl avatar mikehaertl commented on May 27, 2024

This is not the first request, because there is obviously already a language code in the URL:

9 12:05:28.467 trace codemix\localeurls\UrlManager::processLocaleUrl Language code found in URL. Setting application language to 'en-US'.

You should check the previous request.

from yii2-localeurls.

yoyhosoft avatar yoyhosoft commented on May 27, 2024

Hi,
Before enter site I did as step below:

  • Clean browser cookie
  • Close all browser
  • remove Yii runtime/cache, runtime/HTML
  • Restart Apache
  • Open browser again, then open new browser in private mode and enter site.

Thanks

from yii2-localeurls.

mikehaertl avatar mikehaertl commented on May 27, 2024

Again: You need to check the log files for each and every request and try to understand what each message means. When you go to the / URL of your website, the extension will detect a language and then redirect. So a second request is made. You should read the log messages from the first request to /.

from yii2-localeurls.

yoyhosoft avatar yoyhosoft commented on May 27, 2024

Thanks, I will check and tell you again.

from yii2-localeurls.

yoyhosoft avatar yoyhosoft commented on May 27, 2024

Hi,
I found solution (by debug your code lol...), and solve by

        'enableLanguageDetection' => false,
        'enableDefaultLanguageUrlCode' => true,

Many Thanks for your support.

from yii2-localeurls.

Related Issues (20)

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.