Re: How to internationalize a python script? (i18n)

2013-07-14 Thread gialloporpora
Risposta al messaggio di gialloporpora : gettext.translation('helloi18n', LOCALE_DIR, 'it') Ok, I have, with a little help of my friend, found the issue. The language code must be passed as a list not as a string. Sorry. Sandro -- *Thunderbird come evitare il ci

How to internationalize a python script? (i18n)

2013-07-14 Thread gialloporpora
Hello, I am trying to internationalize a script. First I have tried with a little script to understand how it works, but unfortunately, it doesn't. I have followed instruction in this page: http://docs.python.org/2/library/i18n.html I have created my script, marked strings with the _() functio

Is it correct this way to inherit from a list?

2013-03-02 Thread gialloporpora
Hi all, I would like to inherit from the list native class. really I expected that was possible to use native list method without redefining them, for example the __repr__ method. I don't know if i have made something wrong, this is my code (I obmit customized methods that I have added): fro

Re: Problem with __str__ method and character encoding

2012-12-07 Thread gialloporpora
Risposta al messaggio di Chris Angelico : Your __str__ method is not returning a string. It's returning a Unicode object. Under Python 2 (which you're obviously using, since you use print as a statement), strings are bytes. The best thing to do would be to move to Python 3.3, in which the defaul

Re: Problem with __str__ method and character encoding

2012-12-07 Thread gialloporpora
Risposta al messaggio di gialloporpora : This is the code in my test.py: Sorry, I have wrongly pasted the code: class msgmarker(object): def __init__(self, msgid, msgstr, index, encoding="utf-8"): self._encoding =encoding self.set(msg

Re: Problem with character encoding in commandline

2009-10-15 Thread gialloporpora
Risposta al messaggio di gialloporpora : Dear all, I have a strange problem that I am not able to solve myself. Ok, I have solved my problem, sorry for the post. First I had no view this function: sys.getfilesystemencoding() that return the console encoding, sorry. Sandro *gialloporpora

Problem with character encoding in commandline

2009-10-15 Thread gialloporpora
args=sys.argv[1] print decodeArgs(args) == -- *gialloporpora: Alex Faaborg - ยป Browsing Your Personal Web http://ff.im/9JDwm * - http://sn.im/shv8b *Massimo Bubola - Cuori Ribelli * - http://sn.im/sivjx * FAQ* di /it-alt.comp.software.mozilla/: http://bit.ly/1MZ04d -- http://mail.python.org/mailman/listinfo/python-list

Re: Help to find a regular expression to parse po file

2009-07-06 Thread gialloporpora
Risposta al messaggio di MRAB : gialloporpora wrote: Hi all, I would like to extract string from a PO file. To do this I have created a little python function to parse po file and extract string: import re regex=re.compile("msgid (.*)\\nmsgstr (.*)\\n\\n") m=r.findall(s) where s is

Re: Help to find a regular expression to parse po file

2009-07-06 Thread gialloporpora
Risposta al messaggio di Hallvard B Furuseth : I don't know the syntax of a po file, but this works for the snippet you posted: arg_re = r'"[^\\\"]*(?:\\.[^\\\"]*)*"' arg_re = '%s(?:\s+%s)*' % (arg_re, arg_re) find_re = re.compile( r'^msgid\s+(' + arg_re + ')\s*\nmsgstr\s+(' + arg_re + '

Help to find a regular expression to parse po file

2009-07-06 Thread gialloporpora
Hi all, I would like to extract string from a PO file. To do this I have created a little python function to parse po file and extract string: import re regex=re.compile("msgid (.*)\\nmsgstr (.*)\\n\\n") m=r.findall(s) where s is a po file like this: msgctxt "write ubiquity commands.descripti