fix(workspace): default content_language to the app locale, not 'en'#146
Open
dantaspaulo wants to merge 1 commit into
Open
fix(workspace): default content_language to the app locale, not 'en'#146dantaspaulo wants to merge 1 commit into
dantaspaulo wants to merge 1 commit into
Conversation
When a workspace is created without an explicit content_language, `data_get($data, 'content_language')` returns null, array_filter drops the key, and the column falls back to its DB default of 'en'. So AI content and notifications came out in English even when the app was running in another locale. Default to `app()->getLocale()` instead, so a new workspace inherits the user's current language. An explicit content_language still wins.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a workspace is created without an explicit
content_language,data_get($data, 'content_language')returnsnull,array_filterdrops thekey, and the column falls back to its DB default of
'en'. So AI content andnotifications came out in English even when the app was running in another
locale.
Fix
Default to
app()->getLocale():Since
getLocale()is never null,array_filterkeeps the key and a newworkspace inherits the user's current language. An explicit
content_languagestill wins.
Tests
CreateWorkspaceTest— a workspace with nocontent_languageinherits the applocale (
pt-BR), and an explicit value (es) is kept over the locale.