Skip to content

Commit

Permalink
global: Fixes strings marked for translation.
Browse files Browse the repository at this point in the history
* Adds dots at the end of sentences.
* Removes dots where it isn't a sentence.
* Fixes tests to work with the new strings.

* Refs inveniosoftware/invenio-app-rdm#1707
  • Loading branch information
chriz-uniba committed Jun 9, 2022
1 parent 9a1e85a commit 823ec21
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ class RemoveMemberModal extends Component {
this.contentMap = {
[modalModeEnum.leave]: {
headerText: i18next.t("Leave community"),
bodyText: i18next.t("You're about to leave this community."),
bodyText: i18next.t("You are about to leave this community."),
buttonText: i18next.t("Leave"),
},
[modalModeEnum.remove]: {
headerText: i18next.t("Remove user"),
bodyText: i18next.t(
"You're about to remove this user from this community"
"You are about to remove this user from this community."
),
buttonText: i18next.t("Remove"),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export class SelectedMembers extends Component {
>
<Header disabled>
{displayingGroups
? i18next.t("Selected groups.")
: i18next.t("Selected members.")}
? i18next.t("Selected groups")
: i18next.t("Selected members")}
</Header>
</Segment>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class GroupTabPane extends Component {
/>
{selectedCount > 0 && (
<Trans key="communityInviteMembersSelected" count={selectedCount}>
You are about to add {{ selectedCount }} groups
You are about to add {{ selectedCount }} groups.
</Trans>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ export const memberVisibilityTypes = [
name: "public",
visible: true,
title: i18next.t("Public"),
description: i18next.t("Your community membership is visible to everyone") + ".",
description: i18next.t("Your community membership is visible to everyone."),
},
{
name: "hidden",
visible: false,
title: i18next.t("Hidden"),
description: i18next.t(
"Your community membership is only visible to other members of the community" + "."
),
"Your community membership is only visible to other members of the community."),
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class RenameCommunitySlugButton extends Component {
<Modal.Content>
<Form onSubmit={this.handleChange}>
<Form.Input
label={i18next.t("Enter the new unique identifier of the community")}
label={i18next.t("Enter the new unique identifier of the community.")}
fluid
input={{ ref: this.formInputRef }}
{...(error
Expand Down
2 changes: 1 addition & 1 deletion invenio_communities/communities/services/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def featured_create(self, identity, data=None, record=None, **kwargs):
"""Featured create."""
if record.access.visibility != "public":
raise ValidationError(
_("The community is not public"), field_name="community_id"
_("The community is not public."), field_name="community_id"
)


Expand Down
2 changes: 1 addition & 1 deletion invenio_communities/members/services/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class UpdateBulkSchema(MembersSchema, Schema):
def validate_schema(self, data, **kwargs):
"""Validates that role and/or visible is set."""
if "role" not in data and "visible" not in data:
raise ValidationError(_("Missing fields 'role' and/or 'visible'"))
raise ValidationError(_("Missing fields 'role' and/or 'visible'."))


class DeleteBulkSchema(MembersSchema):
Expand Down
6 changes: 3 additions & 3 deletions invenio_communities/members/services/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def _invite_factory(self, identity, community, role, visible, member, message, u
# add role as message
data = {
"payload": {
"content": _('You will join as "{role}"').format(role=role.title),
"content": _('You will join as "{role}".').format(role=role.title),
}
}
current_events_service.create(
Expand Down Expand Up @@ -488,7 +488,7 @@ def _update(self, identity, community, member, role, visible, uow):
if visible is not None and member.user_id is not None:
if visible and not (is_self or system_identity == identity):
raise ValidationError(
_("You can only set public visibility on your own " "membership."),
_("You can only set public visibility on your own membership."),
)

# Update membership
Expand All @@ -497,7 +497,7 @@ def _update(self, identity, community, member, role, visible, uow):
data = {
"payload": {
"content": _(
'You will join as "{role}" (changed from: "{previous}")'
'You will join as "{role}" (changed from: "{previous}").'
).format(
role=role.title,
previous=member.role,
Expand Down
2 changes: 1 addition & 1 deletion tests/members/test_members_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def test_invite(client, headers, community_id, owner, new_user_data, db):
assert r.status_code == 200
assert r.json["hits"]["total"] == 2 # role message + invite message
assert (
r.json["hits"]["hits"][0]["payload"]["content"] == 'You will join as "Reader"'
r.json["hits"]["hits"][0]["payload"]["content"] == 'You will join as "Reader".'
)
assert r.json["hits"]["hits"][1]["payload"]["content"] == new_user_data["message"]

Expand Down
2 changes: 1 addition & 1 deletion tests/members/test_members_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def test_invite_view_request(
).to_dict()
hits = res["hits"]
assert hits["total"] == 2 # role + invitation
assert hits["hits"][0]["payload"]["content"] == 'You will join as "Reader"'
assert hits["hits"][0]["payload"]["content"] == 'You will join as "Reader".'
assert hits["hits"][1]["payload"]["content"] == "Welcome to the club!"


Expand Down

0 comments on commit 823ec21

Please sign in to comment.