11
This commit is contained in:
@@ -34,7 +34,18 @@ class LogisticsShipController extends Crud
|
||||
*/
|
||||
public function index(): Response
|
||||
{
|
||||
return view('logistics-ship/index');
|
||||
$lang = session('lang', 'zh-cn');
|
||||
$translations = (array)require __DIR__ . '/../lang/' . $lang . '/ship.php';
|
||||
var_dump($translations);
|
||||
$common = (array)require __DIR__ . '/../lang/' . $lang . '/common.php';
|
||||
$translations = array_merge($common, $translations); // 确保 common.php 的翻译优先
|
||||
|
||||
// 合并翻译,确保语言文件中的翻译优先
|
||||
// $translations = array_merge($required_translations, $translations);
|
||||
return view('logistics-ship/index', [
|
||||
'lang' => $lang,
|
||||
'translations' => $translations
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,10 +70,21 @@ class LogisticsShipController extends Crud
|
||||
*/
|
||||
public function update(Request $request): Response
|
||||
{
|
||||
$id = $request->input('id');
|
||||
$lang = session('lang', 'zh-cn');
|
||||
$translations = (array)require __DIR__ . '/../lang/' . $lang . '/ship.php';
|
||||
$common = (array)require __DIR__ . '/../lang/' . $lang . '/common.php';
|
||||
$translations = array_merge($translations, $common);
|
||||
|
||||
if ($request->method() === 'POST') {
|
||||
return parent::update($request);
|
||||
}
|
||||
return view('logistics-ship/update');
|
||||
return view('logistics-ship/update', [
|
||||
'id' => $id,
|
||||
// 'data' => $data,
|
||||
'lang' => $lang,
|
||||
'translations' => $translations
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user