我已将 Laravel 8 应用程序升级到版本 9,根据文档:升级指南,该resources/lang目录现在位于根项目目录 ( lang) 中。
我已将该lang目录移至项目的根目录,但似乎不起作用。
// config/app.php
'locale' => 'pt-BR',
Run Code Online (Sandbox Code Playgroud)
和
// lang/pt-BR/messages.php
return [
'welcome' => 'Welcome to the app!',
];
Run Code Online (Sandbox Code Playgroud)
控制器
return response()->json([
'message' => Lang::get('messages.welcome') // it returns "messages.welcome"
]);
Run Code Online (Sandbox Code Playgroud)
但是当我将lang目录更改回 时/resources/lang,它可以像以前的 laravel 版本一样正常工作。所以我创建了一个新的 Laravel 9 项目,它工作了,这让我认为需要一些额外的配置,但它没有记录在升级指南中。我的composer.json依赖项与新的 laravel 项目完全相同。Laravel 是否需要进行任何额外配置才能识别该目录?
我的 VueJS 应用程序中有一个可组合文件:
// simple example of a composable that fetch some information from API and shows that information
// in a table in two components at the sime time
export function useDatatable () {
const table = ref({
headers: [...],
items: [],
someValue: ''
})
async function getDocuments () {
const { data } = await $axios.get('/documents')
table.value.items = data
}
return {
table,
getDocuments
}
}
Run Code Online (Sandbox Code Playgroud)
然后我有多个组件同时使用这个可组合项:
<template>
<div>
<document-table /> // composable is used here
<document-billing-dialog /> …Run Code Online (Sandbox Code Playgroud)