-
Notifications
You must be signed in to change notification settings - Fork 357
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
Bug 1480819: Fix labels for Scale Infrastructure Provider form #4896
Conversation
app/helpers/ems_infra_helper.rb
Outdated
field_name = param_name.dup | ||
field_name.sub!("Count", "") | ||
field_name.sub!("::count", "") | ||
"Number of #{field_name.underscore.humanize.titleize} Hosts" |
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 see this is not i18n. Should we i18n at least line 8?
Ping @mzazrivec
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.
That's one thing I wondered about, but it wasn't clear to me what's normally done here when the text is dynamic like this -- would we just translate the static part and just interpolate the dynamic text?
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.
Is the set of possible values of field_name
finite? If so, it would be worth to resolve this with a case
like:
case filed_name
when 'value1'
_('Number of such and such hosts')
when 'value2'
_('Number of such and such and such hosts')
...
end
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.
For OpenStack it's a finite list. I imagine it's similar for any other providers that use this screen. While this would resolve the translation problem, it would introduce a couple of potential downsides:
- It introduces provider-specific text in the UI (Ceph, Compute, Controller, etc.) -- I know that in the past there has been some resistance to this, but perhaps if it's only strings and not classnames or other logic it's fine here.
- Other provider teams would need to review this as well to see what field_name values will be needed for their own providers
In any case, I imagine if we do this we'll still want to use the current automated generation of field name from this PR as a fallback for any field name values that are not found in the list. With the fallback in place, I can ignore other providers and just include the OpenStack fields, so nothing breaks for other use cases -- then, in subsequent PRs the other provider teams can supply any missing fields.
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.
@mzazrivec Hi, any thoughts on @sseago's comment?
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.
Yes, I think doing
case filed_name
when 'value1'
_('Number of openstack type1 hosts')
when 'value2'
_('Number of openstack type2 hosts')
else
_("Number of %{host_type} Hosts") % {:host_type => field_name.underscore.humanize.titleize}
...
end
is perfectly fine here.
fixes https://bugzilla.redhat.com/show_bug.cgi?id=1480819 This commit changes the labels on the Scale Infrastructure Provider form from the user-unfriendly parameter names (i.e. "ControllerCount") to more descriptive labels (i.e. "Number of Controller Hosts").
Checked commit sseago@24509ed with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
fixes https://bugzilla.redhat.com/show_bug.cgi?id=1480819
This commit changes the labels on the Scale Infrastructure Provider form
from the user-unfriendly parameter names (i.e. "ControllerCount") to
more descriptive labels (i.e. "Number of Controller Hosts").