extensions: Replace exported gettext functions

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>
This commit is contained in:
Florian Müllner
2023-07-17 01:13:06 +02:00
parent f59d523694
commit 931ca5e4ab
3 changed files with 8 additions and 96 deletions

View File

@ -5,8 +5,6 @@ import {extensionManager} from '../extensionsService.js';
setExtensionManager(extensionManager);
export {gettext, ngettext, pgettext} from './sharedInternals.js';
export class ExtensionPreferences extends ExtensionBase {
static defineTranslationFunctions(url) {
const wrapper = new GettextWrapper(this, url);
@ -22,3 +20,7 @@ export class ExtensionPreferences extends ExtensionBase {
throw new GObject.NotImplementedError();
}
}
export const {
gettext, ngettext, pgettext,
} = ExtensionPreferences.defineTranslationFunctions();