Make WordPress Core

Opened 6 weeks ago

Closed 6 weeks ago

#60825 closed defect (bug) (fixed)

Menu item label "Appearance > Patterns" not properly translated

Reported by: jdy68's profile jdy68 Owned by: audrasjb's profile audrasjb
Milestone: 6.5 Priority: normal
Severity: normal Version: 6.5
Component: Administration Keywords: has-patch fixed-major dev-reviewed
Focuses: Cc:

Description

Bug Report

Description

The string "Patterns" under Appearance menu is not translated, but the translation exists.

Environment

  • WordPress: 6.5-RC3-57856
  • PHP: 8.1.15
  • Server: Apache/2.4.54 (Win64) OpenSSL/1.1.1q mod_fcgid/2.3.10-dev
  • Database: mysqli (Server: 8.0.30 / Client: mysqlnd 8.1.15)
  • Browser: Chrome 122.0.0.0 (Windows 10/11)
  • Theme: Twenty Fifteen 3.6
  • MU-Plugins: Aucune activée
  • Plugins:
    • WordPress Beta Tester 3.5.5

Steps to Reproduce

1.Install WordPress 6.5-RC3
2.Install a classic theme like Twenty-Twenty
3.Select Français/French or Espanol or Deutsch in Settings > General > Site Language
🐞 Go to Appearance menu and see that "Patterns" is not translated.

Expected Results

  1. ✅ "Patterns" must be translated.

Actual Results

  1. ❌ "Patterns" is not translated even though the translation exists.

For example in fr_FR locale:
https://translate.wordpress.org/projects/wp/dev/fr/default/?filters%5Bstatus%5D=either&filters%5Boriginal_id%5D=10187524&filters%5Btranslation_id%5D=76090580

Attachments (1)

wp65-rc3-appearance-patterns-menu-not-translated.png (5.5 KB) - added by jdy68 6 weeks ago.
screenshot of Appearance menu with Patterns not translated

Download all attachments as: .zip

Change History (26)

@jdy68
6 weeks ago

screenshot of Appearance menu with Patterns not translated

#1 @audrasjb
6 weeks ago

  • Milestone changed from Awaiting Review to 6.5
  • Priority changed from normal to high

I can reproduce the issue on my side. But after looking on the code at a glance, I can't see how it's happening.

Moving to 6.5 as it is a very annoying issue since the interface won't be consistent on a large amount of websites ("Patterns" is not used anywhere else in the interface on localized installations).

Ping @swissspidy: it would be nice to fix this before RC4.

#2 follow-up: @audrasjb
6 weeks ago

Ah probably we should just replace __ function with _x 🙃

#4 in reply to: ↑ 2 @kebbet
6 weeks ago

Replying to audrasjb:

Ah probably we should just replace __ function with _x 🙃

Or add a translators comment to __( 'Patterns' ) like /* Translators: Admin menu item. */ or similar.

#5 @audrasjb
6 weeks ago

Hopefully replacing __ with _x wouldn't cause any string change, but I'm not sure about this :)
Edit: no the string will probably be fuzzied.

Note: Even if there is a string change, I think it's worth fixing this issue.

Last edited 6 weeks ago by audrasjb (previous) (diff)

This ticket was mentioned in PR #6307 on WordPress/wordpress-develop by @kebbet.


6 weeks ago
#6

  • Keywords has-patch added; needs-patch removed

@swissspidy commented on PR #6307:


6 weeks ago
#7

We should just use _x( 'Patterns', 'site editor menu item' ) instead of __( 'Patterns', 'site editor menu item' )

No translator comment or anything

#8 @swissspidy
6 weeks ago

Heya, yes let's use _x( 'Patterns', 'site editor menu item' ) here like it was intended.

It will cause a new translation string to appear but that will basically have the same translation as the others, so should be fine.

Alternatively, if we're worried about that, we simply remove the text domain for 6.5 and in 6.5.1 we use the proper context. Then there won't be a string change in 6.5

@swissspidy commented on PR #6307:


6 weeks ago
#10

That is correct. See the discussion on the ticket about that. We have a couple of options here.

#11 @kebbet
6 weeks ago

sv_SE has been translated fully for 6.5.
Testing the options:

  • _x( 'Patterns', 'site editor menu item' ) displays Patterns in admin menu.
  • __( 'Patterns' ) displays Mönster in admin menu.

So going with __() is my suggestion.

#12 follow-up: @jdy68
6 weeks ago

But the code is already

__( 'Patterns' )


and it doesn't work

Last edited 6 weeks ago by jdy68 (previous) (diff)

#13 @audrasjb
6 weeks ago

Yeah, using __( 'Patterns' ) would indeed fix the issue without introducing any string change.

@swissspidy another option would be:

  1. Use __( 'Patterns' ) as a quick fix for RC4, so we don't get a fuzzy string
  2. Replace it with _x in 6.5.1 so we get the translator comment back

Note: if we're already going to have other string changes in RC4, we can probably afford to introduce a fuzzy string, though.

#14 in reply to: ↑ 12 @audrasjb
6 weeks ago

Replying to jdy68:

But the code is already

__( 'Patterns' )


and it doesn't work

The current code is __( 'Patterns', 'site editor menu item' ).

It doesn't work because __() is not supposed to have a translator comment as a second parameter. The second parameter of __() is the text domain, see https://developer.wordpress.org/reference/functions/__/.

Last edited 6 weeks ago by audrasjb (previous) (diff)

#15 @swissspidy
6 weeks ago

another option would be:

Yes that's what I meant above.

Note: if we're already going to have other string changes in RC4, we can probably afford to introduce a fuzzy string, though.

I think so too. Looks like we're changing some strings on the about page.

@audrasjb commented on PR #6307:


6 weeks ago
#16

Using __( 'Patterns' ) looks like our best option there.
Approving this for commit.

#17 @swissspidy
6 weeks ago

  • Summary changed from Translation of menu "Appearance > Patterns" not taken into account to Menu item label "Appearance > Patterns" not properly translated

#18 @audrasjb
6 weeks ago

  • Keywords commit added
  • Owner set to audrasjb
  • Status changed from new to accepted

I think we're good to go with the proposed PR.

#19 @audrasjb
6 weeks ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 57864:

I18n: Ensure "Patterns" menu item is translatable.

This changeset updates a translation string to ensure the "Patterns" menu item introduced in [57543] is translatable.
This quickfix simply removes the erroneous context parameter so no new string is introduced during WP 6.5 string freeze period. A follow-up changeset will be needed to replace the current __() function with _x() and put back the context parameter.

Follow-up to [57543].

Props jdy68, audrasjb, kebbet, swissspidy.
Fixes #60825.

#20 @audrasjb
6 weeks ago

  • Keywords fixed-major dev-feedback added; commit removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for backport consideration.
@swissspidy can you sign-off this for 6.5 please?

#21 @swissspidy
6 weeks ago

  • Keywords dev-reviewed added; dev-feedback removed

@audrasjb Are you handling the follow-up as well?

#23 @swissspidy
6 weeks ago

  • Priority changed from high to normal

#24 @audrasjb
6 weeks ago

yeah sure! thanks for the review ;)

#25 @audrasjb
6 weeks ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 57866:

I18n: Ensure "Patterns" menu item is translatable.

This changeset updates a translation string to ensure the "Patterns" menu item introduced in [57543] is translatable.
This quickfix simply removes the erroneous context parameter so no new string is introduced during WP 6.5 string freeze period. A follow-up changeset will be needed to replace the current __() function with _x() and put back the context parameter.

Follow-up to [57543].

Reviewed by swissspidy.
Merges [57864] to the to the 6.5 branch.

Props jdy68, audrasjb, kebbet, swissspidy.
Fixes #60825.

Note: See TracTickets for help on using tickets.