Skip to content

Dont apply translators comments multiple times again #338

Open
@kkmuffme

Description

@kkmuffme

Bug Report

WP-CLI 2.7.0-alpha-9fcc59a

#154 is partially back (or maybe never fully fixed?)

// translators: %1$s: provider, %2$s: collaborations settings link
printf( esc_html__( 'The %1$s URL provided in the %2$s is empty.', 'my-textdomain' ), esc_html( ucfirst( $error ) ), '<a href="' . esc_url( admin_url( '/admin.php?page=collab-settings' ) ) . '">' . esc_html__( 'settings', 'my-textdomain' ) . '</a>' );

// translators: %1$s: provider, %2$s: authentication settings link
printf( esc_html__( 'The %1$s key provided in the %2$s is invalid.', 'my-textdomain' ), esc_html( ucfirst( $error ) ), '<a href="' . esc_url( admin_url( '/admin.php?page=authentication-settings' ) ) . '">' . esc_html__( 'settings', 'my-textdomain' ) . '</a>' );

Will give error:

Warning: The string "settings" has 2 different translator comments. (includes/class-some-file.php:1178)
translators: %1$s: provider, %2$s: collaborations settings link
translators: %1$s: provider, %2$s: authentication settings link

in the .pot I see:

#. translators: %1$s: provider, %2$s: collaborations settings link
#. translators: %1$s: provider, %2$s: authentication settings link
#: includes/class-some-file.php:1178
#: includes/class-some-file.php:1181
msgid "settings"
msgstr ""

Issues:

  1. the translators comment is applied to multiple strings, instead of only to the strings that has that placeholder (%1$s)/the first string
  2. the error message only contains the first location/line number in that file instead of all

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions