Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Support for Multitenancy #8

Open
danielbehrendt opened this issue Nov 3, 2023 · 4 comments
Open

Feature: Support for Multitenancy #8

danielbehrendt opened this issue Nov 3, 2023 · 4 comments

Comments

@danielbehrendt
Copy link

It would be great if this package could support multitenancy (i. e. https://github.com/spatie/laravel-multitenancy). Basically it would be enough to put custom translations in a tenant-specifiy folder like:

/resources/lang-custom/1/ (for tenant with ID 1)

I already tried implementing it but had no chance a chained translation is always initialized before tenancy. Maybe anyone has a suggestion how this could be done.

@sten
Copy link
Contributor

sten commented Nov 17, 2023

@danielbehrendt PRs are welcome! But we do not have a use case for this at the moment, so we will not pursue this ourselves.

Maybe you can already get away with most of your translation issues, by creating a translation file per tenant. And then use @lang("messages-tenant-{$tenantId}.title") or something like that.

@danielbehrendt
Copy link
Author

@sten thank you for the reply. I already tried tweaking the required config values by as task in my tenant package but it seems your package is doing all the related stuff in register already so there's no chance (yet) to make adjustments in advance.

@danielbehrendt
Copy link
Author

danielbehrendt commented Nov 17, 2023

@sten this is what i already tried:

$customLangDirectoryName  = config('laravel-chained-translator.custom_lang_directory_name');
$customLangDirectoryName .= sprintf('/%06u', app('currentTenant')->id);

config()->set('laravel-chained-translator.custom_lang_directory_name', $customLangDirectoryName);

but as i already mentioned i haven't found a way to do this BEFORE the register method of the TranslationServiceProvider gets executed.

@danielbehrendt
Copy link
Author

danielbehrendt commented Nov 18, 2023

my problem is also related to Filament (though i use the Spatie multi-tenancy package there) but how do you like the handle the new multi-tenancy feature of Filament?

https://github.com/statikbe/laravel-filament-chained-translation-manager

like mentioned above it would be enough to have a chance to set the custom_lang_directory_name from outside of your packge BEFORE the registration happens. i already tried tweaking the load order of the service providers but it doesn't change anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants