Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[5.x]: Translations issue when disabling commerce plugin

オープン
#20,051 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
php
領域
backend

調査の方向性

Start by reading how Craft configures Yii's translation categories and how the Utilities page loads messages when a plugin is disabled. The issue gives a reproduction and a custom module workaround, but does not name the relevant files or a test. Done means Utilities loads without the 'commerce' message source error when Commerce is disabled.

索引モデルが issue の本文から書いたものです。

説明

bug repo:cms
What happened?
Description

Hello,

I don't know if this is a Craft issue or a Commerce issue, but if you disable Commerce without uninstalling it, you are hit with a translations issue when browsing to Utilities.

Unable to locate message source for category 'commerce'.

Obviously commerce leaves behind commerce related translations that Craft is unable to resolve if the plugin is disabled. However, I was able to fix this, by adding some code into a custom module/plugin.

use yii\i18n\PhpMessageSource;
if (!Craft::$app->getPlugins()->isPluginEnabled('commerce')) {
      if (!isset(Craft::$app->getI18n()->translations['commerce'])) {
        Craft::$app->getI18n()->translations['commerce'] = [
          'class' => PhpMessageSource::class,
          'basePath' => '@app/translations', 
          'forceTranslation' => true,
        ];
      }
}

Should a base 'commerce' translation be initialised in base Craft to cover for this, if commerce is disabled?

Craft CMS version

Craft Pro 5.11.5.1

PHP version

8.5

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions
主要言語
PHP
スター
3.6k
フォーク
708
平均マージ
11時間 23分
マージ済み PR(30日)
278

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

craftcms/cms のほかの issue

craftcms/cms の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。