Commit d2b3a600 authored by John Stowers's avatar John Stowers

Add l10n

parent e4b3c073
3.1.0
* Mark many strings as translatable.
3.0.5
* More autostart desktop file fixes. Try harder to autostart nautilus when
tweaking desktop handling.
......
......@@ -27,6 +27,7 @@ AS_AC_EXPAND(DATADIR, "${datadir}")
AS_AC_EXPAND(PKGDATADIR, "${datadir}/${PACKAGE}")
AS_AC_EXPAND(GSETTINGSSCHEMADIR, "${gsettingsschemadir}")
AS_AC_EXPAND(TWEAKDIR, "${pythondir}/gtweak/tweaks")
AS_AC_EXPAND(LOCALEDIR, "${localedir}")
AC_CONFIG_FILES([ po/Makefile.in
Makefile
......
......@@ -16,6 +16,8 @@
import os.path
import optparse
import logging
import locale
import gettext
import gi
gi.require_version("Gtk", "3.0")
......@@ -58,16 +60,17 @@ if __name__ == '__main__':
options, args = parser.parse_args()
try:
from gtweak.defs import GSETTINGS_SCHEMA_DIR, TWEAK_DIR, DATA_DIR, PKG_DATA_DIR
from gtweak.defs import GSETTINGS_SCHEMA_DIR, TWEAK_DIR, DATA_DIR, PKG_DATA_DIR, LOCALE_DIR
_defs_present = True
except ImportError:
GSETTINGS_SCHEMA_DIR = TWEAK_DIR = DATA_DIR = PKG_DATA_DIR = ""
GSETTINGS_SCHEMA_DIR = TWEAK_DIR = DATA_DIR = PKG_DATA_DIR = LOCALE_DIR = ""
_defs_present = False
#the supplied prefix always beats the contents of defs
if options.prefix or not _defs_present:
_prefix = options.prefix or "/usr"
DATA_DIR = os.path.join(_prefix, "share")
LOCALE_DIR = os.path.join(_prefix, "share", "locale")
GSETTINGS_SCHEMA_DIR = os.path.join(_prefix, "share", "glib-2.0", "schemas")
_me = os.path.abspath(os.path.dirname(__file__))
TWEAK_DIR = os.path.join(_me, "gtweak", "tweaks")
......@@ -78,8 +81,14 @@ if __name__ == '__main__':
gtweak.DATA_DIR = DATA_DIR
gtweak.PKG_DATA_DIR = PKG_DATA_DIR
gtweak.ENABLE_TEST = options.test
gtweak.APP_NAME = "gnome-tweak-tool"
logging.basicConfig(format="%(levelname)-8s: %(message)s", level=logging.INFO)
locale.setlocale(locale.LC_ALL, None)
gettext.bindtextdomain(gtweak.APP_NAME, LOCALE_DIR)
gettext.textdomain(gtweak.APP_NAME)
gettext.install(gtweak.APP_NAME)
MainWindow()
......@@ -3,3 +3,4 @@ PKG_DATA_DIR = "@PKGDATADIR@"
GSETTINGS_SCHEMA_DIR = "@GSETTINGSSCHEMADIR@"
TWEAK_DIR = "@TWEAKDIR@"
VERSION = "@VERSION@"
LOCALE_DIR = "@LOCALEDIR@"
......@@ -24,7 +24,7 @@ sg = build_horizontal_sizegroup()
TWEAK_GROUPS = (
TweakGroup(
"Fonts",
_("Fonts"),
GSettingsRangeTweak("org.gnome.desktop.interface", "text-scaling-factor", adjustment_step=0.1, size_group=sg),
GSettingsFontButtonTweak("org.gnome.desktop.interface", "font-name", size_group=sg),
GSettingsFontButtonTweak("org.gnome.desktop.interface", "document-font-name", size_group=sg),
......
......@@ -81,7 +81,7 @@ class KeyThemeSwitcher(GSettingsComboTweak):
make_combo_list_with_default(
self._get_valid_key_themes(),
"Default",
default_text="<i>Default</i>"),
default_text=_("<i>Default</i>")),
**options)
def _get_valid_key_themes(self):
......@@ -96,7 +96,7 @@ sg = build_horizontal_sizegroup()
TWEAK_GROUPS = (
TweakGroup(
"Interface",
_("Interface"),
GSettingsSwitchTweak("org.gnome.desktop.interface", "menus-have-icons"),
GSettingsSwitchTweak("org.gnome.desktop.interface", "buttons-have-icons"),
GtkThemeSwitcher(size_group=sg),
......
......@@ -45,7 +45,7 @@ class DesktopIconTweak(GSettingsSwitchTweak):
TWEAK_GROUPS = (
TweakGroup(
"File Manager",
_("File Manager"),
DesktopIconTweak(),
GSettingsSwitchTweak("org.gnome.nautilus.desktop", "computer-icon-visible", schema_filename="org.gnome.nautilus.gschema.xml"),
GSettingsSwitchTweak("org.gnome.nautilus.desktop", "home-icon-visible", schema_filename="org.gnome.nautilus.gschema.xml"),
......
......@@ -52,11 +52,11 @@ class ShellThemeTweak(Tweak):
Tweak.__init__(self, "Shell Theme", "Install custom or user themes for gnome-shell", **options)
#check the shell is running and the usertheme extension is present
error = "Unknown"
error = _("Unknown error")
try:
self._shell = GnomeShell()
except:
error = "Shell not running"
error = _("Shell not running")
try:
extensions = self._shell.list_extensions()
if ShellThemeTweak.THEME_EXT_NAME in extensions and extensions[ShellThemeTweak.THEME_EXT_NAME]["state"] == 1:
......@@ -72,12 +72,12 @@ class ShellThemeTweak(Tweak):
error = None
except:
error = "User Theme extension schema missing"
error = _("Shell user-theme extension incorrectly installed")
else:
error = "User Theme extension not enabled"
error = _("Shell user-theme extension not enabled")
except Exception, e:
error = "Could not list shell extensions"
error = _("Could not list shell extensions")
if error:
cb = build_combo_box_text(None)
......@@ -103,12 +103,12 @@ class ShellThemeTweak(Tweak):
*make_combo_list_with_default(
valid,
"",
default_text="<i>Default</i>"))
default_text=_("<i>Default</i>")))
cb.connect('changed', self._on_combo_changed)
self._combo = cb
#a filechooser to install new themes
chooser = ZipFileChooserButton("Select a theme file")
chooser = ZipFileChooserButton(_("Select a theme"))
chooser.connect("file-set", self._on_file_set)
self.widget = build_label_beside_widget(self.name, chooser, cb)
......@@ -155,9 +155,9 @@ class ShellThemeTweak(Tweak):
if ok:
if updated:
self.notify_info("%s theme updated successfully" % theme_name)
self.notify_info(_("%s theme updated successfully") % theme_name)
else:
self.notify_info("%s theme installed successfully" % theme_name)
self.notify_info(_("%s theme installed successfully") % theme_name)
#I suppose I could rely on updated as indicating whether to add the theme
#name to the combo, but just check to see if it is already there
......@@ -165,12 +165,12 @@ class ShellThemeTweak(Tweak):
if theme_name not in [r[0] for r in model]:
model.append( (theme_name, theme_name) )
else:
self.notify_error("Error installing theme")
self.notify_error(_("Error installing theme"))
except:
#does not look like a valid theme
self.notify_error("Invalid theme file")
self.notify_error(_("Invalid theme"))
logging.warning("Error parsing theme zip", exc_info=True)
#set button back to default state
......@@ -191,15 +191,15 @@ class ShellThemeTweak(Tweak):
if not val:
if self._usertheme_extension_version < "3.0.2":
self.notify_action_required(
"The shell may need to be restarted to apply the theme",
"Restart",
_("The shell may need to be restarted to apply the theme"),
_("Restart"),
lambda: self._shell.restart())
sg = build_horizontal_sizegroup()
TWEAK_GROUPS = (
TweakGroup(
"Shell",
_("Shell"),
GSettingsSwitchTweak("org.gnome.shell.clock", "show-date", schema_filename="org.gnome.shell.gschema.xml"),
GSettingsSwitchTweak("org.gnome.shell.calendar", "show-weekdate", schema_filename="org.gnome.shell.gschema.xml"),
ShowWindowButtons(size_group=sg),
......
......@@ -38,16 +38,16 @@ class _ShellExtensionTweak(Tweak):
state == GnomeShell.EXTENSION_STATE["DISABLED"]:
sensitive = True
elif state == GnomeShell.EXTENSION_STATE["ERROR"]:
warning = "Error loading"
warning = _("Error loading extension")
elif state == GnomeShell.EXTENSION_STATE["OUT_OF_DATE"]:
warning = "Extension does not support shell version"
warning = _("Extension does not support shell version")
else:
warning = "Unknown extension state"
warning = _("Unknown extension error")
logging.critical(warning)
sw.set_sensitive(sensitive)
self.widget = build_label_beside_widget(
"%s Extension" % ext["name"],
_("%s Extension") % ext["name"],
sw,
warning=warning)
self.widget_for_size_group = sw
......@@ -59,8 +59,8 @@ class _ShellExtensionTweak(Tweak):
self._settings.setting_remove_from_list(self.EXTENSION_DISABLED_KEY, uuid)
self.notify_action_required(
"The shell must be restarted for changes to take effect",
"Restart",
_("The shell must be restarted for changes to take effect"),
_("Restart"),
self._shell.restart)
class _ShellExtensionInstallerTweak(Tweak):
......@@ -68,11 +68,11 @@ class _ShellExtensionInstallerTweak(Tweak):
EXTENSION_DIR = os.path.join(GLib.get_user_data_dir(), "gnome-shell", "extensions")
def __init__(self, shell, **options):
Tweak.__init__(self, "Install Shell Extension", "", **options)
Tweak.__init__(self, _("Install Shell Extension"), "", **options)
self._shell = shell
chooser = ZipFileChooserButton("Select a theme file")
chooser = ZipFileChooserButton(_("Select an extension"))
chooser.connect("file-set", self._on_file_set)
self.widget = build_label_beside_widget(self.name, chooser)
......@@ -120,22 +120,22 @@ class _ShellExtensionInstallerTweak(Tweak):
if ok:
if updated:
verb = "%s extension updated successfully" % extension_uuid
verb = _("%s extension updated successfully") % extension_uuid
else:
verb = "%s extension installed successfully" % extension_uuid
verb = _("%s extension installed successfully") % extension_uuid
self.notify_action_required(
verb,
"Restart",
_("Restart"),
self._shell.restart)
else:
self.notify_error("Error installing extension")
self.notify_error(_("Error installing extension"))
except:
#does not look like a valid theme
self.notify_error("Invalid extension file")
self.notify_error(_("Invalid extension"))
logging.warning("Error parsing theme zip", exc_info=True)
#set button back to default state
......@@ -168,7 +168,7 @@ class ShellExtensionTweakGroup(TweakGroup):
except:
logging.warning("Error detecting shell")
TweakGroup.__init__(self, "Shell Extensions", *extension_tweaks)
TweakGroup.__init__(self, _("Shell Extensions"), *extension_tweaks)
TWEAK_GROUPS = (
ShellExtensionTweakGroup(),
......
......@@ -75,7 +75,7 @@ sg = build_horizontal_sizegroup()
TWEAK_GROUPS = (
TweakGroup(
"Windows",
_("Windows"),
WindowThemeSwitcher(size_group=sg),
ActionClickTitlebarTweak("/apps/metacity/general/action_double_click_titlebar", size_group=sg),
ActionClickTitlebarTweak("/apps/metacity/general/action_middle_click_titlebar", size_group=sg),
......
......@@ -49,7 +49,7 @@ def make_combo_list_with_default(opts, default, title=True, default_text=None):
name = t
if t == default:
name = default_text or "%s <i>(default)</i>" % name
name = default_text or _("%s <i>(default)</i>") % name
themes.append((t, name))
return themes
......
......@@ -2,3 +2,10 @@
[type: gettext/glade]data/shell.ui
# files added by intltool-prepare
data/gnome-tweak-tool.desktop.in
gtweak/tweaks/tweak_font.py
gtweak/tweaks/tweak_interface.py
gtweak/tweaks/tweak_nautilus.py
gtweak/tweaks/tweak_shell.py
gtweak/tweaks/tweak_shell_extensions.py
gtweak/tweaks/tweak_windows.py
gtweak/utils.py
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment