~ubuntu-branches/ubuntu/precise/gnome-orca/precise-proposed

« back to all changes in this revision

Viewing changes to .pc/03_Fix-for-bug-658781-Some-text-not-spoken-at-all-since.patch/src/orca/pronunciation_dict.py

  • Committer: Package Import Robot
  • Author(s): Luke Yelavich
  • Date: 2011-09-23 11:53:49 UTC
  • mfrom: (0.9.41 upstream)
  • Revision ID: package-import@ubuntu.com-20110923115349-9mv0aw0lw19v7puu
Tags: 3.1.92-0ubuntu1
* New upstream release
  - General:
    + Fix for bug 659054 - Orca fails to present decimal values of
      GtkScale widgets in Gtk+ 3
    + Fix for bug 659379 - Orca is not presenting panel menus and menu
      items in fallback mode
    + Fix for bug 659264 - Return in onFocus if the object is not focused
    + Fix for bug 659122 - Unicode decode error traceback with speech
      generation if I using hungarian locale
    + Fix for bug 617833 - Orca should indicate state of NumLock key
    + Fix for bug 652485 - Gtk+ Deprecations (Remainder of the work)
    + Fix for bug 659015 - The mnemonic widget property on the voice page
      is absent for several widgets
    + Fix for bug 658134 - Lines with unexpected characters are not always
      displayed in braille by Orca
    + Fix for bug 658781 - Some text not spoken at all since gobject
      introspection changes in orca 3.1.9x.
    + Fix for bug 658993 - Two GtkGrid spacing issues
  - Build:
    + Fix for bug 659092 - Do not reference non-existing doc figures
  - New and updated translations (THANKS EVERYONE!!!):
    + ast        Asturian                        Xandru Armesto
    + bg         Bulgarian                       Alexander Shopov
    + ca         Catalan                         Pau Iranzo
    + cs         Czech                           Marek Černocký
    + da         Danish                          Kenneth Nielsen
    + de         German                          Christian Kirbach
    + en_GB      British English                 Bruce Cowan
    + es         Spanish                         Jorge González,
                                                 Daniel Mustieles
    + fi         Finnish                         Timo Jyrinki
    + fr         French                          Bruno Brouard
    + gl         Galician                        Fran Diéguez
    + hu         Hungarian                       Attila Hammer
    + it         Italian                         Luca Ferretti
    + lt         Lithuanian                      Aurimas Černius
    + lv         Latvian                         Rudolfs Mazurs
    + pa         Punjabi                         Amanpreet Singh Alam
    + pl         Polish                          Piotr Drąg
    + pt         Portuguese                      Rui Batista
    + ru         Russian                         Yuri Myasoedov
    + sl         Slovenian                       Matej Urbančič
    + sv         Swedish                         Daniel Nylander
    + ta         Tamil                           Dr.T.Vasudevan
    + zh_CN      Simplified Chinese              Yinghua Wang
    + zh_HK      Traditional Chinese - HongKong  Chao-Hsiung Liao
    + zh_TW      Traditional Chinese - Taiwan    Chao-Hsiung Liao
* Dropped patches, applied upstream:
  - 03_Fix-for-bug-658781-Some-text-not-spoken-at-all-since.patch
  - 04_Fix-for-bug-658134-Lines-with-unexpected-characters-.patch
* debian/control: Bump at-spi build dep to >= 2.1.92

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Orca
2
 
#
3
 
# Copyright 2006-2008 Sun Microsystems Inc.
4
 
#
5
 
# This library is free software; you can redistribute it and/or
6
 
# modify it under the terms of the GNU Lesser General Public
7
 
# License as published by the Free Software Foundation; either
8
 
# version 2.1 of the License, or (at your option) any later version.
9
 
#
10
 
# This library is distributed in the hope that it will be useful,
11
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 
# Lesser General Public License for more details.
14
 
#
15
 
# You should have received a copy of the GNU Lesser General Public
16
 
# License along with this library; if not, write to the
17
 
# Free Software Foundation, Inc., Franklin Street, Fifth Floor,
18
 
# Boston MA  02110-1301 USA.
19
 
 
20
 
"""Exposes a dictionary, pronunciation_dict, that maps words to what
21
 
they sound like."""
22
 
 
23
 
__id__        = "$Id$"
24
 
__version__   = "$Revision$"
25
 
__date__      = "$Date$"
26
 
__copyright__ = "Copyright (c) 2006-2008 Sun Microsystems Inc."
27
 
__license__   = "LGPL"
28
 
 
29
 
def getPronunciation(word, pronunciations=None):
30
 
    """Given a word, return a string that represents what this word
31
 
    sounds like.
32
 
 
33
 
    Arguments:
34
 
    - word: the word to get the "sounds like" representation for.
35
 
    - pronunciations: an optional dictionary used to get the pronunciation
36
 
      from.
37
 
 
38
 
    Returns a string that represents what this word sounds like, or 
39
 
    the word if there is no representation.
40
 
    """
41
 
 
42
 
    if isinstance(word, unicode):
43
 
        word = word.encode("UTF-8")
44
 
 
45
 
    try:
46
 
        lowerWord = word.decode("UTF-8").lower().encode("UTF-8")
47
 
        if pronunciations != None:
48
 
            return pronunciations[lowerWord][1]
49
 
        else:
50
 
            return pronunciation_dict[lowerWord][1]
51
 
    except:
52
 
        # If you want a character name to be spoken, treat it as a
53
 
        # punctuation character at LEVEL_NONE in puncutation_settings.py.
54
 
        # See, for example, the left_arrow and right_arrow characters.
55
 
        #
56
 
        #return chnames.getCharacterName(word)
57
 
        return word
58
 
 
59
 
def setPronunciation(word, replacementString, pronunciations=None):
60
 
    """Given an actual word, and a replacement string, set a key/value
61
 
    pair in a pronunciation dictionary.
62
 
 
63
 
    Arguments:
64
 
    - word: the word to be pronunced.
65
 
    - replacementString: the replacement string to use instead.
66
 
    - pronunciations: an optional dictionary used to set the pronunciation
67
 
      into.
68
 
    """
69
 
 
70
 
    key = word.decode("UTF-8").lower().encode("UTF-8")
71
 
    if pronunciations != None:
72
 
        pronunciations[key] = [ word, replacementString ]
73
 
    else:
74
 
        pronunciation_dict[key] = [ word, replacementString ]
75
 
 
76
 
# pronunciation_dict is a dictionary where the keys are words and the
77
 
# values represent word the pronunciation of that word (in other words,
78
 
# what the word sounds like).
79
 
#
80
 
pronunciation_dict = {}