"Expected type string for argument 'domain' but got type undefined" error in gnome shell extension

I’m trying to run a gnome extension using the code from this guide Legacy Documentation | GNOME JavaScript
Ubuntu 22.04, GNOME 42.9, wayland

contents of extension.js (copied from the above link):

const St = imports.gi.St;

const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const Main = imports.ui.main;
const PanelMenu = imports.ui.panelMenu;

const {
gettext: _,
} = ExtensionUtils;


class Extension {
enable() {
    // Create a panel button
    this._indicator = new PanelMenu.Button(0.0, Me.metadata.name, false);

    // Add an icon
    const icon = new St.Icon({
        icon_name: 'face-laugh-symbolic',
        style_class: 'system-status-icon',
    });
    this._indicator.add_child(icon);

    // Add the indicator to the panel
    Main.panel.addToStatusArea(Me.metadata.uuid, this._indicator);

    // Add a menu item to open the preferences window
    this._indicator.menu.addAction(_('Preferences'),
        () => ExtensionUtils.openPrefs());

    this._count = 0;
}

disable() {
    if (this._indicator) {
        this._indicator.destroy();
        this._indicator = null;
    }
}
}


function init() {
ExtensionUtils.initTranslations();

return new Extension();
}

contents of metadata.json:

{
"uuid": "example@gjs.guide",
"name": "Example Extension",
"description": "An example extension",
"shell-version": [ "42.9" ],
"url": "https://gjs.guide/extensions"
}

The error:
MicrosoftTeams-image (1)

You need to provide a gettext domain for initTranslations(), either as a parameter or via the gettext-domain entry of the metadata file.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.