mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
realm_playground: Use Intl.ListFormat rather than .join(",").
Fixes: #26936 Co-authored by: CIC4DA <dhruv.jain9100@gmail.com>
This commit is contained in:
committed by
Tim Abbott
parent
6c6d5fbb6a
commit
b9c037e0ee
@@ -6,6 +6,7 @@ import * as typeahead from "../shared/src/typeahead.ts";
|
||||
import {$t} from "./i18n.ts";
|
||||
import * as pygments_data from "./pygments_data.ts";
|
||||
import type {realm_playground_schema} from "./state_data.ts";
|
||||
import * as util from "./util.ts";
|
||||
|
||||
export type RealmPlayground = z.output<typeof realm_playground_schema>;
|
||||
|
||||
@@ -87,7 +88,8 @@ export function get_pygments_typeahead_list_for_settings(query: string): Map<str
|
||||
}
|
||||
|
||||
for (const [key, values] of map_pygments_pretty_name_to_aliases) {
|
||||
language_labels.set(key, key + " (" + values.join(", ") + ")");
|
||||
const formatted_string = util.format_array_as_list_with_conjuction(values, "narrow");
|
||||
language_labels.set(key, key + " (" + formatted_string + ")");
|
||||
}
|
||||
|
||||
return language_labels;
|
||||
|
||||
@@ -9,6 +9,7 @@ const {$t} = zrequire("i18n");
|
||||
const pygments_data = zrequire("pygments_data");
|
||||
const realm_playground = zrequire("realm_playground");
|
||||
const typeahead_helper = zrequire("typeahead_helper");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
run_test("get_pygments_typeahead_list_for_composebox", () => {
|
||||
// When no Code Playground is configured, the list of candidates should
|
||||
@@ -45,6 +46,8 @@ run_test("get_pygments_typeahead_list_for_composebox", () => {
|
||||
});
|
||||
|
||||
run_test("get_pygments_typeahead_list_for_settings", () => {
|
||||
initialize_user_settings({user_settings: {}});
|
||||
|
||||
const custom_pygment_language = "custom_lang";
|
||||
const playground_data = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user