Yoast/duplicate-post

Some strings are not translated, despite language file for the code is at 100% (i18n bug?)

Closed this issue · 4 comments

After trying to apply Japanese language files, I found that some strings are not translated, or rather, looks like not i18n'd?

In the block editor:

スクリーンショット 2021-08-27 10 38 14

スクリーンショット 2021-08-27 10 38 23

スクリーンショット 2021-08-27 10 39 02

In the setting screen:

スクリーンショット 2021-08-27 10 47 03

スクリーンショット 2021-08-27 10 47 28


Japanese translation file has incomplete readme, but the code is at 100%. https://translate.wordpress.org/locale/ja/default/wp-plugins/duplicate-post/

I first encountered the issue on Human Made's Altis platform. I then checked on a fresh WordPress install on non-Altis local environment, able to reproduce.

For the block editor part, I quote Altis support:

The plugin replaces some text using the function wp.i18n.setLocaleData( { 'Publish': [ 'Republish' ] } ) - this might be overriding the string for all locales.

There are two issues at play here.

1. In the block editor
The reason for this is that the strings have not been added to Glotpress. When running wp i18n make-pot duplicate-post the strings are added to the POT file. This might be an issue on WordPress.org.

A temporary work around would be creating your own translation file.

2. In the setting screen
The reason that these translations are not working is that the code wants to use the WordPress translations for these strings but these strings have been changed or removed from WordPress and that is they not working anymore. With the introduction of Glotpress all translations are added to global library so translating these strings for the plugin should not be extra work.

'duplicate_post_copytitle' => [
'tab' => 'what-to-copy',
'fieldset' => 'elements-to-copy',
'type' => 'checkbox',
'label' => \__( 'Title', 'default' ),
'value' => 1,
],
'duplicate_post_copydate' => [
'tab' => 'what-to-copy',
'fieldset' => 'elements-to-copy',
'type' => 'checkbox',
'label' => \__( 'Date', 'default' ),
'value' => 1,
],
'duplicate_post_copystatus' => [
'tab' => 'what-to-copy',
'fieldset' => 'elements-to-copy',
'type' => 'checkbox',
'label' => \__( 'Status', 'default' ),
'value' => 1,
],
'duplicate_post_copyslug' => [
'tab' => 'what-to-copy',
'fieldset' => 'elements-to-copy',
'type' => 'checkbox',
'label' => \__( 'Slug', 'default' ),
'value' => 1,
],
'duplicate_post_copyexcerpt' => [
'tab' => 'what-to-copy',
'fieldset' => 'elements-to-copy',
'type' => 'checkbox',
'label' => \__( 'Excerpt', 'default' ),
'value' => 1,
],
'duplicate_post_copycontent' => [
'tab' => 'what-to-copy',
'fieldset' => 'elements-to-copy',
'type' => 'checkbox',
'label' => \__( 'Content', 'default' ),
'value' => 1,
],
'duplicate_post_copythumbnail' => [
'tab' => 'what-to-copy',
'fieldset' => 'elements-to-copy',
'type' => 'checkbox',
'label' => \__( 'Featured Image', 'default' ),
'value' => 1,
],
'duplicate_post_copytemplate' => [
'tab' => 'what-to-copy',
'fieldset' => 'elements-to-copy',
'type' => 'checkbox',
'label' => \__( 'Template', 'default' ),
'value' => 1,
],
'duplicate_post_copyformat' => [
'tab' => 'what-to-copy',
'fieldset' => 'elements-to-copy',
'type' => 'checkbox',
'label' => \__( 'Post format', 'default' ),
'value' => 1,
],
'duplicate_post_copyauthor' => [
'tab' => 'what-to-copy',
'fieldset' => 'elements-to-copy',
'type' => 'checkbox',
'label' => \__( 'Author', 'default' ),
'value' => 1,
],
'duplicate_post_copypassword' => [
'tab' => 'what-to-copy',
'fieldset' => 'elements-to-copy',
'type' => 'checkbox',
'label' => \__( 'Password', 'default' ),
'value' => 1,
],
'duplicate_post_copyattachments' => [
'tab' => 'what-to-copy',
'fieldset' => 'elements-to-copy',
'type' => 'checkbox',
'label' => \__( 'Attachments', 'default' ),
'value' => 1,
'description' => \__( 'you probably want this unchecked, unless you have very special requirements', 'duplicate-post' ),
],
'duplicate_post_copychildren' => [
'tab' => 'what-to-copy',
'fieldset' => 'elements-to-copy',
'type' => 'checkbox',
'label' => \__( 'Children', 'default' ),
'value' => 1,
],
'duplicate_post_copycomments' => [
'tab' => 'what-to-copy',
'fieldset' => 'elements-to-copy',
'type' => 'checkbox',
'label' => \__( 'Comments', 'default' ),
'value' => 1,
'description' => \__( 'except pingbacks and trackbacks', 'duplicate-post' ),
],
'duplicate_post_copymenuorder' => [
'tab' => 'what-to-copy',
'fieldset' => 'elements-to-copy',
'type' => 'checkbox',
'label' => \__( 'Menu order', 'default' ),
'value' => 1,
],

'label' => \__( 'Bulk Actions', 'default' ),

A PR could be opened to change these to the plugin text domain.

I have created a meta ticket regarding the strings not being extracted from the JS file

@waviaei There was an issue with the importing of the strings. You can now translate the remaining untranslated strings.

The default text domain would still need to be fixed.

The default text domain is also fixed #207