WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 4 years ago

#10005 reviewing enhancement

Some strings need "no HTML entities" translator comments

Reported by: xibe Owned by: nbachiyski
Milestone: Future Release Priority: normal
Severity: minor Version: 2.7.1
Component: I18N Keywords: needs-patch
Focuses: Cc:

Description

I've been putting a specific set of custom comments in my PO for some time now, and since WP is now able to handle translator comments very graciously, I think it would be nice to switch them over there.

The following strings need to have an indication warning translators against the inclusion of HTML entities within their translation, because of where the strings are user (RSS feeds, e-mail...). For instance, "Protected Comments: " should be translated to "Commentaires protégés : ", but since it is used in feeds, it breaks them...

Suggestions comment: "Do not add HTML entities ( , etc): used in [context]".

Here they are (sorry, raw list out of my PO file).

Used in feeds:

  • "Comments on: %s", wp-includes/feed-atom-comments.php:19 and wp-includes/feed-rss2-comments.php:22
  • "By: %s", wp-includes/feed-atom-comments.php:56 and wp-includes/feed-rss2-comments.php:48
  • "Protected Comments: Please enter your password to view comments.", wp-includes/feed-rss2-comments.php:56

Used in e-mail:

  • "Your new WordPress blog has been successfully set up at: ...", wp-admin/includes/upgrade.php:229
  • "New comment on your post #%1$s \"%2$s\"", wp-includes/pluggable.php:968
  • "Author : %1$s (IP: %2$s , %3$s)", wp-includes/pluggable.php:970 and wp-includes/pluggable.php:1072
  • "E-mail : %s", wp-includes/pluggable.php:971 and wp-includes/pluggable.php:1073
  • "URL : %s", wp-includes/pluggable.php:972, wp-includes/pluggable.php:983, wp-includes/pluggable.php:993, wp-includes/pluggable.php:1059, wp-includes/pluggable.php:1066 and wp-includes/pluggable.php:1074
  • "Whois : http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s" and wp-includes/pluggable.php:973 and wp-includes/pluggable.php:1075
  • "Comment: ", wp-includes/pluggable.php:974 and wp-includes/pluggable.php:1076
  • "You can see all comments on this post here: ", wp-includes/pluggable.php:975
  • "[%1$s] Comment: \"%2$s\"", wp-includes/pluggable.php:977
  • "New trackback on your post #%1$s \"%2$s\"", wp-includes/pluggable.php:980
  • "Website: %1$s (IP: %2$s , %3$s)", wp-includes/pluggable.php:982 and wp-includes/pluggable.php:992
  • "Excerpt: ", wp-includes/pluggable.php:984 and wp-includes/pluggable.php:994
  • "You can see all trackbacks on this post here: ", wp-includes/pluggable.php:985
  • "[%1$s] Trackback: \"%2$s\"", wp-includes/pluggable.php:987
  • "New pingback on your post #%1$s \"%2$s\"", wp-includes/pluggable.php:990
  • "You can see all pingbacks on this post here: ", wp-includes/pluggable.php:995
  • "[%1$s] Pingback: \"%2$s\"", wp-includes/pluggable.php:997
  • "Delete it: %s", wp-includes/pluggable.php:1000 and wp-includes/pluggable.php:1081
  • "Spam it: %s", wp-includes/pluggable.php:1001 and wp-includes/pluggable.php:1082
  • "A new trackback on the post #%1$s \"%2$s\" is waiting for your approval", wp-includes/pluggable.php:1056
  • "Website : %1$s (IP: %2$s , %3$s)", wp-includes/pluggable.php:1058 and wp-includes/pluggable.php:1065
  • "Trackback excerpt: ", wp-includes/pluggable.php:1060
  • "A new pingback on the post #%1$s \"%2$s\" is waiting for your approval", wp-includes/pluggable.php:1063
  • "Pingback excerpt: ", wp-includes/pluggable.php:1067
  • "A new comment on the post #%1$s \"%2$s\" is waiting for your approval", wp-includes/pluggable.php:1070
  • "Approve it: %s", wp-includes/pluggable.php:1080
  • "Currently %s comment is waiting for approval. Please visit the moderation panel:", wp-includes/pluggable.php:1084
  • "[%1$s] Please moderate: \"%2$s\"", wp-includes/pluggable.php:1088
  • "Password Lost and Changed for user: %s", wp-includes/pluggable.php:1114
  • "[%s] Password Lost/Changed", wp-includes/pluggable.php:1115
  • "New user registration on your blog %s:", wp-includes/pluggable.php:1135
  • "Username: %s", wp-includes/pluggable.php:1136, wp-includes/pluggable.php:1144
  • "E-mail: %s", wp-includes/pluggable.php:1137
  • "[%s] New User Registration", wp-includes/pluggable.php:1139
  • "Password: %s", wp-includes/pluggable.php:1145
  • "[%s] Your username and password", wp-includes/pluggable.php:1148

Used in visual editor (entities break it):

  • "Edit Image", wp-includes/js/tinymce/langs/wp-langs.php:421
  • "Delete Image", wp-includes/js/tinymce/langs/wp-langs.php:422

Used in an alert() message:

  • "Enter a word to look up:", wp-includes/script-loader.php:76

Obviously these were marked for my locale's need, I think all the strings pertaining to these context should be properly commented about this.

Hopefully it is not too late (and is quick enough) for inclusion with 2.8.

Attachments (4)

entities-in-feeds.diff (3.5 KB) - added by xibe 5 years ago.
Translator comments; warning about use of HTML entities in feeds
entities-in-visualEditor.diff (784 bytes) - added by xibe 5 years ago.
Translator comments; warning about use of HTML entities in Visual Editor
entities-in-jsAlert.diff (749 bytes) - added by xibe 5 years ago.
Translator comments; warning about use of HTML entities in JS alert() message
translators-entities-warning.diff (18.4 KB) - added by xibe 5 years ago.
Patch for all related files.

Download all attachments as: .zip

Change History (15)

comment:1 Denis-de-Bernardy5 years ago

  • Keywords needs-patch added

Hopefully it is not too late (and is quick enough) for inclusion with 2.8.

This kind of stuff usually depends on whether a patch is around on the spot...

comment:2 Denis-de-Bernardy5 years ago

  • Milestone changed from 2.8 to 2.9

Punting per discussion during the WP meet-up...

xibe5 years ago

Translator comments; warning about use of HTML entities in feeds

xibe5 years ago

Translator comments; warning about use of HTML entities in Visual Editor

xibe5 years ago

Translator comments; warning about use of HTML entities in JS alert() message

comment:3 follow-up: xibe5 years ago

  • Keywords has-patch needs-testing dev-feedback added; needs-patch removed
  • Milestone changed from 2.9 to 2.8

Hello there. Long time commenter, first time patcher. Trying to get this into 2.8 if I can. Patches are all against latest trunk.

I tried my hand at make patches for 3 of the 4 contexts I wrote about. Since I'm not sure I'm doing anything well, I'd like to submit those for consideration by the core-devs, before digging into the 4th, much longer one.

As far as I can tell, I've followed the "translators comments" way to the letter, but if Nikolay has advices about it, or if the warning message itself is not too great, I'm willing to amend the patches as needed.

comment:4 in reply to: ↑ 3 Denis-de-Bernardy5 years ago

Replying to xibe:

Hello there. Long time commenter, first time patcher. Trying to get this into 2.8 if I can. Patches are all against latest trunk.

You're doing great imo. :-)

comment:5 follow-up: azaozz5 years ago

Looks good to me too. There are several files where all strings are used either in a feed or in js (feed-atom-comments.php, feed-rss2-comments.php, wp-langs.php, script-loader.php, ...), perhaps we need to add the warning once at the top in them.

xibe5 years ago

Patch for all related files.

comment:6 in reply to: ↑ 5 xibe5 years ago

Replying to azaozz:

...perhaps we need to add the warning once at the top in them.

Well, that might take some thinking, hence time, hence miss the 2.8 release.

Until then, here goes the full patch for all the strings of all noted files. Please make sure I didn't make any glaring mistake in pluggable.php, such as adding a second semi-colon to already-existing translators comments.

I have slightly amended the text, going from "do not use HTML entities ( , etc.): string is used in[context]" to "Note: do not use ...".

Apart from that, the other files haven't seen much change since their first pages.

Note that I can't proclaim to have touched upon all need strings, only as many as I thought were necessary.

Discuss :)

comment:7 xibe5 years ago

  • Owner changed from nbachiyski to azaozz
  • Status changed from new to reviewing

comment:8 azaozz5 years ago

  • Owner changed from azaozz to nbachiyski

All strings in script-loader.php and wp-langs.php are used in js (they are inside <script> tags). Don't think adding a comment to each string there is a good idea, may need a better way to mark them.

comment:9 nbachiyski5 years ago

  • Milestone changed from 2.8 to 2.9

We have computers on our side and we can do better than telling the translators not to use entities. In all cases we can properly escape entities if they aren't allowed. It can wait until next version, though.

comment:10 Denis-de-Bernardy5 years ago

  • Keywords needs-patch added; has-patch needs-testing dev-feedback removed

comment:11 ryan4 years ago

  • Milestone changed from 2.9 to Future Release
Note: See TracTickets for help on using tickets.