i18n: Localize date and time displays across the app.

Implemented date localization using native Intl object.
Created special function get_localized_date_or_time_for_format
Made necessary string formatting changes in 'timerender.ts'.
Fixed tests and added some localization tests too.

Tested on my local development server, with some random languages.

Fixes #23987.
This commit is contained in:
Daniil Fadeev
2023-01-08 20:08:49 +03:00
committed by Tim Abbott
parent fe654b76b7
commit a0d15f3029
11 changed files with 321 additions and 102 deletions

View File

@@ -520,28 +520,28 @@ test("format_drafts", ({override_rewire, mock_template}) => {
dark_background: "",
topic: "topic",
raw_content: "Test stream message",
time_stamp: "7:55 AM",
time_stamp: "7:55AM",
},
{
draft_id: "id2",
is_stream: false,
recipients: "Aaron",
raw_content: "Test private message",
time_stamp: "Jan 30",
time_stamp: "Jan 30",
},
{
draft_id: "id5",
is_stream: false,
recipients: "Aaron",
raw_content: "Test private message 3",
time_stamp: "Jan 29",
time_stamp: "Jan 29",
},
{
draft_id: "id4",
is_stream: false,
recipients: "Aaron",
raw_content: "Test private message 2",
time_stamp: "Jan 26",
time_stamp: "Jan 26",
},
{
draft_id: "id3",
@@ -551,7 +551,7 @@ test("format_drafts", ({override_rewire, mock_template}) => {
dark_background: "",
topic: "topic",
raw_content: "Test stream message 2",
time_stamp: "Jan 21",
time_stamp: "Jan 21",
},
];
@@ -658,21 +658,21 @@ test("filter_drafts", ({override_rewire, mock_template}) => {
is_stream: false,
recipients: "Aaron",
raw_content: "Test private message",
time_stamp: "Jan 30",
time_stamp: "Jan 30",
},
{
draft_id: "id5",
is_stream: false,
recipients: "Aaron",
raw_content: "Test private message 3",
time_stamp: "Jan 29",
time_stamp: "Jan 29",
},
{
draft_id: "id4",
is_stream: false,
recipients: "Aaron",
raw_content: "Test private message 2",
time_stamp: "Jan 26",
time_stamp: "Jan 26",
},
];
@@ -685,7 +685,7 @@ test("filter_drafts", ({override_rewire, mock_template}) => {
dark_background: "",
topic: "topic",
raw_content: "Test stream message",
time_stamp: "7:55 AM",
time_stamp: "7:55AM",
},
{
draft_id: "id3",
@@ -695,7 +695,7 @@ test("filter_drafts", ({override_rewire, mock_template}) => {
dark_background: "",
topic: "topic",
raw_content: "Test stream message 2",
time_stamp: "Jan 21",
time_stamp: "Jan 21",
},
];