extensionBase: Set up translations automatically

If an extension provides the gettext domain in its metadata,
then we can simply set up translations from the constructor,
so do that for a bit more convenience.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2838>
This commit is contained in:
Florian Müllner 2023-07-10 05:56:34 +02:00
parent abdd1346da
commit 0483dd31f0

View File

@ -55,6 +55,10 @@ export class ExtensionBase {
throw new Error(`${this.constructor.name} did not pass metadata to parent`);
this.metadata = metadata;
const domain = this.metadata['gettext-domain'];
if (domain)
this.initTranslations(domain);
}
/**