gpt4 book ai didi

Laravel 有条件本地化

转载 作者:行者123 更新时间:2023-12-02 20:29:01 26 4
gpt4 key购买 nike

我们能否为 transLang 方法提供除复数形式之外的条件,以便它检查区域设置和条件以提供所需的翻译

For Example: We have some translations in English for Organisation 1. And different translations in English for Organisation 2. Now according to user login for organisation, the translations should be shown. Remember the locale is same.

最佳答案

为什么不选择这样的东西:

@lang("organistation.$organisationId.text")

在 resources/lang/en/organization.php 中:

<?php 
return [
'first_organization_id' => [
'text' => 'This text belongs to first organisation!',
'text2' => 'Other text belongs to first organisation!'
],
'second_organization_id' => [
'text' => 'This text belongs to second organisation!',
'text2' => 'Other text belongs to second organisation!'
]
];

等等

关于Laravel 有条件本地化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49299199/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com