[PR #4555] [MERGED] Language cleanup #6373

Closed
opened 2026-02-05 10:30:37 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/BookStackApp/BookStack/pull/4555
Author: @ssddanbrown
Created: 9/17/2023
Status: Merged
Merged: 9/18/2023
Merged by: @ssddanbrown

Base: developmentHead: language_cleanup


📝 Commits (4)

  • ac9a659 Locales: Performed cleanup and alignment of locale handling
  • 8994c1b Locales: More use of locale objects, Addressed failing tests
  • b42e8cd Locales: Fixed errors occuring for PHP < 8.2
  • 78bf11c Locales: Removed a lot of existing locale handling

📊 Changes

23 files changed (+281 additions, -265 deletions)

View changed files

📝 app/Access/Notifications/UserInviteNotification.php (+6 -6)
📝 app/Activity/Notifications/Messages/BaseActivityNotification.php (+4 -3)
📝 app/Activity/Notifications/Messages/CommentCreationNotification.php (+9 -9)
📝 app/Activity/Notifications/Messages/PageCreationNotification.php (+8 -8)
📝 app/Activity/Notifications/Messages/PageUpdateNotification.php (+9 -9)
📝 app/App/MailNotification.php (+3 -2)
📝 app/Config/app.php (+3 -6)
📝 app/Entities/Tools/ExportFormatter.php (+19 -20)
📝 app/Http/Middleware/Localization.php (+9 -22)
app/Translation/LanguageManager.php (+0 -148)
app/Translation/LocaleDefinition.php (+53 -0)
app/Translation/LocaleManager.php (+119 -0)
📝 app/Users/Models/User.php (+5 -4)
📝 resources/views/layouts/base.blade.php (+2 -2)
📝 resources/views/layouts/export.blade.php (+1 -1)
📝 resources/views/layouts/plain.blade.php (+2 -2)
📝 resources/views/pages/parts/markdown-editor.blade.php (+1 -1)
📝 resources/views/pages/parts/wysiwyg-editor.blade.php (+2 -2)
📝 resources/views/users/create.blade.php (+1 -1)
📝 resources/views/users/edit.blade.php (+11 -6)

...and 3 more files

📄 Description

For https://github.com/BookStackApp/BookStack/issues/4501

Todo

  • As per discovery in #3825, we likely don't need the complex handling of locales & their variants any-more.

From carbon docs:

You also may know formatLocalized() method from Carbon 1. This method still works the same in Carbon 2 but you should better use isoFormat() instead.

->isoFormat(string $format): string use ISO format rather than PHP-specific format and use inner translations rather than language packages you need to install on every machine where you deploy your application

So think we'd just need to align with Carbon's expected locale format. Needs testing in all locations where datetime locales are used. Probably don't need to set PHP level locale now.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/BookStackApp/BookStack/pull/4555 **Author:** [@ssddanbrown](https://github.com/ssddanbrown) **Created:** 9/17/2023 **Status:** ✅ Merged **Merged:** 9/18/2023 **Merged by:** [@ssddanbrown](https://github.com/ssddanbrown) **Base:** `development` ← **Head:** `language_cleanup` --- ### 📝 Commits (4) - [`ac9a659`](https://github.com/BookStackApp/BookStack/commit/ac9a65945f6c9eb917b4449ad7d83b4402b4cea7) Locales: Performed cleanup and alignment of locale handling - [`8994c1b`](https://github.com/BookStackApp/BookStack/commit/8994c1b9d9dca616c74cdcdb17cc4722203e3299) Locales: More use of locale objects, Addressed failing tests - [`b42e8cd`](https://github.com/BookStackApp/BookStack/commit/b42e8cdb638c711a42d7d7df52238f92c537f2dc) Locales: Fixed errors occuring for PHP < 8.2 - [`78bf11c`](https://github.com/BookStackApp/BookStack/commit/78bf11cf653ea9a9268ccb013d444ff60fd375c5) Locales: Removed a lot of existing locale handling ### 📊 Changes **23 files changed** (+281 additions, -265 deletions) <details> <summary>View changed files</summary> 📝 `app/Access/Notifications/UserInviteNotification.php` (+6 -6) 📝 `app/Activity/Notifications/Messages/BaseActivityNotification.php` (+4 -3) 📝 `app/Activity/Notifications/Messages/CommentCreationNotification.php` (+9 -9) 📝 `app/Activity/Notifications/Messages/PageCreationNotification.php` (+8 -8) 📝 `app/Activity/Notifications/Messages/PageUpdateNotification.php` (+9 -9) 📝 `app/App/MailNotification.php` (+3 -2) 📝 `app/Config/app.php` (+3 -6) 📝 `app/Entities/Tools/ExportFormatter.php` (+19 -20) 📝 `app/Http/Middleware/Localization.php` (+9 -22) ➖ `app/Translation/LanguageManager.php` (+0 -148) ➕ `app/Translation/LocaleDefinition.php` (+53 -0) ➕ `app/Translation/LocaleManager.php` (+119 -0) 📝 `app/Users/Models/User.php` (+5 -4) 📝 `resources/views/layouts/base.blade.php` (+2 -2) 📝 `resources/views/layouts/export.blade.php` (+1 -1) 📝 `resources/views/layouts/plain.blade.php` (+2 -2) 📝 `resources/views/pages/parts/markdown-editor.blade.php` (+1 -1) 📝 `resources/views/pages/parts/wysiwyg-editor.blade.php` (+2 -2) 📝 `resources/views/users/create.blade.php` (+1 -1) 📝 `resources/views/users/edit.blade.php` (+11 -6) _...and 3 more files_ </details> ### 📄 Description For https://github.com/BookStackApp/BookStack/issues/4501 ### Todo - [x] As per discovery in #3825, we likely don't need the complex handling of locales & their variants any-more. From carbon docs: > You also may know formatLocalized() method from Carbon 1. This method still works the same in Carbon 2 but you should better use isoFormat() instead. > ->isoFormat(string $format): string use ISO format rather than PHP-specific format and use inner translations rather than language packages you need to install on every machine where you deploy your application So think we'd just need to align with Carbon's expected locale format. Needs testing in all locations where datetime locales are used. Probably don't need to set PHP level locale now. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 10:30:37 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#6373