Wrong translation of README selected by default

's Avatar

dan.j.allen

23 Mar, 2019 07:49 AM

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?

See https://www.rubydoc.info/gems/asciidoctor/2.0.0

  1. Support Staff 1 Posted by lsegal on 23 Mar, 2019 08:00 AM

    lsegal's Avatar

    Sure thing!

    By default, YARD picks the first matching README file as part of the README* glob. You can override the README file by specifying a first extra file or using --readme README.adoc in your .yardopts file.

    Hope that helps!

  2. 2 Posted by Dan Allen on 23 Mar, 2019 08:25 AM

    Dan Allen's Avatar

    Thanks for the quick reply.

    > You can override the README file by specifying a first extra file or using --readme README.adoc in your .yardopts file.

    I do that already. https://github.com/asciidoctor/asciidoctor/blob/master/.yardopts

    Do I have to include the .yardopts file in the gem?

  3. Support Staff 3 Posted by lsegal on 23 Mar, 2019 08:30 AM

    lsegal's Avatar

    Yes, the .yardopts must be packaged with the gem for rubydoc to pick it up for gem docs hosting.

  4. 4 Posted by Dan Allen on 23 Mar, 2019 08:32 AM

    Dan Allen's Avatar

    Argh. That means there's no way for me to fix it for any gem already released.

    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).

  5. Support Staff 5 Posted by lsegal on 23 Mar, 2019 11:33 PM

    lsegal's Avatar

    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

    I think this conversation would be better had as an issue YARD itself (https://github.com/lsegal/yard/issues). I think I'd be open to discussions about how globs are sorted so as to choose a more reliable default, but we couldn't exclude README-* 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 README and README.* ahead of other README files would be considered.

  6. 6 Posted by Dan Allen on 24 Mar, 2019 12:11 AM

    Dan Allen's Avatar

    I can follow up there.

    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.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac