2006-10-26 Alex Roitman <shura@gramps-project.org>

* help/gramps.pot: Regenerate manual template.
	* src/data/tips.xml.in (family): Escape quotes.
	* src/TipOfDay.py (TipParserescape): Remove: no need to escape here.
	(TipOfDay.escape): Escape here, to allow for gettext lookup. 
	(TipOfDay.next_tip_cb): Escape prior to gettext lookup.



svn: r7441
This commit is contained in:
Alex Roitman 2006-10-27 01:59:33 +00:00
parent 434fbdc38d
commit 00a28ef5c7
4 changed files with 1295 additions and 1289 deletions

View File

@ -1,3 +1,10 @@
2006-10-26 Alex Roitman <shura@gramps-project.org>
* help/gramps.pot: Regenerate manual template.
* src/data/tips.xml.in (family): Escape quotes.
* src/TipOfDay.py (TipParserescape): Remove: no need to escape here.
(TipOfDay.escape): Escape here, to allow for gettext lookup.
(TipOfDay.next_tip_cb): Escape prior to gettext lookup.
2006-10-25 Piotr Czubaszek <pioterus@gmail.com> 2006-10-25 Piotr Czubaszek <pioterus@gmail.com>
* src/plugins/rel_pl.py: Update. * src/plugins/rel_pl.py: Update.

File diff suppressed because it is too large Load Diff

View File

@ -86,13 +86,20 @@ class TipOfDay(ManagedWindow.ManagedWindow):
window.show_all() window.show_all()
def next_tip_cb(self,dummy=None): def next_tip_cb(self,dummy=None):
self.tip.set_text(_(self.tip_list[self.new_index[self.index]])) tip_text = self.escape(self.tip_list[self.new_index[self.index]])
self.tip.set_text(_(tip_text))
self.tip.set_use_markup(True) self.tip.set_use_markup(True)
if self.index >= len(self.tip_list)-1: if self.index >= len(self.tip_list)-1:
self.index = 0 self.index = 0
else: else:
self.index += 1 self.index += 1
def escape(self,text):
text = text.replace('&','&amp;'); # Must be first
text = text.replace(' > ',' &gt; ') # Replace standalone > char
text = text.replace('"','&quot;') # quotes
return text
def close_cb(self,dummy=None): def close_cb(self,dummy=None):
Config.set(Config.USE_TIPS,self.use.get_active()) Config.set(Config.USE_TIPS,self.use.get_active())
self.close() self.close()
@ -151,7 +158,7 @@ class TipParser:
def endElement(self,tag): def endElement(self,tag):
if tag == "tip" and not self.skip: if tag == "tip" and not self.skip:
text = self.escape(''.join(self.tlist)) text = ''.join(self.tlist)
self.mylist.append(' '.join(text.split())) self.mylist.append(' '.join(text.split()))
elif tag != "tips": elif tag != "tips":
# let all the other tags through, except for the "tips" tag # let all the other tags through, except for the "tips" tag
@ -159,11 +166,3 @@ class TipParser:
def characters(self, data): def characters(self, data):
self.tlist.append(data) self.tlist.append(data)
def escape(self,text):
"""
The tip's text will be interpreted as a markup, so we need to escape
some special chars.
"""
text = text.replace('&','&amp;'); # Must be first
return text

View File

@ -411,8 +411,8 @@ of how powerful GRAMPS is.
</_tip> </_tip>
<_tip number="57"> <_tip number="57">
Custom reports can be created by advanced users under the "plugin" system. Custom reports can be created by advanced users under the &quot;plugin&quot;
More information on custom reports can be found at system. More information on custom reports can be found at
http://developers.gramps-project.org http://developers.gramps-project.org
</_tip> </_tip>