How to change LOCALE language on Lumen

故事扮演 提交于 2019-12-25 03:42:37

问题


I saw this question, but it don't answers me.

I have set APP_LOCALE=fr in the .env file, but I still get date in english format :

string 'Thursday, 09h00' (length=15)

And I would like to get :

string 'Jeudi, 09h00' (length=12)

How to change from english to french on Lumen Framework ?

(Added PHP tag to be more seen)


回答1:


In lumen you cannot set the locale in your config. You can however change the locale in code by using app('translator')->setLocale($locale);.

In my own projects I set the default locale by adding app('translator')->setLocale('fr'); in the /bootstrap/app.php file before the line return $app;.



来源:https://stackoverflow.com/questions/32630039/how-to-change-locale-language-on-lumen

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!