i18n getmessage to translate radio button text in an object

I’m working to translate a self-made extension.
I have a problem with that code :

let radiosCapture = {
  "Capture a page": () => {
    this.capture = new CaptureLink(this);
    let description = document.querySelector('meta[name="description"]');
    if (description) {
      this.capture.description = description.content;
    }
    this.capture.start_capture();
  },

  "Capture an area": () => {
    this.capture = new CaptureZone(this);
    this.capture.start_capture();
  }
};

I can’t find how to change property of radiosCapture object to inject a translated string based on my json language with `browser.i18n.getMessage("choice_capture");
I would like to replace "Capture a page" by a string from my i18n getmessage function.

Source: Ask Javascript Questions

LEAVE A COMMENT