Default language is ignored for anyone who chose a language, when the language selector is hidden
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 77/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
調査の方向性
動作の原因としてissueで挙げられている Flarum\Http\Middleware\SetLocale から始め、セレクター設定の読み取り方とlocaleの選択方法を追ってください。middlewareのテストで、サインイン済みユーザーとゲストがカバーされているか確認してください。セレクターが非表示のときは設定されたデフォルトが適用され、表示されているときは保存済みの言語選択が引き続き機能すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Reported on discuss: https://discuss.flarum.org/d/40146
What happens
With Show language selector switched off, changing the forum's Default language in Basics has no effect for anyone who chose a language before, even after php flarum cache:clear. They keep seeing their earlier choice, and with the selector hidden they have no way to change it.
Steps to reproduce
- Install a second language pack (for example French) next to English.
- With the language selector shown, pick English from the selector.
- In Basics, switch Show language selector off and set Default language to French.
- Reload the forum: it is still in English.
The same happens to a guest who picked a language (via the locale cookie).
Cause
Flarum\Http\Middleware\SetLocale always applies the signed-in user's locale preference, or a guest's locale cookie, and never checks whether the language selector is shown:
if ($actor->exists) {
$locale = $actor->getPreference('locale');
} else {
$locale = Arr::get($request->getCookieParams(), 'locale');
}
Expected
When the selector is hidden, people can't choose a language, so the forum's default language should apply to everyone and saved choices should be ignored (but kept, so they come back if the selector is switched on again).
Seen on 2.0.2; the code is the same on 2.x.
- 主要言語
- PHP
- スター
- 6.8k
- フォーク
- 891
- 平均マージ
- 1日 10時間
- マージ済み PR(30日)
- 209
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
flarum/framework のほかの issue
-
type/accessibility type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
[2.x] False CLI/Web PHP mismatch when /usr/bin/php differs from the site's FPM対応中かも @lazerg が 15 日前に担当しました。 オープンtype/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
[2.x] A filter on a resource without a searcher returns a 500対応中かも @imorland が今日担当しました。 オープンtype/bug
flarum/framework#5578 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[2.x] Audit's discussion and user filters fail on PostgreSQL対応中かも @imorland が今日担当しました。 オープンtype/bug
flarum/framework#5577 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
flarum/framework の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 87/100
Sylius/Sylius#19359 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Add php 8.6オープン
難易度 1/5 1時間未満 初心者へのやさしさ 66/100
mailersend/mailersend-php#199 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Configuration new tool
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
novalo-dev/Prestashop-MCP-Server#366 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 10 日以内に返信