Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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).
Comment | File | Size | Author |
---|---|---|---|
#13 | 2933424-13.patch | 5.9 KB | harsha012 |
#2 | 2933424-2.patch | 5.95 KB | David_Rothstein |
Comments
Comment #2
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedHere's a patch for the ones I could find.
Note that there are a few others (examples of both
http://php.net/manual/en...
andhttps://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).Comment #3
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedMost of these are in documentation, but the one in install.php actually isn't.
Comment #4
jhodgdonThis one is just plain wrong:
We don't put @see in the middle of an @param. It should just say "See " not "@see".
That error is repeated here:
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.
Comment #5
larowlanFollow up is fine for the @see
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedFor 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:Comment #7
jhodgdon@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).
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous commented@jhodgdon, thank you for clarifying these points! So, please ignore #6.
Comment #9
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedThanks 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).
Comment #10
jhodgdonRegarding @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.
Comment #11
larowlanComment #12
larowlanNeeds to go into 8.5.x first, but doesn't apply.
Comment #13
harsha012 CreditAttribution: harsha012 as a volunteer and at Red Crackle commentedRe rolled the patch to 8.5.x
Comment #14
jhodgdonThanks!
Comment #16
larowlanCommitted 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
Comment #18
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedI created #2940420: @see should not be used inside a @param description for the documentation issues with @see mentioned in the comments above.