Making WordPress.org

Changeset 14778


Ignore:
Timestamp:
03/30/2026 05:01:48 AM (3 days ago)
Author:
dd32
Message:

Plugin Directory: Translations: Include Changelog version headers in the translatable strings.

Some plugins use nice version strings, such as 'Version 1.2.3 (31st March, 2026)' which can be translated.
Version strings such as '1.2.3' and 'v2.0' are skipped from being imported into GlotPress.
Changelog headers are still marked as low-priority, along with the changelog text.

See https://wordpress.slack.com/archives/C0341VCNL/p1774629908720099

File:
1 edited

Legend:

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

    r13075 r14778  
    8888
    8989        foreach ( $readme->sections as $section_key => $section_text ) {
    90             if ( 'changelog' !== $section_key ) { // No need to scan non-translatable version headers in changelog.
    91                 if ( preg_match_all( '~<(h[3-4]|dt)[^>]*>([^<].+)</\1>~', $section_text, $matches ) ) {
    92                     if ( ! empty( $matches[2] ) ) {
    93                         foreach ( $matches[2] as $text ) {
    94                             $section_strings = $this->handle_translator_comment( $section_strings, $text, "{$section_key} header" );
     90           
     91            if ( preg_match_all( '~<(h[3-4]|dt)[^>]*>([^<].+)</\1>~', $section_text, $matches ) ) {
     92                if ( ! empty( $matches[2] ) ) {
     93                    foreach ( $matches[2] as $text ) {
     94                        // No need to include non-translatable version headers in changelog.
     95                        if ( 'changelog' === $section_key && preg_match( '!^v?\d+(\.\d+)*$!i', trim( $text ) ) ) {
     96                            continue;
     97                        }
     98
     99                        $section_strings = $this->handle_translator_comment( $section_strings, $text, "{$section_key} header" );
     100                        if ( 'changelog' === $section_key ) {
     101                            $str_priorities[ $text ] = -1;
    95102                        }
    96103                    }
Note: See TracChangeset for help on using the changeset viewer.