You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ff8698d
Browse filesBrowse the repository at this point in the historyBrowse files
Entity Fields: Keep code out of translatable strings.
Pass hook names, file names, keys, and method names as placeholders, wrapped in `<code>`, instead of keeping them inside the strings to translate, as core does elsewhere.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: src/wp-includes/class-wp-entity-fields-registry.php
+53-19Lines changed: 53 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -165,11 +165,12 @@ public function register( $origin, $kind, $name, $fields, $script_module = null
165
165
_doing_it_wrong(
166
166
__METHOD__,
167
167
sprintf(
168
-
/* translators: 1: Entity kind, e.g. postType. 2: Entity name, e.g. page. 3: Comma-separated list of field ids. */
169
-
__( 'A field can only be registered once. These fields of %1$s "%2$s" are skipped because they are already registered: %3$s. Use update() to change a registered field, or unregister it first to replace it.' ),
168
+
/* translators: 1: Entity kind, e.g. postType. 2: Entity name, e.g. page. 3: Comma-separated list of field ids. 4: update() */
169
+
__( 'A field can only be registered once. These fields of %1$s "%2$s" are skipped because they are already registered: %3$s. Use %4$s to change a registered field, or unregister it first to replace it.' ),
170
170
$kind,
171
171
$name,
172
-
implode( ', ', $registered_ids )
172
+
implode( ', ', $registered_ids ),
173
+
'<code>update()</code>'
173
174
),
174
175
'7.2.0'
175
176
);
@@ -265,11 +266,12 @@ public function update( $origin, $kind, $name, $fields, $script_module = null )
265
266
_doing_it_wrong(
266
267
__METHOD__,
267
268
sprintf(
268
-
/* translators: 1: Entity kind, e.g. postType. 2: Entity name, e.g. page. 3: Comma-separated list of field ids. */
269
-
__( 'Only registered fields can be updated. These fields of %1$s "%2$s" are skipped because they are not registered: %3$s. Use register() to add a field.' ),
269
+
/* translators: 1: Entity kind, e.g. postType. 2: Entity name, e.g. page. 3: Comma-separated list of field ids. 4: register() */
270
+
__( 'Only registered fields can be updated. These fields of %1$s "%2$s" are skipped because they are not registered: %3$s. Use %4$s to add a field.' ),
270
271
$kind,
271
272
$name,
272
-
implode( ', ', $unregistered_ids )
273
+
implode( ', ', $unregistered_ids ),
274
+
'<code>register()</code>'
273
275
),
274
276
'7.2.0'
275
277
);
@@ -528,7 +530,12 @@ protected function initialize() {
__( 'The registered fields cannot be read until the `init` action has completed: the post types and supports they derive from are registered on `init`. Read them once `init` has completed, or hook `wp_entity_fields_api_init`.' ),
__( 'The registered fields cannot be read until the %1$s action has completed: the post types and supports they derive from are registered on %1$s. Read them once %1$s has completed, or hook %2$s.' ),
536
+
'<code>init</code>',
537
+
'<code>wp_entity_fields_api_init</code>'
538
+
),
532
539
'7.2.0'
533
540
);
534
541
return;
@@ -577,7 +584,11 @@ protected function doing_entity_fields_api_init( $method ) {
577
584
578
585
_doing_it_wrong(
579
586
$method,
580
-
__( 'Fields can only be registered, updated, and unregistered on the `wp_entity_fields_api_init` action.' ),
587
+
sprintf(
588
+
/* translators: %s: wp_entity_fields_api_init */
589
+
__( 'Fields can only be registered, updated, and unregistered on the %s action.' ),
/* translators: 1: Entity kind, e.g. postType. 2: Entity name, e.g. page. 3: Comma-separated list of positions, e.g. #2, #4. */
735
-
__( 'Every field definition must be an array with a non-empty string `id`. These definitions of %1$s "%2$s" are skipped: %3$s. The rest of the fields of the call are stored.' ),
745
+
/* translators: 1: Entity kind, e.g. postType. 2: Entity name, e.g. page. 3: Comma-separated list of positions, e.g. #2, #4. 4: id */
746
+
__( 'Every field definition must be an array with a non-empty string %4$s. These definitions of %1$s "%2$s" are skipped: %3$s. The rest of the fields of the call are stored.' ),
/* translators: 1: The name of a field collection. 2: Comma-separated list of folder names. */
906
-
__( 'The `field.php` of a field must return an array, with a non-empty string `id` if it sets one. These fields of the field collection "%1$s" are skipped: %2$s.' ),
937
+
/* translators: 1: The name of a field collection. 2: Comma-separated list of folder names. 3: field.php 4: id */
938
+
__( 'The %3$s of a field must return an array, with a non-empty string %4$s if it sets one. These fields of the field collection "%1$s" are skipped: %2$s.' ),
0 commit comments