Poll WIP (#231):

* frontend message localization
This commit is contained in:
John Livingston
2024-07-04 17:39:40 +02:00
parent 3c45c2d1e6
commit 6f7c5c50f7
8 changed files with 49 additions and 5 deletions

View File

@ -17,6 +17,10 @@ const locContent: Map<string, string> = new Map<string, string>()
* - We are using keys to identify strings
* - the `loc` function gets the english segment for the key
* - the build-languages.js script builds all needed files.
*
* The loc function is also used to customize some labels on Prosody backend.
* The front-end will then replace english strings by their translation.
* (see mod_muc_poll for example).
* @param key The key to translate
*/
function loc (key: string): string {

View File

@ -5,6 +5,7 @@
import type { ProsodyFilePaths } from './paths'
import type { ExternalComponent } from './components'
import { BotConfiguration } from '../../configuration/bot'
import { loc } from '../../loc'
import { userInfo } from 'os'
/**
@ -536,6 +537,9 @@ class ProsodyConfigContent {
usePoll (): void {
this.muc.add('modules_enabled', 'muc_poll')
this.muc.set('poll_groupchat_votes_priority', 1000)
this.muc.set('poll_string_over', loc('poll_is_over'))
this.muc.set('poll_string_invalid_choice', loc('poll_choice_invalid'))
this.muc.set('poll_string_anonymous_vote_ok', loc('poll_anonymous_vote_ok'))
}
addMucAdmins (jids: string[]): void {