Skip to content

fix(workspace): default content_language to the app locale, not 'en'#146

Open
dantaspaulo wants to merge 1 commit into
trypostit:mainfrom
dantaspaulo:fix/workspace-content-language-locale
Open

fix(workspace): default content_language to the app locale, not 'en'#146
dantaspaulo wants to merge 1 commit into
trypostit:mainfrom
dantaspaulo:fix/workspace-content-language-locale

Conversation

@dantaspaulo

Copy link
Copy Markdown

Problem

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.

Fix

Default to app()->getLocale():

'content_language' => data_get($data, 'content_language', app()->getLocale()),

Since getLocale() is never null, array_filter keeps the key and a new
workspace inherits the user's current language. An explicit content_language
still wins.

Tests

CreateWorkspaceTest — a workspace with no content_language inherits the app
locale (pt-BR), and an explicit value (es) is kept over the locale.

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.
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

Successfully merging this pull request may close these issues.

1 participant