Komments plugins without labels

I am using the Komments plugin for comments and it works on my production environment (as you can see here) but it shows no text labels on my development environment (which is the same server, just another folder with newer changes):


As I did already quite some changes in the development build and didn’t see when this happened I am lost how to find out the root cause. How can I find out what the problem might be?

Ping @mauricehh!

Unfortunately I was not able to help, as I cannot reproduce this issue and wasn’t able to get Pelekes installation working locally.

Did you try to run the starterkit with the komments plugin as described in my mail @Peleke ?

Or does someone else maybe have the same issue?

What do the form fields look like if you open them in dev tools?

On a side note: It helps when you are asking questions about plugins if you always accompany it with a link to it. Thanks.

Just like none existing labels. The development environment can be accessed by replacing “www” with "dev.

Have you overwritten the kommentform.php snippet? If so, please post it here.

No, I only have added site/snippets/komments/type/reply.php like this

<li class="single-komment komment-type-<?php echo strtolower($komment['kommenttype']); ?> <?php echo ($komment['verified'] == 'true') ? 'verified' : ''?>" id="komment_<?php echo $komment['id']; ?>">
    <div class="author-avatar text-center">
        <a href="<?php echo $komment['authorurl']; ?>" rel="nofollow" target="_blank">
            <img src="<?php echo $komment['avatar']; ?>" alt="<?php echo $komment['author']; ?>">
        </a>
        </br>  
        <span><?php echo option('mauricerenck.komments.komment-icon-reply'); ?></span>
    </div>
    <div class="author-action">
        <?php if ($komment['verified'] == 'true') : ?><span class="verified-badge"><?php echo option('mauricerenck.komments.komment-icon-verified', '✅'); ?></span><?php endif; ?>
        <a href="<?php echo $komment['authorurl']; ?>" rel="nofollow" target="_blank"><?php echo $komment['author']; ?></a>&nbsp;
        <span class="replyHandleDisplay"></span>
        <!--<?php echo t('mauricerenck.komments.replied'); ?>-->
    </div>
    <div class="mention-content">
        <?php if ($komment['quote']->quote()->isNotEmpty()): ?>
            <div class="quote"><p class="prose"><?php echo $komment['quote']->quote()->html(); ?></p></div>
        <?php endif; ?>
        <?php if ($komment['komment']->komment()->isNotEmpty()): ?>
            <div class="komment-text prose">
                
                <?php echo $komment['komment']->komment()->kirbytext(); ?>
            </div>
        <?php endif; ?>
        <a href="#kommentform" class="kommentReply <?php echo option('mauricerenck.komments.replyClassNames'); ?>" data-id="<?php echo $komment['id']; ?>" data-handle="<?php echo $komment['author']; ?>"><span class="date float-left text-gray-500 font-light"><?php echo "(" . $komment['published']->published()->toDate('%d.%m.%Y %H:%M') . ")"; ?></span><?php echo "↩️ " . t('mauricerenck.komments.action.reply.text'); ?></a>
    </div>
</li>

There are no other files in that directory or the directory above it.

You can see our discussion here: Labels not visible with 1.7.0 · Issue #45 · mauricerenck/komments · GitHub

Could the empty german 'translations' => [], be a problem?

I don’t think so, but the translations are definitely the problem. They are for some reason ignored.

I renamed the language files and filled also the German translations but it didn’t solve the problem

What you can as a workaround for the moment is to copy the translations from the plugin into your language files.

If I get round to it, I’ll test with a multilang starterkit tonight (or maybe @mauricehh can), then we know if that works or whether it’s a problem in your installation which seems quite likely given that it works in production. Have you added any new plugins that might interfere?

1 Like

I just tried this again (multilang starterkit) and it works with my local setup with kirby 3.6.5, plugin version 1.8.1 and php 7.4 or 8.0.0.

I also use the same kirby settings on my live page, where it also works. Also before publishing changes I run several tests, which includes monkey testing in a sandbox installation.
That’s why I am bit out of ideas.

The language keys I chose are very specific, so that they shouldn’t be overwritten by other plugins, 'mauricerenck.komments.form.label.email' for example.

I think the major difference here is the php version, as I can currently not go higher than 8.0.0

I have changed PHP from 8.1 to 8.0 and back without a difference.
By copying & pasting the translation strings from the translation.php of the plugin to the de.php & en.php files all the labels are visible again so it seems definitely to be a translation problem.
My production environment is still on Kirby 3.6.3 and Komments 1.6.0 while the development environment is on Kirby 3.6.5 and Komments 1.8.1.

Is there anything wrong here?

de.php

<?php

return [
    'code' => 'de',
    'default' => true,
    'direction' => 'ltr',
    'locale' => [
        'LC_ALL' => 'de_DE'
    ],
    'name' => 'Deutsch',
    'translations' => [
        'Search' => 'Suche…',
        'searchresults' => 'Suchergebnisse',
        'Follow' => 'Folgen',
        'by' => 'Von',
        'publishedat' => 'veröffentlicht am',
        'readmore' => 'Mehr lesen…',
        'nextpost' => 'Nächster Beitrag',
        'previouspost' => 'Vorheriger Beitrag',
        'aboutme' => 'Über mich',
        'aboutmeinfo' => 'Mein Name ist Frederik Niedernolte, ich bin 36 Jahre jung und stamme aus Detmold in NRW. Ich bin Medien- und Wirtschaftspsychologe (tätig als Service Manager User Research), ausgebildeter Fachinformatiker und Hobbyfotograf.',
        'moreaboutme' => 'Mehr über mich',
        'featured' => 'Hervorgehobene Beiträge',
        'latest' => 'Neuste Beiträge',
        'similar' => 'Ähnliche Beiträge',
        'Comments' => 'Kommentare',
        'Comment' => 'Jetzt kommentieren ⬇️',
        'mauricerenck.komments.liked' => 'hat ein like spendiert',
        'mauricerenck.komments.replied' => 'antwortete',
        'mauricerenck.komments.repost' => 'teilte diesen Beitrag',
        'mauricerenck.komments.mentioned' => 'erwähnte diesen Beitrag',
        'mauricerenck.komments.moderation' => 'Dein Kommentar wartet auf Freischaltung.',
        'mauricerenck.komments.disabled' => 'Die Kommentarfunktion wurde auf dieser Seite deaktiviert.',
        'mauricerenck.komments.externalReply' => 'Woanders antworten',
        'mauricerenck.komments.form.submit' => 'Abschicken',
        'mauricerenck.komments.form.privacy' => 'Die eingegebene E-Mail-Adresse wird vor dem Speichern unwiderruflich verschlüsselt und dient nur zur Darstellung des Avatars. Mit dem Absenden stimmst du zu, dass die eingegebenen Daten gespeichert und in Form eines Kommentars dargestellt werden dürfen.',
        'mauricerenck.komments.form.label.comment' => 'Kommentar',
        'mauricerenck.komments.form.label.email' => 'E-Mail',
        'mauricerenck.komments.form.label.name' => 'Name',
        'mauricerenck.komments.form.label.website' => 'Website',
        'mauricerenck.komments.headline.likes' => 'Likes',
        'mauricerenck.komments.headline.reposts' => 'Geteilt',
        'mauricerenck.komments.headline.mentions' => 'Erwähnungen',
        'mauricerenck.komments.headline.replies' => 'Antworten',
        'mauricerenck.komments.action.reply.text' => 'antworten',
        'mauricerenck.komments.pagenotfound' => 'Die kommentierte Seite wurde nicht gefunden',
        'mauricerenck.komments.error' => 'Fehler',
        'mauricerenck.komments.lookslikespam' => 'Dein Kommentar wurde als Spam eingestuft und abgelehnt.',
        'mauricerenck.komments.invalidfieldvalues' => 'Falsche Eingabewerte',
        'mauricerenck.komments.thankyou' => 'Danke. Dein Kommentar wartet auf seine Freischaltung.',
    ],
    'url' => NULL
];

en.php

<?php

return [
    'code' => 'en',
    'default' => false,
    'direction' => 'ltr',
    'locale' => [
        'LC_ALL' => 'en_US'
    ],
    'name' => 'English',
    'translations' => [
        'Search' => 'Search…',
        'searchresults' => 'Search results',
        'Follow' => 'Follow',
        'by' => 'By',
        'publishedat' => 'published at',
        'readmore' => 'Read more…',
        'nextpost' => 'Next post',
        'previouspost' => 'Previous post',
        'aboutme' => 'About me',
        'aboutmeinfo' => 'My name is Frederik Niedernolte, I am 36 years young and come from Detmold in NRW. I am a media and business psychologist (working as Service Manager User Research), trained IT specialist and hobby photographer.',
        'moreaboutme' => 'More about me',
        'featured' => 'Featured posts',
        'latest' => 'Latest posts',
        'similar' => 'Similar posts',
        'Comments' => 'Comments',
        'Comment' => 'Comment now ⬇️',
        'mauricerenck.komments.liked' => 'spent a like',
        'mauricerenck.komments.replied' => 'replied',
        'mauricerenck.komments.mentioned' => 'mentioned this page',
        'mauricerenck.komments.repost' => 'shared this page',
        'mauricerenck.komments.moderation' => 'Your comment is awaiting moderation.',
        'mauricerenck.komments.disabled' => 'Comments were disabled on this page.',
        'mauricerenck.komments.externalReply' => 'Answer elsewhere',
        'mauricerenck.komments.form.submit' => 'send',
        'mauricerenck.komments.form.privacy' => 'Your E-Mail address will be encrypted before saving the comment. It will only be used to display a gravatar. By submitting your data, you agree that all entered data may be saved and displayed as a comment.',
        'mauricerenck.komments.form.label.comment' => 'Comment',
        'mauricerenck.komments.form.label.email' => 'E-mail',
        'mauricerenck.komments.form.label.name' => 'Name',
        'mauricerenck.komments.form.label.website' => 'Website',
        'mauricerenck.komments.headline.likes' => 'Likes',
        'mauricerenck.komments.headline.reposts' => 'Shares',
        'mauricerenck.komments.headline.mentions' => 'Mentions',
        'mauricerenck.komments.headline.replies' => 'Replies',
        'mauricerenck.komments.action.reply.text' => 'reply',
        'mauricerenck.komments.pagenotfound' => 'The page you wrote a comment for could not be found.',
        'mauricerenck.komments.error' => 'Error',
        'mauricerenck.komments.lookslikespam' => 'Your comment was rejected because it looks like spam.',
        'mauricerenck.komments.invalidfieldvalues' => 'Invalid field values',
        'mauricerenck.komments.thankyou' => 'Thank you! Your comment is awaiting moderation.',
    ],
    'url' => NULL
];

Ok, I just tested with a fresh Starterkit with two languages enabled and the latest version of the Komments plugin and translation strings are shown without any issues.

I’d suggest that you also test with a fresh Starterkit in your environment, so that we can rule out any issues with PHP, server etc.

If that works without issues (as I would expect), then you would have to disable your plugins and re-add them one by one to find the culprit.