本文整理汇总了Python中translate._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_hijri_date
def get_hijri_date(self):
wd = datetime.datetime.now().strftime("%A")
calc = HijriCal(self.silaty.prayertimes.options.hijrical_adjustment)
h_months = ['Muharram ', 'Safar', 'Rabi al Awwal', 'Rabi al Akhira', 'Jumada al Ula', 'Jumada al Akhira', 'Rajab', "Sha'ban", 'Ramadan', 'Shawwal', "Dhu al Qa'da", 'Dhu al Hijja']
h_year, h_month, h_day, h_week_day = calc.today
h_date = '%i %s %i' % ( h_day, _(h_months[int(h_month-1)]), h_year)
return (_('%s, %s') % (_(wd), h_date))
示例2: update_compass
def update_compass(self, qibladirection, country, city):
## The only way to update so far is to remove the whole thing and create it again
self.remove(self.mainbox)
self.mainbox = Gtk.Box()
self.mainbox.set_orientation(Gtk.Orientation.VERTICAL)
qibla = self.set_compass(qibladirection)
qibla.props.valign = Gtk.Align.START
## Make the top label
qiblatitle = Gtk.Label(label=_("Qibla direction :"), margin_left=20, margin_right=20)
qiblatitle.props.halign = Gtk.Align.START
self.mainbox.pack_start(qiblatitle, False, False, 12)
## Set the compass image
self.mainbox.pack_start(qibla, False, True, 0)
## Set the country and city
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,spacing=6)
qiblalabel = Gtk.Label(label=_("Country : %s") % country)
qiblalabel.props.halign = Gtk.Align.CENTER
qiblalabel.props.valign = Gtk.Align.CENTER
vbox.pack_start(qiblalabel, True,True, 0)
qiblalabel = Gtk.Label(label=_("City : %s") % city)
qiblalabel.props.halign = Gtk.Align.CENTER
qiblalabel.props.valign = Gtk.Align.CENTER
vbox.pack_start(qiblalabel, True, True, 0)
## Add it all in the end
self.mainbox.pack_start(vbox, False, False, 12)
self.pack_start(self.mainbox, True, True, 0)
self.show_all()
示例3: setInfo
def setInfo(self):
selection = self["filelist"].getSelection()
if selection is None:
return
elif selection[1] == True: # isDir
self["key_green"].setText("")
self.EditScreen = False
self["key_yellow"].setText("")
self.DeleteScreen = False
self["PreviewPicture"].hide()
self["key_blue"].setText("")
else:
self["key_green"].setText(_("Edit"))
self.EditScreen = True
if path.exists(self.UserSkin_Selections_dir + self.filelist.getFilename()):
self["key_yellow"].setText("")
self.DeleteScreen = False
else:
self["key_yellow"].setText(_("Delete"))
self.DeleteScreen = True
self.PreviewTimer.start(100,False)
if self.filelist.getFilename().lower().find('infobar') != -1:
self["key_blue"].setText(_("Preview"))
else:
self["key_blue"].setText("")
示例4: keyYellow
def keyYellow(self):
if self.NumberOfScreens >= 1:
self.currentScreenID += 1
if self.currentScreenID >= self.NumberOfScreens:
self.currentScreenID = 0
while self.root[self.currentScreenID].tag != 'screen':
self.currentScreenID += 1
try:
self.myScreenName = self.root[self.currentScreenID].attrib['name']
except:
self.myScreenName = _('UnknownName')
myTitle=_("UserSkin %s - Edit %s screen (1/%d)") % (UserSkinInfo,self.myScreenName,self.NumberOfScreens)
print myTitle
self.setTitle(myTitle)
self["menu"].setIndex(0)
#try:
#self["Title"]=StaticText(myTitle)
#except:
# pass
self.createWidgetsList()
if self.NumberOfChilds != self.NumberOfScreens:
iindex = 0
for child in self.root.findall('*'):
if child.tag == screen:
break
iindex+= 1
self.currentScreenID = iindex
示例5: restartGUI
def restartGUI(self):
def restartGUIcb(answer):
if answer is True:
self.session.open(TryQuitMainloop, 3)
else:
self.close()
def restartNotOKcb(answer):
if answer is True:
self.session.open(TryQuitMainloop, 3)
else:
user_skin_file=resolveFilename(SCOPE_CONFIG, 'skin_user' + self.currentSkin + '.xml')
if path.exists(user_skin_file):
remove(user_skin_file)
self.close()
myMessage = ''
if self.LackOfFile != '':
printDEBUG("missing components: %s" % self.LackOfFile)
myMessage += _("Missing components found: %s\n\n") % self.LackOfFile
myMessage += _("Skin will NOT work properly and GS expected!!!\n\n")
myMessage += _("Are you sure you want to use it?")
restartbox = self.session.openWithCallback(restartNotOKcb,MessageBox, myMessage, MessageBox.TYPE_YESNO, default = False)
else:
myMessage += _("Restart GUI now?")
restartbox = self.session.openWithCallback(restartGUIcb,MessageBox, myMessage, MessageBox.TYPE_YESNO, default = False)
restartbox.setTitle(_("Message"))
示例6: get_times
def get_times(self, prayer):# If User Sets Clock Format 12hr or 24hr Return It As He Likes!
if self.prayertimes.options.clock_format == '12h':
#print ("DEBUG: using 12h format @", (str(datetime.datetime.now())))
return self.timeto12(prayer).replace('AM', _('AM')).replace('PM', _('PM'))
if self.prayertimes.options.clock_format == '24h':
#print ("DEBUG: using 24h format @", (str(datetime.datetime.now())))
return self.timeto24(prayer)
示例7: __init__
def __init__(self, qibladirection, country, city):
Gtk.Box.__init__(self)
self.mainbox = Gtk.Box()
self.mainbox.set_orientation(Gtk.Orientation.VERTICAL)
qibla = self.set_compass(qibladirection)
qibla.props.valign = Gtk.Align.START
## Make the top label
qiblatitle = Gtk.Label(label=_("Qibla direction :"), margin_left=20, margin_right=20)
qiblatitle.props.halign = Gtk.Align.START
self.mainbox.pack_start(qiblatitle, False, False, 12)
## Set the compass image
self.mainbox.pack_start(qibla, False, True, 0)
## Set the country and city
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,spacing=6)
qiblalabel = Gtk.Label(label=_("Country : %s") % country)
qiblalabel.props.halign = Gtk.Align.CENTER
qiblalabel.props.valign = Gtk.Align.CENTER
vbox.pack_start(qiblalabel, True,True, 0)
qiblalabel = Gtk.Label(label=_("City : %s") % city)
qiblalabel.props.halign = Gtk.Align.CENTER
qiblalabel.props.valign = Gtk.Align.CENTER
vbox.pack_start(qiblalabel, True, True, 0)
## Add it all in the end
self.mainbox.pack_start(vbox, False, False, 12)
self.pack_start(self.mainbox, True, True, 0)
示例8: openSelected
def openSelected(self):
selected = str(self["list"].getCurrent()[2])
if selected == 'about':
from about import UserSkin_About
self.session.openWithCallback(self.refresh,UserSkin_About)
return
elif selected == 'config':
from skinconfig import UserSkin_Config
self.session.openWithCallback(self.quit,UserSkin_Config)
return
elif selected == 'LCDskin':
from Plugins.Extensions.MiniTVUserSkinMaker.miniTVskinner import miniTVskinnerInitiator
self.runLCDskin(retDict = None, initRun = True)
return
elif selected == 'LCDskinInstall':
from myComponents import UserSkinconsole
runlist = []
runlist.append( ('opkg update') )
runlist.append( ('opkg install enigma2-plugin-extensions--j00zeks-minitvuserskinmaker') )
self.session.openWithCallback(self.refresh, UserSkinconsole, title = _("Installing miniTV skin creator"), cmdlist = runlist)
self.refresh()
return
elif selected == 'ListScreens':
from ScreensLister import ScreensLister
self.session.openWithCallback(self.doNothing,ScreensLister)
return
elif selected == 'getaddons':
from myComponents import myMenu
self.session.openWithCallback(self.refresh, myMenu, MenuFolder = '%sscripts' % PluginPath, MenuFile = '_Getaddons', MenuTitle = _("Download addons"))
return
elif selected == 'delete_addons':
from myComponents import myMenu
self.session.openWithCallback(self.refresh, myMenu, MenuFolder = '%sscripts' % PluginPath, MenuFile = '_Deleteaddons', MenuTitle = _("Delete addons"))
return
elif selected == 'getcomponents':
from myComponents import myMenu
self.session.openWithCallback(self.rebootQuestion, myMenu, MenuFolder = '%sscripts' % PluginPath, MenuFile = '_Getcomponents', MenuTitle = _("Download additional Components/plugins"))
return
elif selected == 'importskin':
from myComponents import myMenu
self.session.openWithCallback(self.refresh, myMenu, MenuFolder = '%sImportSkinScripts' % PluginPath, MenuFile = '_Skins2Import', MenuTitle = _("Import foreign skin"))
return
elif selected == 'getskin':
def goUpdate(ret):
if ret is True:
from myComponents import UserSkinconsole
runlist = []
runlist.append( ('chmod 755 %sscripts/SkinUpdate.sh' % PluginPath) )
runlist.append( ('%sscripts/SkinUpdate.sh %s' % (PluginPath,SkinPath)) )
self.session.openWithCallback(self.rebootQuestion, UserSkinconsole, title = _("Updating skin"), cmdlist = runlist)
return
self.session.openWithCallback(goUpdate, MessageBox,_("Do you want to update skin?"), type = MessageBox.TYPE_YESNO, timeout = 10, default = False)
return
elif selected == 'history':
from myComponents import UserSkinconsole
self.session.openWithCallback(self.refresh, UserSkinconsole, title = _("History of changes"), cmdlist = [ '%sscripts/SkinHistory.sh %s' % (PluginPath,SkinPath) ])
return
示例9: refresh
def refresh(self):
# update hijri date
self.hytoday, self.hmtoday, self.hdtoday = self.hijrical.goto_gregorian_day(self.gytoday, (self.gmtoday+1), self.gdtoday)
# update hijri title label
now_wd = datetime.datetime.now().strftime("%A")
h_date = '%i %s %i' % (self.hdtoday, _(self.hmonths[int(self.hmtoday-1)]), self.hytoday)
self.parent.titlestack.get_child_by_name("Hijri").set_label(_('%s, %s') % (_(now_wd), h_date))
# update calendar
gday = (self.refdate).strftime("%d")
gmonth = (self.refdate).strftime("%B")
gyear = (self.refdate).strftime("%Y")
if self.state == CalendarState.Gregorian:
# Get the size of this month
hyear, hmonth, hday = self.hijrical.goto_gregorian_day(int(gyear), (self.gmonths.index(gmonth)+1), int(gday))
refwd = self.weekdays.index(self.refdate.strftime("%A"))
calendarindex = -(refwd+(((6-refwd)+int(self.refdate.strftime("%d")))//7)*7)
else:
hyear, hmonth, hday = self.hijrical.goto_gregorian_day(int(gyear), (self.gmonths.index(gmonth)+1), int(gday))
refwd = self.weekdays.index(self.refdate.strftime("%A"))
calendarindex = -(refwd+(((6-refwd)+hday)//7)*7)
for row in range(0, 6):
for column in range(0, 7):
newgday = int((self.refdate + timedelta(days=(calendarindex))).strftime("%d"))
newgmonth = self.gmonths.index((self.refdate + timedelta(days=(calendarindex))).strftime("%B"))
newgyear = int((self.refdate + timedelta(days=(calendarindex))).strftime("%Y"))
newhyear, newhmonth, newhday = self.hijrical.goto_gregorian_day(newgyear, newgmonth+1, newgday)
self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day_next = newgday
self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day_next = newhday
if (column == 0) or (column == 6):
self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day_next_background = CalendarColor.LGrey
self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day_next_background = CalendarColor.LGrey
else:
self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day_next_background = CalendarColor.White
self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day_next_background = CalendarColor.White
if newgmonth != self.gmonths.index(self.refdate.strftime("%B")):
self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day_next_background = CalendarColor.DGrey
if newhmonth != hmonth:
self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day_next_background = CalendarColor.DGrey
if (newgday == self.gdtoday and newgmonth == self.gmtoday and newgyear == self.gytoday):
self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day_next_background = CalendarColor.Blue
if (newhday == self.hdtoday and newhmonth == self.hmtoday and newhyear == self.hytoday):
self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day_next_background = CalendarColor.Blue
newgbackground = self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day_next_background
newhbackground = self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day_next_background
self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day = newgday
self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day_background = newgbackground
self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day = newhday
self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day_background = newhbackground
calendarindex += 1
示例10: restartGUI
def restartGUI(self):
myMessage = ''
if self.LackOfFile != '':
printDEBUG("missing components: %s" % self.LackOfFile)
myMessage += _("Missing components found: %s\n\n") % self.LackOfFile
myMessage += _("Skin will NOT work properly!!!\n\n")
myMessage += _("Restart necessary, restart GUI now?")
restartbox = self.session.openWithCallback(self.restartGUIcb,MessageBox, myMessage, MessageBox.TYPE_YESNO, default = False)
restartbox.setTitle(_("Message"))
示例11: Plugins
def Plugins(**kwargs):
return [
PluginDescriptor(
name=_("UserSkin Setup"),
description=_("Personalize your Skin"),
where=PluginDescriptor.WHERE_MENU,
fnc=menu,
)
]
示例12: __init__
def __init__(self, session):
Screen.__init__(self, session)
self.setup_title = _("UserSkinMenu")
Screen.setTitle(self, self.setup_title)
self["list"] = List()
self["setupActions"] = ActionMap(
["SetupActions", "MenuActions"], {"cancel": self.quit, "ok": self.openSelected, "menu": self.quit}, -2
)
self.setTitle(_("UserSkin menu %s") % UserSkinInfo)
self.createsetup()
示例13: secs_to_hrtime
def secs_to_hrtime(self, secs):
# Transform Seconds into Hours and Minutes
hours = secs//3600
minutes = (secs//60)%60
minutes += 1 # correct minutes (to avoid values like "0min")
if minutes == 60:
hours += 1
return _("%s Hours") % str(hours)
elif hours == 0:
return _("%s Minutes") % str(minutes)
else:
return _("%s Hours and %s Minutes") % (str(hours), str(minutes))
示例14: secs_to_nrtime
def secs_to_nrtime(self, secs):
# Transform Seconds into Hours and Minutes
# Using the same standard in iPray
hours = secs//3600
minutes = (secs//60)%60
minutes += 1 # correct minutes (to avoid values like "0min")
if minutes == 60:
hours += 1
return _("%shr") % str(hours)
elif hours == 0:
return _("%smin") % str(minutes)
else:
return _("%shr %smin") % (str(hours), str(minutes))
示例15: __init__
def __init__(self, text, width=None, base_text=None, **kwds):
#-# Translation live update preparation
# base_text: to be used each time a widget takes a formated string
# defaults to 'text'.
Widget.__init__(self, **kwds)
#-# Translation live update preparation
self.fixed_width = width
self.base_text = base_text or text
self.previous_translation = _(text, doNotTranslate=kwds.get('doNotTranslate', False))
#-#
self._text = _(text, doNotTranslate=kwds.get('doNotTranslate', False))
#-#
self.calc_size()