samedi 1 avril 2017

Does laravel not detect request locale automatically?

I am learning laravel 5.4 locale chapter. When I write code to test, I get a question. For example, I have two language directories in my resources/lang directory:

/resources
    /lang
        /en
            messages.php
        /zh-CN
            messages.php

I set default locale is zh-CN, fallback locale is en. When I set Accept-Language to zh-CN, I can get translation string in zh-CN. But when I set Accept-Language to en, I still get string in zh-CN. So laravel does not detect request locale automatically? And If my application want to show english to those Accept-Language is en, and show chinese to those Accept-Language is zh-CN, I need to do it manually, is that correct? I though laravel will detect request locale automatically.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire