mirror of https://github.com/zulip/zulip.git
invite-user-modal: Internationalize custom time unit options.
Prep for using these values other modals, specifically the deactivate realm modal.
This commit is contained in:
parent
68dc914b6e
commit
cc1a3eeec1
|
@ -167,6 +167,11 @@ IGNORED_PHRASES = [
|
|||
r"deactivated",
|
||||
# This is a reference to a setting/secret and should be lowercase.
|
||||
r"zulip_org_id",
|
||||
# These are custom time unit options for modal dropdowns
|
||||
r"minutes",
|
||||
r"hours",
|
||||
r"days",
|
||||
r"weeks",
|
||||
]
|
||||
|
||||
# Sort regexes in descending order of their lengths. As a result, the
|
||||
|
|
|
@ -351,14 +351,13 @@ function open_invite_user_modal(e: JQuery.ClickEvent<Document, undefined>): void
|
|||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
const time_unit_choices = ["minutes", "hours", "days", "weeks"];
|
||||
const html_body = render_invite_user_modal({
|
||||
is_admin: current_user.is_admin,
|
||||
is_owner: current_user.is_owner,
|
||||
development_environment: page_params.development_environment,
|
||||
invite_as_options: settings_config.user_role_values,
|
||||
expires_in_options: settings_config.expires_in_values,
|
||||
time_choices: time_unit_choices,
|
||||
time_choices: settings_config.custom_time_unit_values,
|
||||
show_select_default_streams_option: stream_data.get_default_stream_ids().length !== 0,
|
||||
user_has_email_set: !settings_data.user_email_not_configured(),
|
||||
can_subscribe_other_users: settings_data.user_can_subscribe_other_users(),
|
||||
|
|
|
@ -545,6 +545,25 @@ export const expires_in_values = {
|
|||
},
|
||||
};
|
||||
|
||||
export const custom_time_unit_values = {
|
||||
minutes: {
|
||||
name: "minutes",
|
||||
description: $t({defaultMessage: "minutes"}),
|
||||
},
|
||||
hours: {
|
||||
name: "hours",
|
||||
description: $t({defaultMessage: "hours"}),
|
||||
},
|
||||
days: {
|
||||
name: "days",
|
||||
description: $t({defaultMessage: "days"}),
|
||||
},
|
||||
weeks: {
|
||||
name: "weeks",
|
||||
description: $t({defaultMessage: "weeks"}),
|
||||
},
|
||||
};
|
||||
|
||||
const user_role_array = Object.values(user_role_values);
|
||||
export const user_role_map = new Map(user_role_array.map((role) => [role.code, role.description]));
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<input type="text" autocomplete="off" name="custom-expiration-time" id="custom-expiration-time-input" class="custom-expiration-time inline-block" value="" maxlength="3"/>
|
||||
<select class="custom-expiration-time invite-user-select modal_select bootstrap-focus-style" id="custom-expiration-time-unit">
|
||||
{{#each time_choices}}
|
||||
<option name="custom_time_choice" class="custom_time_choice" value="{{this}}">{{this}}</option>
|
||||
<option name="custom_time_choice" class="custom_time_choice" value="{{this.name}}">{{this.description}}</option>
|
||||
{{/each}}
|
||||
</select>
|
||||
<p id="custom_expires_on"></p>
|
||||
|
|
Loading…
Reference in New Issue