-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add helper for getting resource descriptors #6
base: main
Are you sure you want to change the base?
Conversation
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.
👋 ! Just some clarification questions on my part
systemLanguageCode: string, | ||
): [string, string] => { | ||
if (!data) { | ||
return ["None", "None"]; |
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.
Why not throw an error here? ["None", "None"]
seems like an odd thing to return
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 was assuming (perhaps wrongly) that my suggestion in #5 would be implemented and was following that pattern. However, as it stands now, In getItemLabel above, we return empty string if the label isn't found. I would imagine that it's valid for resources to not always have descriptors (depending on the data model), so we should provide a fall-back value (whether "" or "None") rather than erroring?
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 guess a "None"
string is a bit odd for me. I'd either expect this to be null
, or an empty string.
As far as if it's better to throw an error or not -- I'm not sure. I'm happy to move forward with fallback values and change later if it ends up biting us
803a496
to
29aaf32
Compare
… val for system lang
Placeholder pr - could become a function that returns strings from localized objects based on system language code or preferred language code.