sebastiangreger / kirby3-commentions

A versatile comment system and integrated Webmention endpoint for Kirby 3.
MIT License
58 stars 7 forks source link

feedback.comment not displayed in correct language? #100

Closed getflourish closed 1 year ago

getflourish commented 3 years ago

While the majority of the plugin seems to show up correctly in German, the feedback after submitting a comment is always shown in English.

Could that be because those messages are triggered through a hook that is initialised before the language is detected? https://github.com/sebastiangreger/kirby3-commentions/blob/master/config/hooks.php

Using Kirby 3.5

<?php Kirby\Toolkit\I18n::$locale = 'de'; ?>
'feedback.comment.queued',
'feedback.comment.thankyou' 

=> Always English, even though the language is set to German.

💡Idea: Ideally, all those strings could be translated in the panel. For my case, I forked the plugin and pull some of the content from the panel :)

sebastiangreger commented 3 years ago

Yes, the string included in the hook appears to be the culprit here -- this is due to Kirby's known issue with single-language setups; I actually just yesterday added that to the Wishlist again.

Quickfix

Since Commentions allows to override any strings via your site's config.php, you should be able to change those strings to German by adding:

// in site/config/config.php
'sgkirby.commentions.t.en.feedback.comment.queued'           => 'Vielen Dank! Bitte etwas Geduld, Kommentare werden manuell freigeschaltet.',
'sgkirby.commentions.t.en.feedback.comment.thankyou'         => 'Vielen Dank für deinen Kommentar!',
'sgkirby.commentions.t.en.feedback.webmention.queued'        => 'Vielen Dank, deine Webmention wurde registriert! Bitte etwas Geduld, Kommentare werden manuell freigeschaltet.',

Hacky, but should solve the issue as a workaround.

To consider for us

  1. Ideally, this will be solved on core level in an upcoming version, in which case I'd simply add above hint to our Readme until fixed.
  2. Alternatively, it could be considered to move the logic from config/hooks.php into snippets/commentions-feedback.php; this would however be a breaking change, i.e. could only be introduced in a major version.