blob: 422d207c9ed6f7c7443b661ea1ad2e5f93ebd629 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// SPDX-License-Identifier: MIT OR LGPL-2.0-or-later
// SPDX-FileCopyrightText: 2009 Red Hat, Inc.
/*
* Make sure you have a non english locale installed, for example fr_FR and run
* LANGUAGE=fr_FR gjs -m gettext.js
* the label should show a translation of 'Print help'
*/
import Gettext, {gettext as _} from 'gettext';
import Gtk from 'gi://Gtk?version=4.0';
import GLib from 'gi://GLib';
Gtk.init();
let loop = GLib.MainLoop.new(null, false);
Gettext.bindtextdomain('gnome-shell', '/usr/share/locale');
Gettext.textdomain('gnome-shell');
let window = new Gtk.Window({title: 'gettext'});
window.set_child(new Gtk.Label({label: _('Print help')}));
window.connect('close-request', () => {
loop.quit();
});
window.present();
loop.run();
|