首页 文章

翻译插件到前端

提问于
浏览
0

我正在制作一个插件(背面的一部分和前端的另一部分) .

我想将我的lang.php文件(在plugins / me / myplugin / lang / en / lang.php中)用于我的组件(我添加'Use Lang'),如https://octobercms.com/docs/plugin/localization#file-structure .

我怎样才能在这个lang文件中使用前端的字段(在后端,一切正常)(我试试,即Lang :: get('me.myplugin::lang.myfield.name'),如https://octobercms.com/docs/plugin/localization#accessing-strings,trans('me.myplugin::lang.myfield.name'),但没有 .

谢谢

1 回答

  • 0

    你能否澄清一下这个问题 . 我假设你的Lang文件基本上只是返回一个关联数组 . 在这种情况下,你可以像普通的php数组一样访问它 .

    如果我错了,你可能想看看这些https://octobercms.com/docs/services/helpers#method-trans

相关问题