-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Translate security/roles component #23984
Translate security/roles component #23984
Conversation
💔 Build Failed |
💔 Build Failed |
retest |
💔 Build Failed |
<EuiLink onClick={this.toggleCollapsed}>{this.state.collapsed ? 'show' : 'hide'}</EuiLink> | ||
<EuiLink onClick={this.toggleCollapsed}> | ||
{this.state.collapsed | ||
? intl.formatMessage({ |
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.
You can use FormattedMessage here. So you do not need to use injectI18n
{this.state.collapsed | ||
? intl.formatMessage({ | ||
id: | ||
'xpack.security.views.management.editRoles.components.collapsiblePanel.showTitle', |
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.
showTitle => showLinkText
}) | ||
: intl.formatMessage({ | ||
id: | ||
'xpack.security.views.management.editRoles.components.collapsiblePanel.hideTitle', |
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.
hideTitle => hideLinkText
if (!this.state.showModal) { | ||
return null; | ||
} | ||
return ( | ||
<EuiOverlayMask> | ||
<EuiConfirmModal | ||
title={'Delete Role'} | ||
title={intl.formatMessage({ |
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.
Check if title property supports JSX. I mean try to use FormattedMessage. If it works, then do not use injectI18n
@@ -35,29 +36,55 @@ export class DeleteRoleButton extends Component<Props, State> { | |||
return ( | |||
<Fragment> | |||
<EuiButtonEmpty color={'danger'} onClick={this.showModal}> | |||
Delete role | |||
<FormattedMessage | |||
id="xpack.security.views.management.editRoles.components.deleteRoleButton.deleteRoleButton" |
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.
=> deleteRoleButtonLabel
i18n('xpack.security.views.management.roles.deleteRoleTitle', { | ||
values: { | ||
valueText: $scope.selectedRoles.length > 1 ? | ||
i18n('xpack.security.views.management.roles.deleteRoleRolesTitle', { defaultMessage: 'roles' }) |
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.
deleteRoleRolesTitle => rolesSuccessfullyDeletedNotificationMessage
.then(() => toastNotifications.addSuccess( | ||
i18n('xpack.security.views.management.roles.deleteRoleTitle', { | ||
values: { | ||
valueText: $scope.selectedRoles.length > 1 ? |
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.
use plural from ICU format for such cases. Come to me and I'll show you how to do it
@@ -45,12 +55,14 @@ routes.when(ROLES_PATH, { | |||
}); | |||
}; | |||
const confirmModalOptions = { | |||
confirmButtonText: 'Delete role(s)', | |||
confirmButtonText: i18n('xpack.security.views.management.roles.deleteRoleButton', { defaultMessage: 'Delete role(s)' }), |
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.
deleteRoleButton => deleteRoleConfirmButtonLabel
confirmModalOptions | ||
confirmModal( | ||
i18n('xpack.security.views.management.roles.sureToDeleteRoleTitle', { | ||
defaultMessage: 'Are you sure you want to delete the selected role(s)? This action is irreversible!' |
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.
sureToDeleteRoleTitle => deletingRolesWarningMessage
@@ -85,5 +97,9 @@ routes.when(ROLES_PATH, { | |||
function getActionableRoles() { | |||
return $scope.roles.filter((role) => !role.metadata._reserved); | |||
} | |||
|
|||
$scope.noFoundMatches = i18n('xpack.security.views.management.roles.noMatches', { |
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.
noMatches => matchingText
💔 Build Failed |
this.props.editable | ||
? intl.formatMessage({ | ||
id: | ||
'xpack.security.views.management.editRoles.components.privileges.es.elasticSearchPrivileges.addUserTitle', |
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.
addUserTitle => addUserPlaceholder
This role always grants read access to all spaces. To customize privileges for | ||
individual spaces, you must create a new role. | ||
<FormattedMessage | ||
id="xpack.security.views.management.editRoles.components.privileges.kibana.privilegeCalloutWarning.alwaysGrantReadRoleTitle" |
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.
not fixed
This role never grants access to any spaces within Kibana. To customize privileges for | ||
individual spaces, you must create a new role. | ||
<FormattedMessage | ||
id="xpack.security.views.management.editRoles.components.privileges.kibana.privilegeCalloutWarning.roleNeverAccessTitle" |
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.
not fixed
class="kuiTableHeaderCell__liner" | ||
i18n-id="xpack.security.views.management.roles.roleTitle" | ||
i18n-default-message="Role {icon}" | ||
i18n-values="{ |
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.
after #23684 is merged we will need to name properties which contain angular directives with unsafe_
prefix. So please check all places in this MR where you use i18n-values and if property contains directives - use prefix unsafe_
.
for example icon => unsafe_icon
.then(() => | ||
toastNotifications.addSuccess( | ||
i18n('xpack.security.views.management.roles.deleteRoleTitle', { | ||
defaultMessage: 'Deleted {value, plural, one {# role} other {# roles}}', |
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.
remove #, just {role} other {roles}
💔 Build Failed |
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.
LGTM
💔 Build Failed |
💔 Build Failed |
💔 Build Failed |
helptext = 'View, edit, and share objects and apps within all spaces'; | ||
helptext = intl.formatMessage({ | ||
id: | ||
'xpack.security.views.management.editRoles.components.privileges.kibana.spaceAwarePrivilegeForm.viewEditShareAppsWithinAllSpacesHelpText', |
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.
@azasypkin it'd be neat if the first part of these keys could be inferred by the component tree context so you could do something like:
intl.formatMessage({
id: `spaceAwarePrivilegeForm.viewEditShareAppsWithinAllSpacesHelpText`
defaultMessage: '...'
});
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.
xpack.security.views.management.editRoles.components.privileges.kibana.spaceAwarePrivilegeForm.viewEditShareAppsWithinAllSpacesHelpText
Ugh, I believe it's a bad id: it's too detailed and contains a bunch of useless info (views
?, editRoles
implies both views
and management
, components
is useless and doesn't say anything, privilges.kibana
- seems to be useless since we have spaceAwarePrivilegeForm
), we should have more laconic and useful ids. Why not just something like this?
Rule: {plugin}.{area}.[{sub-area}].{element}
Example: {xpack.security}.{editRoles}.{spaceAwarePrivilegeForm}.{viewEditShareAppsWithinAllSpacesHelpText}
I doubt that we'll have collision with this shorter form. @pavel06081991 @maryia-lapata thoughts?
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.
yeah, agree. we will use it for all new ids
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.
LGTM after removing these lines
@@ -131,7 +176,15 @@ export class RoleValidator { | |||
if (privilege) { | |||
return valid(); | |||
} | |||
return invalid('Privilege is required'); | |||
// return invalid('Privilege is required'); |
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.
remove?
@@ -137,7 +159,12 @@ export class PrivilegeSpaceTable extends Component<Props, State> { | |||
]; | |||
if (!this.props.readonly) { | |||
columns.push({ | |||
name: 'Actions', | |||
// name: 'Actions', |
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.
remove?
💔 Build Failed |
💔 Build Failed |
💔 Build Failed |
💔 Build Failed |
retest |
💔 Build Failed |
💔 Build Failed |
💔 Build Failed |
💔 Build Failed |
💔 Build Failed |
💔 Build Failed |
retest |
💔 Build Failed |
retest |
💚 Build Succeeded |
Translate security/roles component
Translation of Security Roles visualization components