Making WordPress.org

Changeset 13354


Ignore:
Timestamp:
03/19/2024 06:34:18 AM (2 years ago)
Author:
dd32
Message:

Plugin Directory: Update the archive titles to remove the "Browse:" prefix from the section archives.

This will help sync the translations of the sections from the homepage to the archive views.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-i18n.php

    r8613 r13354  
    2323            $term->name = esc_html( translate_with_gettext_context( html_entity_decode( $term->name ), 'Plugin Category Name', 'wporg-plugins' ) );
    2424        } elseif ( 'plugin_section' == $term->taxonomy ) {
     25            $original   = $term->name;
    2526            $term->name = esc_html( translate_with_gettext_context( html_entity_decode( $term->name ), 'Plugin Section Name', 'wporg-plugins' ) );
     27
     28            // Some strings already exist without the context, try those.
     29            if ( $term->name === $original ) {
     30                $term->name = esc_html( translate( html_entity_decode( $term->name ), 'wporg-plugins' ) );
     31            }
     32
    2633            if ( $term->description ) {
    2734                $term->description = esc_html( translate_with_gettext_context( html_entity_decode( $term->description ), 'Plugin Section Description', 'wporg-plugins' ) );
     
    7380        // Section terms.
    7481        _x( 'Adopt Me', 'Plugin Section Name', 'wporg-plugins' );
    75         _x( 'Beta', 'Plugin Section Name', 'wporg-plugins' );
    76         _x( 'Blocks', 'Plugin Section Name', 'wporg-plugins' );
     82        _x( 'Beta Plugins', 'Plugin Section Name', 'wporg-plugins' );
     83        _x( 'Block-Enabled Plugins', 'Plugin Section Name', 'wporg-plugins' );
    7784        _x( 'My Favorites', 'Plugin Section Name', 'wporg-plugins' );
    78         _x( 'Featured', 'Plugin Section Name', 'wporg-plugins' );
    79         _x( 'Popular', 'Plugin Section Name', 'wporg-plugins' );
    80         _x( 'Blocks', 'Plugin Section Name', 'wporg-plugins' );
     85        _x( 'Featured Plugins', 'Plugin Section Name', 'wporg-plugins' );
     86        _x( 'Popular Plugins', 'Plugin Section Name', 'wporg-plugins' );
     87        /* translators: Block plugins are single-block plugins, not block-enabled plugins. */
     88        _x( 'Block Plugins', 'Plugin Section Name', 'wporg-plugins' );
     89        _x( 'New Plugins', 'Plugin Section Name', 'wporg-plugins' );
     90        _x( 'Updated Plugins', 'Plugin Section Name', 'wporg-plugins' );
    8191
    8292        // Section descriptions.
    8393        _x( 'Plugins that have been offered for adoption by others.', 'Plugin Section Description', 'wporg-plugins' );
    8494        _x( 'Beta plugins are in development for possible inclusion in a future version of WordPress.', 'Plugin Section Description', 'wporg-plugins' );
    85         _x( 'Plugins that offer blocks.', 'Plugin Section Description', 'wporg-plugins' );
    86         _x( 'Plugins contained within this category get displayed on the Featured tab.', 'Plugin Section Description', 'wporg-plugins' );
    8795        _x( 'The below plugins have been marked as favorites.', 'Plugin Section Description', 'wporg-plugins' );
    8896        _x( 'Plugins that offer blocks for the block-based editor.', 'Plugin Section Description', 'wporg-plugins' );
     97        _x( 'Block Plugins as used in the Block Directory.', 'Plugin Section Description', 'wporg-plugins' );
    8998    }
    9099}
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

    r13349 r13354  
    4747        add_filter( 'query_vars', array( $this, 'filter_query_vars' ), 1 );
    4848        add_filter( 'single_term_title', array( $this, 'filter_single_term_title' ) );
     49        add_filter( 'get_the_archive_title_prefix', array( $this, 'filter_get_the_archive_title_prefix' ) );
    4950        add_filter( 'the_content', array( $this, 'filter_rel_nofollow_ugc' ) );
    5051        add_action( 'wp_head', array( Template::class, 'json_ld_schema' ), 1 );
     
    13481349
    13491350        return $name;
     1351    }
     1352
     1353    /**
     1354     * Remove the prefix for the browse sections.
     1355     * These should display "Term" rather than "Browse: Term".
     1356     *
     1357     * @param string $prefix the prefix for the archive.
     1358     * @return string
     1359     */
     1360    function filter_get_the_archive_title_prefix( $prefix ) {
     1361        if ( is_tax( 'plugin_section' ) ) {
     1362            $prefix = '';
     1363        }
     1364
     1365        return $prefix;
    13501366    }
    13511367
Note: See TracChangeset for help on using the changeset viewer.