environment: put gettext stuff into global environment

Rather than defining _() as a local function in every module, put it
into the global environment (along with C_() and ngettext()).

https://bugzilla.gnome.org/show_bug.cgi?id=649203
This commit is contained in:
Dan Winship
2011-04-30 09:16:13 -04:00
parent 7921954a31
commit 898b2b903d
33 changed files with 8 additions and 81 deletions

View File

@ -7,6 +7,7 @@ imports.gi.versions.GdkPixbuf = '2.0';
imports.gi.versions.Gtk = '3.0';
const Clutter = imports.gi.Clutter;;
const Gettext = imports.gettext.domain('gnome-shell');
const GLib = imports.gi.GLib;
const Gtk = imports.gi.Gtk;
const Shell = imports.gi.Shell;
@ -72,6 +73,10 @@ function init() {
// browser convention of having that namespace be called 'window'.)
window.global = Shell.Global.get();
window._ = Gettext.gettext;
window.C_ = Gettext.pgettext;
window.ngettext = Gettext.ngettext;
// Set the default direction for St widgets (this needs to be done before any use of St)
if (Gtk.Widget.get_default_direction() == Gtk.TextDirection.RTL) {
St.Widget.set_default_direction(St.TextDirection.RTL);