Skip to content
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

Improve the text version of a location message #7554

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/views/location/LocationButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ export function textForLocation(
): string {
const date = new Date(ts).toISOString();
if (description) {
return `Location "${description}" ${uri} at ${date}`;
return `Shared location "${description}" (${uri} at ${date})`;
} else {
return `Location ${uri} at ${date}`;
return `Shared their location (${uri} at ${date})`;
Comment on lines +122 to +124
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably be internationalised, no?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be very jarred if I send a location on Web in Polish and open it on my phone and some random english text is shown instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's intentionally not internationalised, because the reader will be on a different client, with potentially-different locale.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the text description of the event, right? I don't really feel like Shared their location... is a good text representation.

I already have a PR (#7552) to fix the notifications

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fallback textual description, we normally internationalise them. Like if you're sending a file without a name we say Attachment in your own language, not always in English.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, thanks I was obviously misinformed. Sorry for missing your change Simon, it looks much better!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, thanks I was obviously misinformed. Sorry for missing your change Simon, it looks much better!

No worries!

}
}

Expand Down
4 changes: 2 additions & 2 deletions test/components/views/location/LocationButton-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ describe("LocationButton", () => {
describe("textForLocation", () => {
it("with no description, simply dumps URI and date", () => {
expect(textForLocation("geo:43.2,54.6", 12345, null)).toBe(
"Location geo:43.2,54.6 at 1970-01-01T00:00:12.345Z");
"Shared their location (geo:43.2,54.6 at 1970-01-01T00:00:12.345Z)");
});

it("with a description, includes that in the text", () => {
expect(textForLocation("geo:12,43,3;u=2", 54321, "Me!")).toBe(
'Location "Me!" geo:12,43,3;u=2 at 1970-01-01T00:00:54.321Z');
'Shared location "Me!" (geo:12,43,3;u=2 at 1970-01-01T00:00:54.321Z)');
});
});
});