-
-
Notifications
You must be signed in to change notification settings - Fork 407
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
ember new --lang
#635
ember new --lang
#635
Conversation
Co-authored-by: Jamie White <jameswhite@salesforce.com>
Co-authored-by: Jamie White <jameswhite@salesforce.com>
Co-authored-by: Jamie White <jameswhite@salesforce.com>
Co-authored-by: Melanie Sumner <melaniersumner@gmail.com>
Co-authored-by: Melanie Sumner <melaniersumner@gmail.com>
What happens if no Can a default lang setting be set in |
text/0000-ember-new-lang.md
Outdated
Unrecognized language subtag, "uk". | ||
``` | ||
|
||
#### No argument passed |
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.
IMO, this is just a "bug" / limitation of the command line argument parser used by Ember CLI. This RFC introduces a new named argument that takes a string value. If you didn't pass a value, it should be an error. If a second named argument follows it, it should not be parsed as the value. Basically it should work the same as --blueprint
or anything else like it.
I think it's fine to implement whatever workaround is needed, but I'm not sure it needs to be included in the RFC. It's fine to include it for additional information, I suppose, but it shouldn't be considered "normative". Once we fix any bugs or limitations in the arguments parsing, this section will become obsolete.
TL;DR I don't think the RFC should be or is propose a permeant special error handling of this particular CLI argument.
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.
I think it's fine to implement whatever workaround is needed, but I'm not sure it needs to be included in the RFC.
Ya, agreed (RE: this being a bug).
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.
@chancancode @rwjblue I'm sure we're willing to incorporate feedback for what in ember-cli is a bug and what's intended to be there- I mostly assume that the things that are there are intended to be there unless there are code comments that indicate otherwise.
text/0000-ember-new-lang.md
Outdated
See `ember <command> help` for more information. | ||
``` | ||
|
||
#### Common Misunderstandings: Programming Languages |
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.
IMO this is just a special case of the "Invalid Language Codes". In implementation speak:
let lang;
try {
// validateLangFlag checks against the ISO 3166 list
lang = validateLangFlag(langFlag);
} catch(e) {
if (isProgrammingLanguage(langFlag)) {
throw new Error("specific error message about how this flag is not doing what you think");
} else {
throw new Error("generic error message about how this is not a valid language");
}
}
In the unlikely case that they overlap (that it is both a valid language and a programming language) I think it's okay to print a warning, but probably shouldn't fail the build and disallow what is technical a valid input.
text/0000-ember-new-lang.md
Outdated
An error with the `--lang` flag returned the following message: | ||
Detected lang specification starting with command flag `-`. | ||
Is `--skip-git` meant to be an ember-cli command option? | ||
This issue is likely caused by using the `--lang` flag without a specification. |
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.
Again I think this shouldn't be in the normative part of the RFC anyway, but IMO this is working around a bug in the argument parsing, so exposing this much information about the limitation/bug/workaround in our argument parsing is more confusing to the user than it is helpful.
IMO, I think both of these cases should show something short like "The --lang
flag requires a valid language code, see ember <command> help for more information.". In the second example, the
--disable-analytics` bit is extra confusing, because it's not part of what the user typed and definitely a quirk of our internal argument parsing implementation.
Concretely, if the parsed value starts with a dash, I think it's just a bug in the parsing and we can show a message about the missing language code. Otherwise, we just validate against the ISO list.
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.
+1. I think a more consistent way to do this is when parse fails, print a message and either a descriptive help message with what the flag is for, or a link to a URL that has "common misunderstandings" if it is necessary. Trying to guess user intention is probably not going to scale very well.
That would be the current/default behavior (no
Like any other Ember CLI options, it can be set in |
Thank you everyone for doing the investigation and putting together! It's very well written. |
I don't think this is adequate. Ember needs to become accessible by default. Either a lang should be required or a default language selected. |
Nothing will happen. It will be the same as it is now.
Why? It needs to go in the index.html file on the HTML tag. |
It’s backwards compatible & I wouldn’t suggest anything else for the MVP. |
I agree with the general sentiment but this RFC is a step in the right direction and doesn't need to fix everything at once. This allows some developers (who are aware of the issue, and only support a single language in the app) to start using the feature, allows us to the start teaching it in the tutorial, etc. And subject to the caveats I mentioned above, you can even set it as a default in your In general, there a lot of other things like this that doesn't have a good, global default answer for everyone, but may have a good enough default answer for you. For example, in the case of
For a lot of these questions, there aren't necessarily one good answer for a lot of these questions, and right now our infrastructure is not really setup to accommodate that kind of stuff. For the We need a more general solution for these kind of things, probably something along the lines of an interactive A lot of these things are already in progress or on different people's radar. However, we don't have to block on those improvements to start making progress here. This is a good feature to add now, and when those other things get sorted out, they will just be implemented on top of what we started here. |
text/0000-ember-new-lang.md
Outdated
|
||
|
||
|
||
## How we teach this |
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.
Great work on this RFC! I enjoy how well reasoned it is and its focus.
For that reason, I would like to see the "How we teach this" section expanded with some of the knowledge in the motivation section. The "Testing it out" was particularly illumating to me as a content creator in understanding the implications of the lang
attribute.
We have a Language attribute section in the Ember Guides that could also be updated to mention the new flag?
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.
@locks yes, that seems correct. I’ll work on it. Thanks for the feedback!
Amazing work on this RFC :) Question: Would there be an error if the |
The |
Update to address feedback from @locks
Awesome job on the RFC, thanks a lot for putting this up. |
After discussion at Friday's core team meeting, we decided to move this into final comment period. 🗣️💬⌛ |
i agree, it is a step forward and I don't want to hold this up. I withdraw my objection. |
So should an app that uses |
@luxferresum
|
We discussed this in todays core team meeting and are good to go here 🥰 |
If the flag is used, would it make sense to output a console message on Right now it doesn't really do anything except setting a simple html attribute, so people may be disappointed that "it doesn't do more". That said, I don't think it needs to do more, internationalization is probably a better fit for an addon regardless. And ember-intl is an excellent addon! |
Rendered
Candidate Implementation
Original draft for preserving comment history