tag:rubydoc.tenderapp.com,2010-12-26:/discussions/problems/654-wrong-translation-of-readme-selected-by-defaultRubydoc.info: Discussion 2019-03-24T00:22:15Ztag:rubydoc.tenderapp.com,2010-12-26:Comment/471053242019-03-23T07:49:21Z2019-03-23T07:49:22ZWrong translation of README selected by default<div><p>The README for the asciidoctor gem is being displayed in Japanese instead of English. This is happening because the README-jp.adoc file is being used instead of README.adoc. Unfortunately, most visitors expect the README to be in English. Can you please tell me how I can fix this problem?</p>
<p>See <a href="https://www.rubydoc.info/gems/asciidoctor/2.0.0">https://www.rubydoc.info/gems/asciidoctor/2.0.0</a></p></div>tag:rubydoc.tenderapp.com,2010-12-26:Comment/471053242019-03-23T08:00:29Z2019-03-23T08:00:29ZWrong translation of README selected by default<div><p>Sure thing!</p>
<p>By default, YARD picks the first matching README file as part of the <code>README*</code> glob. You can override the README file by specifying a first extra file or using <code>--readme README.adoc</code> in your <code>.yardopts</code> file.</p>
<p>Hope that helps!</p></div>lsegaltag:rubydoc.tenderapp.com,2010-12-26:Comment/471053242019-03-23T08:25:51Z2019-03-23T08:25:51ZWrong translation of README selected by default<div><p>Thanks for the quick reply.</p>
<blockquote>
<p>You can override the README file by specifying a first extra file or using --readme README.adoc in your .yardopts file.</p>
</blockquote>
<p>I do that already. <a href="https://github.com/asciidoctor/asciidoctor/blob/master/.yardopts">https://github.com/asciidoctor/asciidoctor/blob/master/.yardopts</a></p>
<p>Do I have to include the .yardopts file in the gem?</p></div>Dan Allentag:rubydoc.tenderapp.com,2010-12-26:Comment/471053242019-03-23T08:30:13Z2019-03-23T08:30:13ZWrong translation of README selected by default<div><p>Yes, the <code>.yardopts</code> must be packaged with the gem for rubydoc to pick it up for gem docs hosting.</p></div>lsegaltag:rubydoc.tenderapp.com,2010-12-26:Comment/471053242019-03-23T08:32:23Z2019-03-23T08:32:24ZWrong translation of README selected by default<div><p>Argh. That means there's no way for me to fix it for any gem already released.</p>
<p>Is there any chance you'd be willing to change the glob to only match the basename README (keeping the wildcard only on the file extension)? Surely that's the behavior users expect. (That's also consistent with how other systems work, like npm and yarn).</p></div>Dan Allentag:rubydoc.tenderapp.com,2010-12-26:Comment/471053242019-03-23T23:33:52Z2019-03-23T23:33:52ZWrong translation of README selected by default<div><blockquote>
<p>Is there any chance you'd be willing to change the glob to only match the basename README (keeping the wildcard only on the file extension)? Surely that's the behavior users expect</p>
</blockquote>
<p>I think this conversation would be better had as an issue YARD itself (<a href="https://github.com/lsegal/yard/issues">https://github.com/lsegal/yard/issues</a>). I think I'd be open to discussions about how globs are <em>sorted</em> so as to choose a more reliable default, but we couldn't exclude <code>README-*</code> files from the glob altogether, since that would be a breaking change, and likely not the expected behavior either. If you're interested, a PR to sort <code>README</code> and <code>README.*</code> ahead of other README files would be considered.</p></div>lsegaltag:rubydoc.tenderapp.com,2010-12-26:Comment/471053242019-03-24T00:11:01Z2019-03-24T00:11:02ZWrong translation of README selected by default<div><p>I can follow up there.</p>
<p>What's the use case for only having README files with a hyphenated suffix? Obviously, there may be additional files with a suffix for translations, but why would you ever want those to be selected anyway? The only case I can think of is someone adds the "-en" suffix to the English version instead of using the basename README. But that seems highly unlikely. Perhaps I'm just not aware of this practice.</p></div>Dan Allen