-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client spec v1.2: new --language flag, BCP47 to POSIX and other clarifications #3168
Conversation
Also, should we perhaps add in a clause that says that clients should mention what version of this spec they implement in their readmes? |
CLIENT-SPECIFICATION.md
Outdated
@@ -38,6 +42,7 @@ Argument | Required? | Meaning | |||
`-p`, `--platform` | Yes | Specifies the platform to be used to perform the action (either listing or searching). If this option is specified, the selected platform MUST be checked first instead of the current platform as described below. | |||
`-u`, `--update` | Conditional | Updates the offline cache of pages. MUST be implemented if cache is supported. | |||
`-l`, `--list` | No | Lists all the pages in the current platform to the standard output. If the special platform `all` is specified a list of all pages in all platforms MUST be displayed. | |||
`--language` | Yes | Specifies the preferred language for the page returned. Overrides the `LANG` environment variable - see the [section on translations](#translations) for more information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh .. -l
is already taken. Have you thought of choosing some other single letter to have a single letter flag ? I don't know .. maybe -e, -g ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good idea. Not sure what to choose that would make sense, actually.
As far as I am concerned, having a language flag is not necessary. Most (if not all) command line programs I've seen that support localization use environment variables to detect the language. See for example We should ask clients to automatically detect language (as we already do), with an additional encouragement to make it configurable for the user (via configuration files or command-line options), but I would not suggest it as a must have feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per what I just said, I would suggest the following change (see below).
I would also suggest adding the following paragraph in the Language
section:
If possible, it is recommended to not only rely on the environment, but also make language configurable. Clients SHOULD therefore offer options to configure or override the language using configuration files or command line arguments (like
-L, --language
suggested in the arguments section above).
Co-Authored-By: Marco Bonelli <[email protected]>
Great point, @mebeim. Ideally we want to encourage the user to use the environment variable, since that's a generally accepted standard. Should we keep the |
@sbrl yes, like I said I think we should encourage to have such flag or a config file, but not make it a must have feature. |
Hi all! This thread has not had any recent activity. Are there any updates? Thanks! |
in progress |
@sbrl tldr-sharp had language support since 1.2.0 ;) |
acae6fb
to
143a127
Compare
As promised in #3183 (comment), I've integrated in this PR the changes regarding language and language tags (or, more precisely, locale tags), and I've changed the title accordingly. Since I believe that having fewer versions is better to avoid confusion, I also integrated some other changes. I think this PR should be rebased in order to maintain the meaningfulness of the commits, but it could be also squashed: in such case please use the summary I'm adding below. Forgive the force-pushing, you can still see the commit history clearly from the relative tab. Here's a summary of what happens in version 1.2 of the client specification:
I would suggest reading the whole document when reviewing, other than checking commits singularly, since changes are basically all around the document. NOTE: this should be merged only after the changes discussed in #3183 are addressed. In other words, let's first apply the renaming of the folders and the change of the spec before updating the client spec as to not create confusion. As I already said in #3183, I will take care of this in a separate PR as soon as I can. Either way I'm waiting some time to see what you guys think about this before going further. |
Just gave some minor comments. Looks good otherwise.
Which other spec did you mean ? |
@agnivade sorry, bad wording, not really a "spec", I was talking about CONTRIBUTING.md, we still talk about BCP-47 there. I will update it along with folder names in another PR. Line 78 in 4445f03
Fixed the typos. |
143a127
to
1cf1e7b
Compare
Got it. Thanks. |
Some thought I just had, what is more important, platform or language? But maybe we should look for Linux and common first for each language before going to the next language? |
@principis I thought lookup should be like this:
BUT that's a good question... now that you make me think about it I think it would make more sense for the platform to be more important. This is a "problem" we have because |
Hrm, that is indeed an issue. Looks like we've got 2 options:
I'd probably say platform-first is the better option:
|
@sbrl yes, that's what I was thinking. Platform first makes more sense. We cannot do much except having |
(So I wrote a long explanation but then had to leave and now it's gone...) I think language-first really shouldn't be implemented (depends on how you do it). It could for example show a Platform-first doesn't have this problem. |
@principis yes I agree that platform first is really the only one which makes sense, and I also agree that it should be in the spec at least as a "SHOULD" or "RECOMMENDED" clause. I will add it to this PR as soon as I can. Language-first could cause problems for users in situations like the one you just explained. |
Hi all! This thread has not had any recent activity. Are there any updates? Thanks! |
Welp, I almost forgot about this, thank you @probot 😅 I pushed the last commit applying @principis suggestions. After this, it should be pretty much ready to merge. Let me know what you guys think. |
Ping @agnivade, looks fine to merge for me. Any comments? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a big PR and I'm basically co-author of the PR I'll leave to someone else to merge. It should be fine rebased rather than squashed. If you really want to squash please keep a bullet point list of the changes in the extended commit message!
Apparently I can't approve my own PR, but this looks fine to me :D |
We should have some way of @mentioning all client authors at once. |
(I really need to fix my notifications... Didn't see this.) it's too late but still, looks good, thanks! |
As per the discussion in #3161, this PR adds a new required
--language
CLI argument to the spec. Once clients have good support for it, we may consider updating the tldr page for tldr (though we should be careful to mention there that pages are returned in the system language by default).Ping @pepa65 (tldr-bash-client, has language support already), @elecprog (elecprog/tldr, also has language support), @felixonmars (tldr-python-client), @agnivade (tldr-node-client) - please feel free to @mention anyone else who maintains a client that I've missed (I'm probably missing a bunch).