Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#36945 closed enhancement (fixed)

Substrings that should not be translated should not be translatable

Reported by: julesaus's profile julesaus Owned by: ocean90's profile ocean90
Milestone: 4.6 Priority: normal
Severity: normal Version:
Component: I18N Keywords: has-patch
Focuses: Cc:

Description

wp-admin/includes/network.php includes the string:

__( 'Add the following to your %1$s file in %2$s <strong>above</strong> the line reading <code>/* That&#8217;s all, stop editing! Happy blogging. */</code>:' )

The code block is a quote from a file and translating it doesn't make any sense, but including it in the translatable string signals to translators that they should translate it.

This is confusing, and creates unnecessary work.

We should pull this substring out of the translatable string to make translating easier and less error prone.

Patch attached.

p.s. Some examples of this string being being incorrectly translated at time of writing:
https://translate.wordpress.org/projects/wp/dev/admin/network/tr/default?filters%5Bterm%5D=happy+blogging
https://translate.wordpress.org/projects/wp/dev/admin/network/it/default?filters%5Bterm%5D=happy+blogging
https://translate.wordpress.org/projects/wp/dev/admin/network/ja/default?filters%5Bterm%5D=happy+blogging
https://translate.wordpress.org/projects/wp/dev/admin/network/pt-br/default?filters%5Bterm%5D=happy+blogging
https://translate.wordpress.org/projects/wp/dev/admin/network/es/default?filters%5Bterm%5D=happy+blogging
https://translate.wordpress.org/projects/wp/dev/admin/network/ru/default?filters%5Bterm%5D=happy+blogging
https://translate.wordpress.org/projects/wp/dev/admin/network/zh-cn/default?filters%5Bterm%5D=happy+blogging
https://translate.wordpress.org/projects/wp/dev/admin/network/ar/default?filters%5Bterm%5D=happy+blogging

Attachments (3)

network.php.happy_blogging.patch (1.0 KB) - added by julesaus 8 years ago.
network.php.translate_happy_blogging.patch (1.2 KB) - added by julesaus 8 years ago.
network.php.if-wp-config-sample.php-is-localised.patch (1.3 KB) - added by julesaus 8 years ago.

Download all attachments as: .zip

Change History (13)

#1 follow-ups: @dd32
8 years ago

It's worth noting that some languages will be translating that string, for example, ja ships with a custom wp-config-sample.php file with translated contents: http://i18n.svn.wordpress.org/ja/trunk/dist/wp-config-sample.php.

It might make sense to split this out to a 2nd string, with translator comments explaining that it should only be translated if it's translated within wp-config-sample.php? There was also a ticket somewhere to put the wp-config-sample.php and readme.html strings into GlotPress, if that was done it'd be able to pull it in automatically, etc.

#2 in reply to: ↑ 1 @SergeyBiryukov
8 years ago

Replying to dd32:

It's worth noting that some languages will be translating that string, for example, ja ships with a custom wp-config-sample.php file with translated contents: http://i18n.svn.wordpress.org/ja/trunk/dist/wp-config-sample.php.

Same for ru_RU and all the other locales listed. They all ship with a translated wp-config-sample.php file, there's nothing incorrect here :)

#3 in reply to: ↑ 1 ; follow-up: @julesaus
8 years ago

That does make it more complicated. Looks like AR is the only locale from the original list that doesn't have a localised wp-config-sample.php, but that list wasn't exhaustive, it's just the locales I happened to be looking at, not a comprehensive scan.

@dd32's suggestion seems very practical, so I'll attach that patch.

(I'd love to pull the line out of the {{{wp-config-sample.php}} and stick it in glotpress automatically, but it seems like it would be more complicated and unreliable than is justified).

Last edited 8 years ago by julesaus (previous) (diff)

#4 in reply to: ↑ 3 @SergeyBiryukov
8 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.6

Replying to julesaus:

Looks like AR is the only locale from the original list that doesn't have a localised wp-config-sample.php

It does in the branch: https://i18n.trac.wordpress.org/browser/ar/branches/4.5/dist/wp-config-sample.php

#5 @julesaus
8 years ago

Thanks for the corrections, I think I've got it now, but just to make sure, let me spell it out:

We've got separate GP projects for each locale/version combination, and each one should match the string in the wp-config-sample.php for that locale/branch. For example, the French and 4.5.x:
Translation: https://translate.wordpress.org/projects/wp/dev/admin/network/fr/default?filters%5Bterm%5D=happy+blogging&filters%5Buser_login%5D=&filters%5Bstatus%5D=current_or_waiting_or_fuzzy_or_untranslated&filter=Filter&sort%5Bby%5D=priority&sort%5Bhow%5D=desc
Localized config file (fr_FR 4.5): https://i18n.trac.wordpress.org/browser/fr_FR/branches/4.5/dist/wp-config-sample.php#L87.

Just to reassess now that I understand the problem better: for 4.5 there are 20 locales that have the a localized config, and the other 135 that translate.wordpress.org lists do not, so I think it's still worth making this change, and the challenge is just in squeezing that paragraph down to a /* translators: */ one-liner.

I've had a crack in the latest patch. It's probably the longest translator comment in the codebase :)

#6 @julesaus
8 years ago

Oh, just to note the other thing I changed in this patch: I've seen contributions where translators replace the wildcard with the literal string "wp-config", so I made that translator comment a bit more verbose.

Last edited 8 years ago by julesaus (previous) (diff)

#7 @ocean90
8 years ago

  • Owner set to ocean90
  • Status changed from new to reviewing
  • Type changed from defect (bug) to enhancement
  • Version trunk deleted

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


8 years ago

#9 @ocean90
8 years ago

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

In 37902:

I18N: Make "That's all, stop editing! Happy blogging." translatable.

The string is used during the network installation process to inform the user about where to store additional configuration data. Since the wp-config.php file can be translated the string should be too.

Props julesaus.
Fixes #36945.

#10 @Presskopp
8 years ago

Is the original "blogging" still up-to-date here? Not everyone is blogging with WP, as you know
There's a ticket #37199

Note: See TracTickets for help on using tickets.