BookStackApp / BookStack

A platform to create documentation/wiki content built with PHP & Laravel
https://www.bookstackapp.com/
MIT License
14.67k stars 1.85k forks source link

Adjust preferred Language by Roles #4672

Closed DarkZoneSD closed 9 months ago

DarkZoneSD commented 9 months ago

Describe the feature you'd like

To have the option of configuring a preferred language for a certain Role. I have attatched a mockup version of the UI implementation in the Roles configuration. Mockup

Describe the benefits this would bring to existing BookStack users

This could be very handy when implementing BookStack into an existing Active-Directory Environment for example, to migrate mass ammounts of users into a AD-Group, that can be synchronised via LDAP or similar. Having an AD-Group like "BookStack_Lang_CZ" setting the preferred lagnuage to czech would be an example.

Can the goal of this request already be achieved via other means?

By manually adding the users and selecting the preferred language, otherwise I am not aware of different solutions.

Have you searched for an existing open/closed issue?

How long have you been using BookStack?

3 months to 1 year

Additional context

No response

ssddanbrown commented 9 months ago

Thanks for the suggestion @DarkZoneSD. Personally I'm not too keen on adding options unless there's significant proven need, especially here where it could by a bit awkward since it's a user preference applied at role level, where roles can often be changed and multiple applied.

If you have any development capabilities, this is something that could likely be built onto BookStack using our logical theme system if desired. You could hook into login/registration events and update the language based on available data.

Alternatively, if you just want to bulk update with the users that are already in BookStack, the user language can be updated via the API.

DarkZoneSD commented 9 months ago

If you have any development capabilities, this is something that could likely be built onto BookStack using our logical theme system if desired. You could hook into login/registration events and update the language based on available data.

Thank you for the quick reply @ssddanbrown .

That sounds doable, I'll look into it and post it if i find a proper solution to this. Alternatively, is something like a DeepL API integration into BookStacks main Branch something that would be worth considering?

ssddanbrown commented 9 months ago

Alternatively, is something like a DeepL API integration into BookStacks main Branch something that would be worth considering?

That's not something I'd consider to be honest. I try to avoid any kind of specific platform support/integration in BookStack, especially where that platform/service is not open. When (If) we include specific content multi-language support then I may consider some level of abstract API to support different external translation platforms (Defaulting to an open option) but that's some way off.

Otherwise, you could create such integration already yourself if desired via our REST API and/or theme systems: https://www.bookstackapp.com/docs/admin/hacking-bookstack/

DarkZoneSD commented 9 months ago

I missed something in the documentation saying

For users that are not logged-in BookStack will try to detect their language based off of information sent from their browser. If you’d prefer to force the language seen to be the APP_LANG setting you can set the following in your .env file:

--
APP_AUTO_LANG_PUBLIC=false

Is it possible to enable the APP_AUTO_LANG_PUBLIC entry to be used for every user as the default instead and then let them configure their preferred Language in the Profile settings if desired?

ssddanbrown commented 9 months ago

That's not an option built-in or supported right now, and it's a bit awkward to implement since we can't be sure that interaction with the user will be via browser (Email notification triggered by another user's action for example), so ideally we'd have their language preference set. You could technically track their last used matching browser language to consider as a suggestion, but then that's an extra system and value to juggle alongside the existing preference, so probably not worth it.

Is again something that could be hacked in via the logical theme system with some development hackery.