View Single Post
Old 10-19-2013, 06:52 AM   #332
Ayack
Junior Member
Ayack began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jun 2012
Device: Kindle
Thumbs up

Thanks! It works changing back the character after 'lue' (it's a "nnsbp" see here: https://translations.launchpad.net/c...293/+translate).

So, for the record, in French you can use this code:

Code:
def evaluate(self, formatter, kwargs, mi, locals, val, is_read_pct,  
				is_reading_str, no_page_read_str):
	try:
		test_val = int(is_read_pct)
	except:
		return 'is_read_pct is not a number'

	import re
	pattern = u'.*(\d+[-/]\d+[-/]\d+).*?Dernière page lue : Emplacement \d+ \((\d+)%\)'
	mg = re.match(pattern, val, re.U + re.I + re.DOTALL);
	if mg is None:
		return no_page_read_str
	date = mg.group(1)
	pct = mg.group(2)
	try:
		f = int(pct)
		if f > test_val:
			return date
		elif f > 0:
			return is_reading_str + ': ' + pct + '%'
	except:
		pass
	return no_page_read_str
Thanks a lot chaley!
Ayack is offline   Reply With Quote