0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

HumHubでコア(モジュールでない)メッセージの翻訳

Last updated at Posted at 2020-02-01

HumHub1.3.20で確認してます。

HumHubではconfig/messages/<language>/<Module_ID>.<messagefile>.phpにファイルを置くことで翻訳のオーバライドが可能です。
ただprotected/humhub/moduls以下のモジュールに限る。
Translations - Administration Topics - HumHub - Documentation

モジュールに属しないprotected/humhub/messages/ja/base.phpにあるメッセージにおかしな翻訳があったので、config/messages/ja/base.phpに修正版をおいたのですが反映されませんでした。
バージョンアップのことを考えるとprotected/humhub配下を直接修正するのは避けたいですよね。

結論

構成ファイルに次を追記で想定通りの方法でオーバライド可能です。

protected/config/common.php
return [
    'components' => [
        'i18n' => [
            'translations' => [
                'base' => [
                    'class' => 'humhub\components\i18n\MessageSource',
                ],
            ],
        ],
    ],
]

デフォルトでhumhub\components\i18n\MessageSourceでも問題なさそうなんですけど、そうしない理由があったりするのかな。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?