WP Show Post / Comment count / Translation
-
Hi Jan,
Can you share the translation plugin you’re using?
You can translate it with filters. See Tom’s example here – https://wpshowposts.com/support/topic/translation-3/#post-9809
And to expand further:
add_filter( 'gettext', 'wpsp_translate_text', 10, 2 ); function wpsp_translate_text( $text, $domain ) { if ( 'Leave a comment' === $text && 'wp-show-posts' == $domain ) { return 'Your translation for Leave a comment'; } if ( '1 Comment' === $text && 'wp-show-posts' == $domain ) { return 'your translation for 1 Comment'; } if ( '% Comments' === $text && 'wp-show-posts' == $domain ) { return 'your translation for # Comments'; } return $text; }Hi Leo,
thanks for getting back. I added a filter in the function.php as a temp. work around.
Re your question: I prefer not to use a translation plugin. Instead I usually translate po-files offline (App = PoEdit) and then use FTP upload to embed them into the child theme directory.
Meanwhile I downloaded the German translation file from the Translating WP site. Then I created a new subfolder called “wp-show-posts” in “wordpress/wp-content/themes/generatepress_child”. Is this where I dump the po- and mo-file in order for the translations to take effect?
Thanks,
JanSince this is a plugin, I believe you’ll need to add the file on the plugin’s folder instead. 😀
(create a /languages folder on wp-show-posts plugin folder.)
Hi Leo,
meanwhile, I created the suggested subfolder and dumped the DE-language files into it (see screenshot)
I also removed the filter (temp work around) from the function.php file.
The DE terms from the language file are still not being displayed on the respective page (see bottom of the screenshot).
What am I missing?
Thanks,
Jan-
This reply was modified 4 years, 6 months ago by
Jan.
Try putting it on
/wp-content/languages/plugins/folder instead.Let us know how it goes. 😀
Hi Elvin,
my initial reply obviously did not get through. So I’ll give it another try.
I did move the DE-language file into the suggested folder.
Unfortunately, the EN version of the comment-link text would still remain ;-/ (Caches have been cleared, following the saying of a wise man ;-).
Just to be sure I also checked…
(1) the function.php again for any filters that may overwrite the translation files –> nothing
(2) the website settings –> language = German
(3) the user settings –> language = German
(4) browser settings –> language GermanWhat am I missing?
Thanks,
JanI forgot to mention about the plugin’s header as well.
You’ll have to do this on the plugin’s wp-show-posts.php after you’ve added the /language folder.
Hi Elvin,
sorry for not getting back earlier.
Meanwhile I added the
Domain Path: /languagesstring to the wp-show-posts.php.I also checked the language folder. The path seems correct and the language files are stored inside also. See screenshot
The german translation still does not show up. See bottom of this page.
What am I missing?
Thanks,
Jan -
This reply was modified 4 years, 6 months ago by
The topic ‘WP Show Post / Comment count / Translation’ is closed to new replies.
(@locke85)
4 years, 7 months ago
Hi Elvin,
I’m struggling to get this “1 Comment” count translated into German.
Things that I checked already:
– Site language set to “German”
– User language setting = “German”
What else am I missing?
Any advice is much appreciated.
Best regards,
Jan
The page I need help with: [log in to see the link]