Comments (4)
You can set app locale through middleware
Where you can receive language through query, header, body, or sub domain etc
from joy-voyager-api.
@rxcod9
i have add changelanguage middleware and add to karnel
`<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class ChangeLanguage
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
app()->setLocale('ar');
if(isset($request -> lang) && $request -> lang == 'en')
app()->setLocale('en');
return $next($request);
}
}`
karnel
'changelang' => \App\Http\Middleware\ChangeLanguage::class,
where can add changelang Middleware now
sory i am new on laravel
from joy-voyager-api.
@gogo207
This should solve your problem
https://stackoverflow.com/questions/38039159/how-to-assign-middleware-to-routes-in-laravel-better-way/50926301
from joy-voyager-api.
@rxcod9
not working
The response is always returned in the default language and the response does not appear in the other language
http://adensoft-voyager.com/api/articals/1?lang=en
{
"data": {
"id": 1,
"title": "Title ar",
"long_text": "Long Text ar",
"created_at": "2021-11-05T10:27:00.000000Z",
"updated_at": "2021-11-05T10:27:00.000000Z",
"translations": [
{
"id": 45,
"table_name": "articals",
"column_name": "long_text",
"foreign_key": 1,
"locale": "en",
"value": "Long Text en",
"created_at": "2021-11-05T10:27:00.000000Z",
"updated_at": "2021-11-05T10:27:00.000000Z"
},
{
"id": 44,
"table_name": "articals",
"column_name": "title",
"foreign_key": 1,
"locale": "en",
"value": "Title en",
"created_at": "2021-11-05T10:27:00.000000Z",
"updated_at": "2021-11-05T10:27:00.000000Z"
}
]
},
"isModelTranslatable": true,
"isSoftDeleted": false
}
from joy-voyager-api.
Related Issues (7)
- Filter not working HOT 4
- resources folder are missing HOT 4
- auth guard [api] is not defined HOT 2
- After Installing Voyager then i try to install joy voyager but getting issues it's not installing .. Can you provide boilerplate code for a new project
- Call to undefined function Joy\\VoyagerApi\\Services\\safeCarbonParse()
- Dependency Dashboard
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from joy-voyager-api.