Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
documentation
Priority:
Minor
Category:
Bug report
Assigned:
Issue tags:
Reporter:
Created:
10 Oct 2015 at 05:03 UTC
Updated:
5 Nov 2015 at 23:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
lucian.gutoiu commentedComment #3
lucian.gutoiu commentedIt actually returns a TranslatableMarkup object.
Comment #4
lucian.gutoiu commentedComment #5
goz commentedAdd @return type
\Drupal\Core\StringTranslation\TranslatableMarkup.Also replace 'The translated string.' in @return comment from translate method in
\Drupal\Core\StringTranslation\TranslationInterface.Comment #6
sdstyles commentedComment #7
goz commentedGood job @all
Comment #8
jhodgdonGood idea to fix up these docs! But:
This is not accurate. The returned object is not yet translated when it is returned. The point of that return value (one of them anyway) is that translation is done later.
Same in the other hunk.
Comment #9
snehi commentedi think
will work or
Comment #10
jhodgdonA is better than The here, I think.
Comment #11
goz commented35 occurrences for "A something object" in comments based on regex
@return [a-zA-Z/\\]*\n \* A [a-zA-Z]+ object122 occurrences for "The something object" in comments based on regex
@return [a-zA-Z/\\]*\n \* The [a-zA-Z]+ objectI prefer The because we ask for the translation of the string passed as param (and not a random translation from many possible translations). So we return the translatableMarkup.
Comment #12
jhodgdon"The" requires an antecedent, and "A" is for introducing a new thing, grammatically. There are plenty of cases where "the" is appropriate to start a @return, like "The input $foo, transformed by bar baz.".
But in this case, the object doesn't exist before this function call. So the return docs should be something like:
A new foobar object that, when cast to a string, will result in the translated string.
Comment #13
snehi commentedDone as suggested by @jhodgdon
Comment #14
jhodgdonNot really what I suggested?
Comment #15
anil280988 commentedHi Jhodgdon,
Made the changes.
Comment #16
chi commentedThe type of the return value is missing.
Why 'Markup' but not 'TranslatableMarkup'?
Comment #17
goz commentedComment #18
anil280988 commentedDone as suggested by @Chi
Comment #20
chi commentedThe type of return value is still missing.
Comment #21
anil280988 commentedHi Chi,
Made the changes
Comment #23
anil280988 commentedHi Chi,
Made the changes
Comment #24
chi commentedI would remove 'new'. Nearly all Drupal functions and methods return something new. Since there is no 'old' TranslatableMarkup object in this context 'new' looks redundant for me.
Comment #25
jhodgdonIt's technically meaningful to say "new" actually... not a bad idea... I think this is fine. Thanks!
Comment #28
yesct commentedcool. it is great to find this being fixed.
I had a similar change in #2578377: Make translatable docs consolidated and better for developers
but used slightly different words "An object that, when cast to a string, will yield the translated string."
Comment #29
alexpottI like @YesCT's version - fixed on commit. Committed fd6f9cb and pushed to 8.0.x. Thanks!