From 0483dd31f0107418a83e9c04f38f03b1a2132114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Mon, 10 Jul 2023 05:56:34 +0200 Subject: [PATCH] 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: --- js/extensions/sharedInternals.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/extensions/sharedInternals.js b/js/extensions/sharedInternals.js index 2f8e28710..524ec3985 100644 --- a/js/extensions/sharedInternals.js +++ b/js/extensions/sharedInternals.js @@ -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); } /**