Re: [TurboGears] Re: [TurboGears] Re: FormEncode i18n translation integration in TurboGears

Gregor Horvath <gh-LfrpOBifzZo+ytmZ3SK/[email protected]>
Newsgroups gmane.comp.python.formencode,gmane.comp.web.turbogears
Organization Ing. Gregor Horvath, Industrieberatung & Softwareentwicklung
Message-ID <[email protected]>
Ian Bicking schrieb:

> I don't expect this to be the case.  FormEncode's code is not updated 
> much, and releases are not frequent.  I don't want to change that.  You 

There has to be on release with the new i18n code in it.
It would be ideal if a lot of translations would be in this release
already. At the moment there is German in it.

It would be best if people who consider to invest 1-2 hours to get their
language supported should invest this time now!

Basically you have to do (untestted):

svn co http://svn.formencode.org/FormEncode/branches/gettext-enabled/
cd gettext-enabled/formencode/i18n
mkdir <lang>/LC_MESSAGES
cp FormEncode.pot <lang>/LC_MESSAGES/FormEncode.po
emacs <lang>/LC_MESSAGES/FormEncode.po # or whatever editor you prefer
#make the translation
msgfmt.py <lang>/LC_MESSAGES/FormEncode.po

TEST

send the PO and MO files to: gh-LfrpOBifzZo+ytmZ3SK/[email protected]

DONE

see also http://docs.python.org/lib/node738.html

Optionally you can also add a test of your language to tests/test_i18n.py:

ne = formencode.validators.NotEmpty()

[...]

def _test_lang(language, notemptytext):

  formencode.api.set_stdtranslation(languages=[language])

  try:
    ne.to_python("")
  except formencode.api.Invalid, e:
    assert str(e) == notemptytext

  formencode.api.set_stdtranslation() #set back to defaults


def test_de():
  _test_lang("de", u"Bitte einen Wert eingeben")


add:

def test_<lang>():
  _test_lang("<lang>", u"<translation of Not Empty Text in the language
<lang>")


--
Greg





-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.