Using built-in dialog box for notifications


I’d like to display custom warning messages by triggering Jitsi-Meet built-in dialog box.
I found the function below but I believe that descriptionKey and titleKey values should be added to lang/main.json.

APP.UI.messageHandler.showWarning({descriptionKey:"Warning Description",titleKey:"Test"})

is there any way to show this box without “main :” prefix in each string and without editing language files ?



I added a custom string manually in lang/main.json file.

~$ grep myCustomTitle /usr/share/jitsi-meet/lang/main.json 
    "myCustomTitle":"My custom title",

then I called it with the command below

APP.UI.messageHandler.showWarning({titleKey:'myCustomTitle', descriptionKey:""});

and Here’s the result

My Jitsi’s current language is French but normally it will display myCustomTitle from main.json file if it doesn’t find it in main-fr.json, right ?

any idea why it’s not working ?

The notification component is set up to always take in translation strings and raw strings. This is where the notification content is put in: This is where the notification content is put in:

Notice how a raw title can already be set by passing in { title, description } instead of { titleKey, descriptionKey }. That’s at least how I’m reading it.

And yes, there is a fallback language if the current language does not have the translation. (Although, I think there’s a potential bug there because the fallback language is fetched by converting the object LANGUAGES_RESOURCES to an array, but object key order is not guaranteed. It probably works by coincidence because browsers are generally nice about converting objects into arrays based on order of addition…)

As for why it’s not working for you, I don’t know. Did you nest the new key within another object in main.json?

Thanks, I will use title and description instead of titleKey and descriptionKey
APP.UI.messageHandler.showWarning({title:'My Title', description:"My Message"});

Yeah It doesn’t work, maybe there’s a bug as you said…

Thank you for your help.