Re: Automatic language translation

2005-08-27 Thread Mariano Draghi
Jon wrote:
 Does python have a module that will translate between different spoken
 languages?  My python program displays all of its messages in English
 currently and my boss wants it to default to Korean now.
 
 Any ideas how to go about doing this?
 

You need to use gettext.
Please, have a look at http://docs.python.org/lib/module-gettext.html

-- 
Mariano

-- 
http://mail.python.org/mailman/listinfo/python-list



Re: is there an equivalent of javascript's this[myMethod] for the currently running script?

2005-07-05 Thread Mariano Draghi
[EMAIL PROTECTED] wrote:
 I'd like to dynamically find and invoke a method in a Python CGI.
 
 In javascript, the running script is 'this' (Python's 'self'), except
 that 'self' is not defined.
 
 I want to do this:
 
 var m = this[MethodName];  //where the method name is passed via an
 http variable
 m();  //this invokes a method in javascript
 
 How do I do the same in python?
 
 self[MethodName] fails...
 

Don't know if this is the best solution... but you need something around 
the lines of:

  def foo():
... print bar
...
  m = locals()[foo]
 
  m()
bar
 

i.e., you need to play a bit with locals()

Hope that helps

-- 
Mariano

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: UTF-8 / German, Scandinavian letters - is it really this difficult?? Linux Windows XP

2005-02-22 Thread Mariano Draghi
Hace mucho tiempo en una galaxia muy, muy lejana, Mike Dee escribió:
   A very very basic UTF-8 question that's driving me nuts:
If I have this in the beginning of my Python script in Linux:
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
should I - or should I not - be able to use non-ASCII characters 
in strings and in Tk GUI button labels and GUI window titles and in 
raw_input data without Python returning wrong case in manipulated 
strings and/or gibberished characters in Tk GUI title? 
...
I'd recommend reading The Absolute Minimum Every Software Developer 
Absolutely, Positively Must Know About Unicode and Character Sets (No 
Excuses!), by Joel Spolsky:
- http://www.joelonsoftware.com/articles/Unicode.html

It's not based on Python (nor any other language either...), but I find 
it *very* useful.

Regards,
--
Mariano
--
http://mail.python.org/mailman/listinfo/python-list


Re: what would you like to see in a 2nd edition Nutshell?

2004-12-30 Thread Mariano Draghi
Alex Martelli escribió:
Yes, good point... I _do_ plan another book after I'm done with the 2nd 
ed Nutshell, though ti will mostly be about Design Patterns and 
development methods so may not meet your exact desires...
Now I'm anxious! *that* is the book I'm waiting for :)
I think the Python community really needs such a book; you have plenty 
of books and articles and papers and resources on-line with (almost) all 
the bits  pieces. But I really miss a book that focuses in the 
Pythonic way of project management, design patterns, development 
cycles, QA... something targeted to the enterprise.

I think that somehow Python's J2EE equivalent is already out there 
(sort of...), if you have time to look for the bits, and if you manage 
to glue them together. A good book with a higher level approach, focused 
in design, would be an invaluable help in that proccess.

--
Mariano
--
http://mail.python.org/mailman/listinfo/python-list