[clockPreferences] Fix translations

The preference dialog for the panel clock does not set its gettext
domain, so it's not translated even if though translations are
already available.
Fix by setting the domain in the GtkBuilder file and binding the
domain to the locale directory.

https://bugzilla.gnome.org/show_bug.cgi?id=618873
This commit is contained in:
Florian Müllner 2010-05-17 14:03:47 +02:00
parent 03a0809e39
commit 764f5b62f0
4 changed files with 11 additions and 2 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<interface> <interface domain="gnome-shell">
<requires lib="gtk+" version="2.16"/> <requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide --> <!-- interface-naming-policy project-wide -->
<object class="GtkDialog" id="prefs-dialog"> <object class="GtkDialog" id="prefs-dialog">

View File

@ -7,6 +7,8 @@ const GConf = imports.gi.GConf;
const Lang = imports.lang; const Lang = imports.lang;
const Signals = imports.signals; const Signals = imports.signals;
const Gettext = imports.gettext;
const GCONF_DIR = '/desktop/gnome/shell/clock'; const GCONF_DIR = '/desktop/gnome/shell/clock';
const FORMAT_KEY = GCONF_DIR + '/format'; const FORMAT_KEY = GCONF_DIR + '/format';
const SHOW_DATE_KEY = GCONF_DIR + '/show_date'; const SHOW_DATE_KEY = GCONF_DIR + '/show_date';
@ -80,6 +82,9 @@ Signals.addSignalMethods(ClockPreferences.prototype);
function main(params) { function main(params) {
if ('progName' in params) if ('progName' in params)
GLib.set_prgname(params['progName']); GLib.set_prgname(params['progName']);
if ('localeDir' in params)
Gettext.bindtextdomain('gnome-shell', params['localeDir']);
Gtk.init(null, null); Gtk.init(null, null);
let clockPrefs = new ClockPreferences(params['uiFile']); let clockPrefs = new ClockPreferences(params['uiFile']);

View File

@ -26,6 +26,7 @@ EXTRA_DIST += gnome-shell.in
gnome-shell-clock-preferences: gnome-shell-clock-preferences.in gnome-shell-clock-preferences: gnome-shell-clock-preferences.in
$(AM_V_GEN) sed -e "s|@pkgdatadir[@]|$(pkgdatadir)|" \ $(AM_V_GEN) sed -e "s|@pkgdatadir[@]|$(pkgdatadir)|" \
-e "s|@localedir[@]|$(datadir)/locale|" \
-e "s|@GJS_CONSOLE[@]|$(GJS_CONSOLE)|" \ -e "s|@GJS_CONSOLE[@]|$(GJS_CONSOLE)|" \
$< > $@ && chmod a+x $@ $< > $@ && chmod a+x $@
CLEANFILES += gnome-shell-clock-preferences CLEANFILES += gnome-shell-clock-preferences

View File

@ -11,8 +11,11 @@ else
fi fi
progName="`basename $0`" progName="`basename $0`"
localeDir="@localedir@"
uiFile="$uiDir/clock-preferences.ui" uiFile="$uiDir/clock-preferences.ui"
export GJS_PATH="$jsDir" export GJS_PATH="$jsDir"
@GJS_CONSOLE@ -c "const ClockPreferences = imports.prefs.clockPreferences; @GJS_CONSOLE@ -c "const ClockPreferences = imports.prefs.clockPreferences;
ClockPreferences.main({ progName: '$progName', uiFile: '$uiFile' });" ClockPreferences.main({ progName: '$progName',
uiFile: '$uiFile',
localeDir: '$localeDir' });"