Closed goraxan closed 1 year ago
I can confirm that everything works as expected if the $this->initDbMessages();
(https://github.com/MutationDigitale/craft3-translate/blob/master/src/Translate.php#L69) is wrapped like this
if(Craft::$app->getPlugins()->isPluginEnabled('translations-admin'))
$this->initDbMessages();
Good catch, thank you! It's fixed in version 3.0.3.
This error happens if during the Craft install process (while executing the
craft install/craft
command) one plugin tries to read localized content. That is the case with SEOMatic, which is installed before craft3-translate, at this particular moment https://github.com/nystudio107/craft-seomatic/blob/v4/src/migrations/Install.php#L49C30-L49C30 which eventually tries to read the localized site name https://github.com/nystudio107/craft-seomatic/blob/v4/src/models/MetaSiteVars.php#L144 This error is thrown:My guess is that the
DbMessageSource
is intercepting theyii\BaseYii::t
calls before the plugin is installed (if I remove this line https://github.com/MutationDigitale/craft3-translate/blob/master/src/Translate.php#L69 the Craft installation finishes fine). Maybe theDbMessageSource
should be initialized only after the plugin is fully enabled by using the https://docs.craftcms.com/api/v4/craft-services-plugins.html#method-ispluginenabled method?