如何在Blade标签模板中使用本地化? [英] How to use localization in Blade tag templates?

查看:59
本文介绍了如何在Blade标签模板中使用本地化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第一个问题:

我已经在许多类型的文本和事物中插入了本地化,但是我不知道如何以以下形式将其导入:

I've inserted the localization in many types of texts and things, but I don't know how to import it into in the following forms:

  {{ Form::label('name', 'here') }}
  {{ Form::text('name', null, array('placeholder' => 'here')) }}
  {{ Form::submit('here', array('class' => 'btn btn-success')) }}
  {{ Form::button('here', array('class' => 'btn btn-default')) }}

我希望它位于标签形式"here"中,并位于文本"here"的占位符中.

I want it to be in the form label 'here' and in the placeholder of the text 'here'.

第二个问题:

我不允许在我的语言文件中插入带有链接的文件:text here blah blah <a href="{{ URL::to('text') }}">BLAH</a>?

I am not allowed to insert it with links in my language file: text here blah blah <a href="{{ URL::to('text') }}">BLAH</a>?

反正有链接插入吗?

提前谢谢.

推荐答案

假设您的邮件存储在app/lang/en/message.php中,则可以对所有情况使用相同的方式:

Supposing that your messages are stored in app/lang/en/message.php you can use the same way for all your cases:

在Blade模板中:

{{ Form::label('name', Lang::get('message.key')) }}

{{ Form::text('name', null, array('placeholder' => Lang::get('message.key'))) }}

{{ Form::submit(Lang::get('message.key'), array('class' => 'btn btn-success')) }}

在带有一些Blade表达式的HTML标签中:

In HTML tag mixed with some Blade expression:

<a href="{{ URL::to(Lang::get('message.key')) }}">BLAH</a>

这篇关于如何在Blade标签模板中使用本地化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆