Following up on #2571845: Links to wikipedia/php.net should be part of the actual t() string so they can be localized there are still some English-specific links to php.net in documentation and other non-translatable strings. Those should link to the non-English-specific URLs instead.

My guess is that some of these were added after that issue went in.... so perhaps the conclusions of that issue also need to be somewhere in the Drupal coding standards (if they aren't already).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

David_Rothstein created an issue. See original summary.

David_Rothstein’s picture

Status: Active » Needs review
FileSize
5.95 KB

Here's a patch for the ones I could find.

Note that there are a few others (examples of both http://php.net/manual/en... and https://en.wikipedia.org...) in translatable strings, but I think the conclusion of the above issue was that it is not worth breaking translations for something like this (since it's an English-specific URL in an English string anyway).

David_Rothstein’s picture

Component: documentation » other

Most of these are in documentation, but the one in install.php actually isn't.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

This one is just plain wrong:

+++ b/core/lib/Drupal/Component/Datetime/DateTimePlus.php
@@ -280,7 +280,7 @@ public static function createFromFormat($format, $time, $timezone = NULL, $setti
    *   parameter and the current timezone are ignored when the $time parameter
    *   either is a UNIX timestamp (e.g. @946684800) or specifies a timezone
    *   (e.g. 2010-01-28T15:00:00+02:00).
-   *   @see http://php.net/manual/en/datetime.construct.php
+   *   @see http://php.net/manual/datetime.construct.php
    * @param array $settings
    *   (optional) Keyed array of settings. Defaults to empty array.
    *   - langcode: (optional) String two letter language code used to control

We don't put @see in the middle of an @param. It should just say "See " not "@see".

That error is repeated here:

+++ b/core/lib/Drupal/Core/Datetime/DrupalDateTime.php
@@ -38,7 +38,7 @@ class DrupalDateTime extends DateTimePlus {
    *   timezone are ignored when the $time parameter either is a UNIX timestamp
    *   (e.g. @946684800) or specifies a timezone
    *   (e.g. 2010-01-28T15:00:00+02:00).
-   *   @see http://php.net/manual/en/datetime.construct.php
+   *   @see http://php.net/manual/datetime.construct.php
    * @param array $settings
    *   - validate_format: (optional) Boolean choice to validate the
    *     created date using the input format. The format used in

I don't know if you want to fix those problems here or in a separate issue? The patch isn't very large...

Anyway, if you want to make a separate issue for those @see violations, then this patch is fine. I tested all the URLs that are fixed, and they are all going to their intended locations. And there are no translated strings being changed. So, if you want to put the @see thing in its own issue (there may be more instances of it), then this patch is RTBC. Otherwise, it is Needs Work for changing @see to See.

For reference... Here are the standards on @see:
https://www.drupal.org/docs/develop/coding-standards/api-documentation-a...
This part of the standards doesn't exactly say "don't put this into another part of the documentation" explicitly, but they do say that the @see references are collected into their own See Also section. Which implies they are not part of the text of something else, like a @param.

Also note the order of sections in doc blocks:
https://www.drupal.org/docs/develop/coding-standards/api-documentation-a...
@see is near the end, and as stated there, each tag listed goes in its own section.

We should definitely have a Coder sniff to sniff the order of docs sections, which apparently we don't already have or else it isn't being enforced... Anyway that is probably a separate issue, so I'm marking this as RTBC.

larowlan’s picture

Follow up is fine for the @see

Anonymous’s picture

For me, the use of an @see makes sense everywhere where there is a description. So, +1 to use @see inside of @param.

#2 includes 9 replaces. But search by template php.net.*/en gave a 13 places. Probably these:

jhodgdon’s picture

@vaplas -- @see means "Add this to the See Also section at the end of the documentation". Here, it is being used as if it means "Replace @see with the words "See also" and leave it embedded in this text". Because of what @see does, we structure the documentation by putting all the @see lines together at the end of the documentation, so that the doc block in the code reads pretty similarly to what you see on api.drupal.org when it's parsed out.

Regarding the 4 other php.net/.../en things, these are all inside t() calls. Meaning they are in translated strings. This is a fairly minor problem, and probably not worth changing translated strings over (see parent issue for discussion on that).

Anonymous’s picture

@jhodgdon, thank you for clarifying these points! So, please ignore #6.

David_Rothstein’s picture

Thanks for the review. Yes, I would say the @see thing is better as its own followup issue, since there are a number of other cases like that (besides the lines change by this patch), especially within DateTimePlus.php, but elsewhere too. There are also tons of cases throughout the codebase (including a few visible in this patch) where @see is used within an inline code comment (not a function docblock), and as far as I know that's incorrect also (I'm pretty sure it should be "See ...." there as well, since it's part of a paragraph)?

And yes, I'm pretty sure the only cases of English-specific php.net/Wikipedia links remaining after this patch are all inside translatable strings (see my earlier comment in #2).

jhodgdon’s picture

Regarding @see in // comments, I'm not as concerned... They aren't parsed/displayed as Function/Class/Etc. documentation, so they don't need to be quite as formalized. @see seems clear enough (and clarity should be the goal of // comments, explaining why the code is how it is). But inside @param or @return or etc., @see is kind of problematic for parsing.

larowlan’s picture

larowlan’s picture

Version: 8.4.x-dev » 8.5.x-dev
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Needs to go into 8.5.x first, but doesn't apply.

harsha012’s picture

Status: Needs work » Needs review
FileSize
5.9 KB

Re rolled the patch to 8.5.x

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Thanks!

  • larowlan committed 32cc90b on 8.5.x
    Issue #2933424 by David_Rothstein, harsha012, jhodgdon, vaplas: English-...
larowlan’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -Needs reroll

Committed as 32cc90b and pushed to 8.5.x.

As per https://www.drupal.org/core/release-cycle-overview#current-development-c... 8.4 is in 'critical fixes only', so this can't be backported to 8.4

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

David_Rothstein’s picture

I created #2940420: @see should not be used inside a @param description for the documentation issues with @see mentioned in the comments above.