phpvms
phpvms copied to clipboard
Basic Multilanguage Support
Added Basic Multilanguage support. Not quite sure how to handle custom pages yet.
To change a the language add ?lang=<<name of folder in /resources/lang>>
adresses issue #740
Hmm I'd rather have the user select the language in their profile and save it in the database, not have it in the nav bar
Yeah that scan in the template won't work, that'll prevent caching of the template and will be very slow. Instead, add a migration to create a new column in the user table called "locale", and then have it in the user profile. Then the middleware can check if the user is logged in and set it that way, otherwise it can fallback with the one the admin has set
I understand. Ok I can do that. But what about users that have no account? or aren't logged in?
Do you think changing the pathing would be better? For example adding a controller to fetch the language from the url. For example .../de/dashboard or /en/dashboard ?
I don't want to change the endpoints. For not signed in/no account, it'll just default to the way it is now - where the admin sets the language statically
Ok totally understand that. I was just wondering because the person i am maintaining the website for told me the website has to support multiple languages as told at https://www.ivao.aero/db/airline/intro.asp . I was told the website has to provide that feature. Because he really wants this system to be used on his ivao registration. But I see its not really shown when these websites have to be translated 🤷♂️
Ok and you probably dont want to use packages like https://github.com/ARCANEDEV/Localization ?
Right, it can be done with just some middleware and something on the user table. I haven't looked at that package to see what it can provide but I don't want the routes to be localized.
Ok I'm going to try to come up with a new commit for a multilanguage support with your thoughts. I might be able to create a nwidart/laravel-modules module to create the wished functionality. I am going to close this request and come up with another.
No problem. I don't think you need a new module. It's just simply a new database column in the users table, the profile field to fill out and then middleware to read the user and set the language
And thank you! Message me on discord if you need help