root/PleiadesEntity/trunk/Extensions/ws_transliteration.py

Revision 746, 0.6 kB (checked in by thomase, 2 years ago)

Closes ticket #239. Automatic transliteration of attested names, as well as population of titles for adds/edits through-the-web. Modification of loader code to handle coincident model changes and invoke auto-transliteration as well - UPDATE YOUR EXTERNAL METHODS. Make tests check everything and work properly (Neverpolis is illegal according to Latin name validation rules).

  • Property svn:eol-style set to native
Line 
1 import Products.PleiadesEntity.Extensions.ws_grek as ws_grek
2 import Products.PleiadesEntity.Extensions.ws_latn as ws_latn
3
4 def transliterate_name(lang, name_utf8):
5     wsystem = lang.lower()
6     name = unicode(name_utf8, 'utf-8')
7     if wsystem == 'grc' or wsystem == 'la-grek':
8         transliteration = ws_grek.transliterate(name)
9     elif wsystem == 'la' or wsystem == 'grc-latn':
10         transliteration = ws_latn.transliterate(name)
11     else:
12         return 'Unsupported writing system (%s) in PleiadesEntity/Extensions/ws_transliteration.py' % lang
13     return transliteration
14    
Note: See TracBrowser for help on using the browser.