1 # for localized messages
3 from Plugins.Plugin import PluginDescriptor
4 from Screens.Console import Console
5 from Screens.MessageBox import MessageBox
6 from Components.Language import language
7 from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE
8 from os import environ as os_environ
12 lang = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country"
13 os_environ["LANGUAGE"] = lang # Enigma doesn't set this (or LC_ALL, LC_MESSAGES, LANG). gettext needs it!
14 gettext.bindtextdomain("BackupSuite", resolveFilename(SCOPE_PLUGINS, "Extensions/BackupSuiteHDD/locale"))
17 t = gettext.dgettext("BackupSuite", txt)
19 print "[BackupSuite] fallback to default translation for", txt
20 t = gettext.gettext(txt)
24 language.addCallback(localeInit)
27 def runbackup(session, result):
29 session.open(Console, title = _("Full back-up to USB"), cmdlist = [_("sh '/usr/lib/enigma2/python/Plugins/Extensions/BackupSuiteUSB/backup.sh' en_EN")])
32 def main(session, **kwargs):
33 session.openWithCallback(lambda r: runbackup(session, r), MessageBox, _("Do you want to make a back-up on USB?\n\nThis only takes a few minutes depending on the used filesystem and is fully automatic.\n\nMake sure you first insert an USB flash drive before you select Yes.") , MessageBox.TYPE_YESNO, timeout = 20, default = True)
35 def Plugins(**kwargs):
36 return [PluginDescriptor(name=_("Full back-up to USB"),
37 description = _("Full 1:1 back-up direct on USB"),
38 where = PluginDescriptor.WHERE_PLUGINMENU,