Make WordPress Core

Opened 6 weeks ago

Closed 2 weeks ago

#64982 closed defect (bug) (fixed)

library should be changed to media library in core or needs gettext

Reported by: timse201's profile timse201 Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 7.0 Priority: normal
Severity: normal Version: trunk
Component: I18N Keywords: has-patch commit dev-reviewed
Focuses: Cc:

Description

https://translate.wordpress.org/projects/wp/dev/de/default/?filters%5Bstatus%5D=either&filters%5Boriginal_id%5D=16513323&filters%5Btranslation_id%5D=115284524

library is used for media library and for Gutenberg libraries. We have a single short word in German for media library that differs.

Change History (14)

#1 @audrasjb
6 weeks ago

  • Milestone changed from Awaiting Review to 7.0

To be clear, what is needed here is a context for translators, using the _x() function.
See https://developer.wordpress.org/plugins/internationalization/how-to-internationalize-your-plugin/#disambiguation-by-context

#2 @audrasjb
6 weeks ago

  • Keywords needs-patch added

This ticket was mentioned in PR #11404 on WordPress/wordpress-develop by @sanket.parmar.


6 weeks ago
#3

  • Keywords has-patch added; needs-patch removed

## Summary

The string "Library" was used in two unrelated contexts without translator context:

  • As the Media Library submenu item in the admin menu
  • As the installed fonts tab label in the Font Library page

In languages like German, these concepts use different words (Mediathek vs. Bibliothek), making a single translation impossible without disambiguation.

## Changes

  • wp-admin/menu.php: Changed __( 'Library' ) to _x( 'Library', 'Media Library menu item' ) for the Media submenu entry.
  • wp-includes/build/routes/font-list/content.js and content.min.js: Changed __("Library") to _x("Library", "Font library") for the installed-fonts tab title, aligning it with the already-correct _x() usage in the Font Library modal.

## Testing

No functional change in English. Translators can now provide distinct translations for each context via _x().

---

Trac ticket: https://core.trac.wordpress.org/ticket/64982

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


6 weeks ago

#5 follow-up: @audrasjb
6 weeks ago

This fixes the issue, but I'd rather add a context for both strings.

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


5 weeks ago
#6

Fix : https://core.trac.wordpress.org/ticket/64982

Both strings now have translator context

This ticket was mentioned in Slack in #core-test by gaisma22. View the logs.


4 weeks ago

This ticket was mentioned in Slack in #core-test by sanjay_jadav. View the logs.


4 weeks ago

#9 @jadavsanjay
4 weeks ago

Patch Testing Report

Patch Tested: https://github.com/WordPress/wordpress-develop/pull/11515

Environment

  • WordPress: 7.1-alpha-20260409.094020
  • PHP: 8.3.30
  • Server: PHP.wasm
  • Database: WP_SQLite_Driver (Server: 8.0.38 / Client: 3.51.0)
  • Browser: Chrome 147.0.0.0
  • OS: Windows
  • Theme: Twenty Twenty-Five 1.4
  • MU Plugins: None
  • Plugins: Test Reports 1.2.1

Steps Taken

  1. Loaded PR #11515 using the WordPress PR option in Playground.
  2. Opened File browser and navigated to /wordpress/wp-admin/menu.php.
  3. Searched for _x( 'Library', 'media library' ) on line 75. Confirmed the patch applied correctly.

✅ Patch is solving the problem

Expected Result

The Media Library submenu item now uses _x() with translator
context instead of ().

No visual change expected in English.
Translators can now provide accurate translations for their
language once language files are updated.

Additional Notes

  1. Patch confirmed applied via file browser in Playground.
  2. No visual change expected. Verification is code-level only.

Screenshots/Screencast with results

https://postimg.cc/Lqp429ZV

Last edited 4 weeks ago by jadavsanjay (previous) (diff)

#10 in reply to: ↑ 5 @SergeyBiryukov
3 weeks ago

Replying to audrasjb:

This fixes the issue, but I'd rather add a context for both strings.

It appears that the other instance would need to be changed in Gutenberg, so I think PR 11404 is good to go for core.

Nitpicking: I would suggest media library menu item as the context (no capitalization), that would be consistent with a few existing admin menu strings:

  • _x( 'Editor', 'site editor menu item' )
  • _x( 'Design', 'design menu item' )
  • _x( 'Patterns', 'patterns menu item' )

#11 @SergeyBiryukov
3 weeks ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 62256:

I18N: Add context for the Library admin menu item.

Props timse201, sanketparmar, trickster301, audrasjb, jadavsanjay, SergeyBiryukov.
Fixes #64982.

#12 @SergeyBiryukov
3 weeks ago

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

Reopening for 7.0 consideration.

#13 @peterwilsoncc
2 weeks ago

  • Keywords dev-reviewed added; dev-feedback removed

r62256 approved for merging to the 7.0 branch

Last edited 2 weeks ago by peterwilsoncc (previous) (diff)

#14 @peterwilsoncc
2 weeks ago

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

In 62267:

I18N: Add context for the Library admin menu item.

Reviewed by peterwilsoncc.
Merges r62256 to the 7.0 branch.

Props timse201, sanketparmar, trickster301, audrasjb, jadavsanjay, SergeyBiryukov.
Fixes #64982.

Note: See TracTickets for help on using tickets.