Making WordPress.org

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#1444 closed defect (bug) (fixed)

Unexpected translations on plugin changelog pages

Reported by: sergeybiryukov's profile SergeyBiryukov Owned by:
Milestone: Priority: normal
Component: Plugin Directory Keywords:
Cc:

Description

Reported by @cybr on Polyglots:

I noticed that my changelog has automated translations based on earlier translations.

I’m OK with this, however, as you can see on https://nl.wordpress.org/plugins/autodescription/changelog/, the class names I describe between backticks are also translated. This might cause fatal errors or just plain confusion :(

My request is the following:
Could it be so that code doesn’t get auto-translated, or more specific, inline code :)

Generally, only the whole strings should be translated, but it looks like on plugin changelog pages translations are currently applied for standalone words too, which leads to unexpected results:

  • AutoBeschijving_Generate::the_url() should be AutoDescription_Generate::the_url().
  • "The Canonieke URL within Posts and Paginas are now correct again" is neither Dutch nor English.

The strings appear to come from the readme translation:

  • Page → Pagina
  • Canonical → Canonieke
  • Description → Beschijving

Change History (3)

#2 @Cybr
9 years ago

As promised, the regex to match all PHP and JavaScript comments, which are therefore safe to translate:

$regex = "/(\#|(\/)?(\*|\/)[^\r\n])(.+?(?=\*\/)|.*)(\*\/)?/igm";

// Explained:
$regex = "
/(              // Group 1
\#             // 1: Grab #
|(\/)?(\*|\/)  // 1: Or, if a slash is found: /* or //
[^\r\n]        // 1: Grab everything including line breaks
)              // End group 1
(              // Group 2
.+?(?=\*\/)    // 2: Grab everything, until */ on same line
|.*            // 2: Or continue to new line
)              // End group 2
(\*\/)?        // Group 3: Find final */ if new line
/igm";

Edit: Fair caution, this script also grabs hyperlinks after the double slash.

Last edited 9 years ago by Cybr (previous) (diff)

#3 @ocean90
9 years ago

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

Fixed in [dotorg11414].

Note: See TracTickets for help on using tickets.