程序员最近都爱上了这个网站  程序员们快来瞅瞅吧!  it98k网:it98k.com

本站消息

站长简介/公众号

  出租广告位,需要合作请联系站长

+关注
已关注

分类  

暂无分类

标签  

暂无标签

日期归档  

暂无数据

Change placeholder character in Laravel Translations System

发布于2023-01-19 16:49     阅读(610)     评论(0)     点赞(19)     收藏(5)


I would like to change the Laravel placeholder char in Language System but I don't know if I can do that. Right now, in Laravel 5.1, when you want to add a placeholder in a language file you must do it like this:

return [
  'comment_anonymous_or_login' => 'Hi! My name is :name how are you?'
]

I would like to have something like this:

return [
  'comment_anonymous_or_login' => 'Hi! My name is {!name!} how are you?'
]

Is it possible?


解决方案


As far as I know, Laravel does not support natively changing the placeholder character through settings.

However you could override the framework's class (Illuminate\Translation\Translator) and modify the function.



所属网站分类: 技术文章 > 问答

作者:黑洞官方问答小能手

链接:http://www.phpheidong.com/blog/article/476830/7a8378e4f772a048374f/

来源:php黑洞网

任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任

19 0
收藏该文
已收藏

评论内容:(最多支持255个字符)