mirror of
https://github.com/edu4rdshl/gnome-shell.git
synced 2026-07-18 07:34:54 +00:00
Use the new defineTranslationFunctions() method from the previous
commit to create gettext functions for the module, instead of
re-exporting from the shared module.
It is now up to extension developers to use the more effective
```js
import {Extension} from 'etensions/extension.js';
const {gettext: _} =
Extension.defineTranslationFunctions(import.meta.url);
```
or the more convenient
```js
import {Extension, gettext} from 'extensions/extension.js';
const _ = gettext;
```
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2838>
28 lines
678 B
JavaScript
28 lines
678 B
JavaScript
import {ExtensionBase, GettextWrapper, setExtensionManager} from './sharedInternals.js';
|
|
|
|
const {extensionManager} = imports.ui.main;
|
|
setExtensionManager(extensionManager);
|
|
|
|
export class Extension extends ExtensionBase {
|
|
static defineTranslationFunctions(url) {
|
|
const wrapper = new GettextWrapper(this, url);
|
|
return wrapper.defineTranslationFunctions();
|
|
}
|
|
|
|
enable() {
|
|
}
|
|
|
|
disable() {
|
|
}
|
|
|
|
/**
|
|
* Open the extension's preferences window
|
|
*/
|
|
openPreferences() {
|
|
extensionManager.openExtensionPrefs(this.uuid, '', {});
|
|
}
|
|
}
|
|
|
|
export const {
|
|
gettext, ngettext, pgettext,
|
|
} = Extension.defineTranslationFunctions();
|