orca r3998 - in trunk: . po src/orca



Author: richb
Date: Mon Jun 23 20:37:18 2008
New Revision: 3998
URL: http://svn.gnome.org/viewvc/orca?rev=3998&view=rev

Log:
        * src/orca/default.py:
          src/orca/text_attribute_names.py: (new)
          src/orca/where_am_I.py:
          src/orca/Makefile.am:
          src/orca/orca_gui_prefs.py:
          po/POTFILES.in:
          Fixed bug #538729 - In Orca preferences window /text attributes
          page the text attribute names not marked for translation.


Added:
   trunk/src/orca/text_attribute_names.py
Modified:
   trunk/ChangeLog
   trunk/po/POTFILES.in
   trunk/src/orca/Makefile.am
   trunk/src/orca/default.py
   trunk/src/orca/orca_gui_prefs.py
   trunk/src/orca/where_am_I.py

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in	(original)
+++ trunk/po/POTFILES.in	Mon Jun 23 20:37:18 2008
@@ -66,4 +66,5 @@
 src/orca/speechgenerator.py
 src/orca/speechserver.py
 src/orca/speech.py
+src/orca/text_attribute_names.py
 src/orca/where_am_I.py

Modified: trunk/src/orca/Makefile.am
==============================================================================
--- trunk/src/orca/Makefile.am	(original)
+++ trunk/src/orca/Makefile.am	Mon Jun 23 20:37:18 2008
@@ -57,6 +57,7 @@
 	speechgenerator.py \
 	speechserver.py \
 	structural_navigation.py \
+	text_attribute_names.py \
 	where_am_I.py
 
 orca_pythondir=$(pyexecdir)/orca

Modified: trunk/src/orca/default.py
==============================================================================
--- trunk/src/orca/default.py	(original)
+++ trunk/src/orca/default.py	Mon Jun 23 20:37:18 2008
@@ -63,6 +63,7 @@
 import speech
 import speechserver
 import mouse_review
+import text_attribute_names
 
 from orca_i18n import _         # for gettext support
 from orca_i18n import ngettext  # for ngettext support
@@ -4148,8 +4149,11 @@
         """
 
         for key in keys:
+            localizedKey = text_attribute_names.getTextAttributeName(key)
             if key in attributes:
                 attribute = attributes[key]
+                localizedValue = \
+                    text_attribute_names.getTextAttributeName(attribute)
                 if attribute:
                     # If it's the 'weight' attribute and greater than 400, just
                     # speak it as bold, otherwise speak the weight.
@@ -4176,11 +4180,12 @@
                             #
                             line = ngettext("%s %s pixel",
                                             "%s %s pixels",
-                                            int(attribute)) % (key, attribute)
+                                            int(attribute)) % \
+                                                (localizedKey, localizedValue)
                         else:
-                            line = key + " " + attribute
+                            line = localizedKey + " " + localizedValue
                     else:
-                        line = key + " " + attribute
+                        line = localizedKey + " " + localizedValue
                     speech.speak(line)
 
     def readCharAttributes(self, inputEvent=None):

Modified: trunk/src/orca/orca_gui_prefs.py
==============================================================================
--- trunk/src/orca/orca_gui_prefs.py	(original)
+++ trunk/src/orca/orca_gui_prefs.py	Mon Jun 23 20:37:18 2008
@@ -48,6 +48,7 @@
 import braille
 import speech
 import speechserver
+import text_attribute_names
 
 try:
     import louis
@@ -910,11 +911,17 @@
 
         for i in range(0, len(attrList)):
             for path in range(0, len(allAttrList)):
-                if attrList[i] == model[path][NAME]:
+                localizedKey = \
+                        text_attribute_names.getTextAttributeName(attrList[i])
+                localizedValue = \
+                        text_attribute_names.getTextAttributeName( \
+                                                        attrDict[attrList[i]])
+                if localizedKey == model[path][NAME]:
                     thisIter = model.get_iter(path)
-                    model.set(thisIter, NAME, attrList[i],
-                                        IS_SPOKEN, state,
-                                        VALUE, attrDict[attrList[i]])
+                    model.set(thisIter, 
+                        NAME, localizedKey,
+                        IS_SPOKEN, state,
+                        VALUE, localizedValue)
                     if moveToTop:
                         thisIter = model.get_iter(path)
                         otherIter = model.get_iter(i)
@@ -944,7 +951,9 @@
 
         for i in range(0, len(attrList)):
             for path in range(0, len(allAttrList)):
-                if attrList[i] == model[path][NAME]:
+                localizedKey = \
+                        text_attribute_names.getTextAttributeName(attrList[i])
+                if localizedKey == model[path][NAME]:
                     thisIter = model.get_iter(path)
                     model.set(thisIter, IS_BRAILLED, state)
                     break
@@ -963,12 +972,15 @@
         brailledAttrStr = ""
         noRows = model.iter_n_children(None)
         for path in range(0, noRows):
+            localizedKey = model[path][NAME]
+            key = text_attribute_names.getTextAttributeKey(localizedKey)
+            localizedValue = model[path][VALUE]
+            value = text_attribute_names.getTextAttributeKey(localizedValue)
+
             if model[path][IS_SPOKEN]:
-                spokenAttrStr += model[path][NAME] + ":" + \
-                                 model[path][VALUE] + "; "
+                spokenAttrStr += key + ":" + value + "; "
             if model[path][IS_BRAILLED]:
-                brailledAttrStr += model[path][NAME] + ":" + \
-                                   model[path][VALUE] + "; "
+                brailledAttrStr += key + ":" + value + "; "
 
         self.prefsDict["enabledSpokenTextAttributes"] = spokenAttrStr
         self.prefsDict["enabledBrailledTextAttributes"] = brailledAttrStr
@@ -1071,10 +1083,16 @@
                 defScript.textAttrsToDictionary(settings.allTextAttributes)
         for i in range(0, len(allAttrList)):
             thisIter = model.append()
-            model.set(thisIter, NAME, allAttrList[i],
-                                IS_SPOKEN, False,
-                                IS_BRAILLED, False,
-                                VALUE, allAttrDict[allAttrList[i]])
+            localizedKey = \
+                text_attribute_names.getTextAttributeName(allAttrList[i])
+            localizedValue = \
+                text_attribute_names.getTextAttributeName( \
+                                             allAttrDict[allAttrList[i]])
+            model.set(thisIter, 
+                NAME, localizedKey,
+                IS_SPOKEN, False,
+                IS_BRAILLED, False,
+                VALUE, localizedValue)
 
         self.getTextAttributesView.set_model(model)
 

Added: trunk/src/orca/text_attribute_names.py
==============================================================================
--- (empty file)
+++ trunk/src/orca/text_attribute_names.py	Mon Jun 23 20:37:18 2008
@@ -0,0 +1,531 @@
+# Orca
+#
+# Copyright 2006-2008 Sun Microsystems Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., Franklin Street, Fifth Floor,
+# Boston MA  02110-1301 USA.
+
+"""Provides getTextAttributeName method that maps each text attribute
+into its localized equivalent."""
+
+__id__        = "$Id:$"
+__version__   = "$Revision:$"
+__date__      = "$Date:$"
+__copyright__ = "Copyright (c) 2008 Sun Microsystems Inc."
+__license__   = "LGPL"
+
+from orca_i18n import Q_        # to provide qualified translatable strings
+
+# Translators: this is a structure to assist in the generation of
+# localized strings for the various text attributes. 
+#
+# Information can be found in the Atk documentation at:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+# The at-spi IDL documentation for Accessibility_Text.idl also provides
+# the following information:
+#
+# Attributes relevant to localization should be provided in accordance
+# with the w3c "Internationalization and Localization Markup Requirements",
+# http://www.w3.org/TR/2005/WD-itsreq-20051122/
+#
+# Other text attributes should choose their names and value semantics in
+# accordance with relevant standards such as:
+#   CSS level 2 (http://www.w3.org/TR/1998/REC-CSS2-19980512),
+#   XHTML 1.0   (http://www.w3.org/TR/2002/REC-xhtml1-20020801), and
+#   WICD        (http://www.w3.org/TR/2005/WD-WICD-20051121/). 
+#
+# Where possible, specific URL references will also be given below for
+# each text attribute.
+#
+
+_textAttributeTable = {}
+
+# Translators: this attribute specifies the background color of the text.
+# The value is an RGB value of the format "u,u,u".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["bg-color"] = Q_("textattr|background color")
+
+# Translators: this attribute specifies whether to make the background
+# color for each character the height of the highest font used on the
+# current line, or the height of the font used for the current character.
+# It will be a "true" or "false" value.
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["bg-full-height"] = Q_("textattr|background full height")
+
+# Translators: this attribute specifies whether a GdkBitmap is set for 
+# stippling the background color. It will be a "true" or "false" value.
+# See
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["bg-stipple"] = Q_("textattr|background stipple")
+
+# Translators: this attribute specifies the direction of the text.
+# Values are "none", "ltr" or "rtl".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["direction"] = Q_("textattr|direction")
+
+# Translators: this attribute specifies whether the text is editable.
+# It will be a "true" or "false" value.
+# See
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["editable"] = Q_("textattr|editable")
+
+# Translators: this attribute specifies the font family name of the text.
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["family-name"] = Q_("textattr|family name")
+
+# Translators: this attribute specifies the foreground color of the text.
+# The value is an RGB value of the format "u,u,u".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["fg-color"] = Q_("textattr|foreground color")
+
+# Translators: this attribute specifies whether a GdkBitmap is set for
+# stippling the foreground color. It will be a "true" or "false" value.
+# See
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["fg-stipple"] = Q_("textattr|foreground stipple")
+
+# Translators: this attribute specifies the effect applied to the font 
+# used by the text.
+# See:
+# http://www.w3.org/TR/2002/WD-css3-fonts-20020802/#font-effect
+#
+_textAttributeTable["font-effect"] = Q_("textattr|font effect")
+
+# Translators: this attribute specifies the indentation of the text
+# (in pixels).
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["indent"] = Q_("textattr|indent")
+
+# Translators: this attribute specifies whether the text is invisible.
+# It will be a "true" or "false" value.
+# See
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["invisible"] = Q_("textattr|invisible")
+
+# Translators: this attribute specifies how the justification of the text.
+# Values are "left", "right", "center" or "fill".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["justification"] = Q_("textattr|justification")
+
+# Translators: this attribute specifies the language that the text is
+# written in.
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["language"] = Q_("textattr|language")
+
+# Translators: this attribute specifies the pixel width of the left margin.
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["left-margin"] = Q_("textattr|left margin")
+
+# Translators: this attribute specifies the height of the line of text.
+# See:
+# http://www.w3.org/TR/1998/REC-CSS2-19980512/visudet.html#propdef-line-height
+#
+_textAttributeTable["line-height"] = Q_("textattr|line height")
+
+# Translators: this attribute refers to the named style which is associated
+# with the entire paragraph and which controls the default formatting 
+# (font, text size, alignment, etc.) of that paragraph. Examples of 
+# paragraph styles include "Heading 1", "Heading 2", "Caption", "Footnote",
+# "Text Body", "Title", and "Subtitle".
+#
+_textAttributeTable["paragraph-style"] = Q_("textattr|paragraph style")
+
+# Translators: this attribute specifies the pixels of blank space to 
+# leave above each newline-terminated line.
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["pixels-above-lines"] = Q_("textattr|pixels above lines")
+
+# Translators: this attribute specifies the pixels of blank space to
+# leave below each newline-terminated line.
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["pixels-below-lines"] = Q_("textattr|pixels below lines")
+
+# Translators: this attribute specifies the pixels of blank space to
+# leave between wrapped lines inside the same newline-terminated line
+# (paragraph).
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["pixels-inside-wrap"] = Q_("textattr|pixels inside wrap")
+
+# Translators: this attribute specifies the pixel width of the right margin.
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["right-margin"] = Q_("textattr|right margin")
+
+# Translators: this attribute specifies the number of pixels that the 
+# text characters are risen above the baseline.
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["rise"] = Q_("textattr|rise")
+
+# Translators: this attribute specifies the scale of the characters. The
+# value is a string representation of a double.
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["scale"] = Q_("textattr|scale")
+
+# Translators: this attribute specifies the size of the text.
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["size"] = Q_("textattr|size")
+
+# Translators: this attribute specifies the stretch of he text, if set.
+# Values are "ultra_condensed", "extra_condensed", "condensed",
+# "semi_condensed", "normal", "semi_expanded", "expanded",
+# "extra_expanded" or "ultra_expanded".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["stretch"] = Q_("textattr|stretch")
+
+# Translators: this attribute specifies whether the text is strike though
+# (in other words, whether there is a line drawn through it). Values are
+# "true" or "false".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["strikethrough"] = Q_("textattr|strike through")
+
+# Translators: this attribute specifies the slant style of the text,
+# if set. Values are "normal", "oblique" or "italic".
+# See: 
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["style"] = Q_("textattr|style")
+
+# Translators: this attribute specifies the decoration of the text.
+# See:
+# http://www.w3.org/TR/1998/REC-CSS2-19980512/text.html#propdef-text-decoration
+#
+_textAttributeTable["text-decoration"] = Q_("textattr|text decoration")
+
+# Translators: this attribute specifies the angle at which the text is
+# displayed (i.e. rotated from the norm) and is represented in degrees 
+# of rotation.
+# See:
+# http://www.w3.org/TR/2003/CR-css3-text-20030514/#glyph-orientation-horizontal
+#
+_textAttributeTable["text-rotation"] = Q_("textattr|text rotation")
+
+# Translators: this attribute specifies the shadow effects applied to the text.
+# See:
+# http://www.w3.org/TR/1998/REC-CSS2-19980512/text.html#propdef-text-shadow
+#
+_textAttributeTable["text-shadow"] = Q_("textattr|text shadow")
+
+# Translators: this attributes specifies whether the text is underlined.
+# Values are "none", "single", "double" or "low".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["underline"] = Q_("textattr|underline")
+
+# Translators: this attribute specifies the capitalization variant of
+# the text, if set. Values are "normal" or "small_caps".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["variant"] = Q_("textattr|variant")
+
+# Translators: this attributes specifies what vertical alignment property
+# has been applied to the text.
+# See:
+#http://www.w3.org/TR/1998/REC-CSS2-19980512/visudet.html#propdef-vertical-align
+#
+_textAttributeTable["vertical-align"] = Q_("textattr|vertical align")
+
+# Translators: this attribute specifies the weight of the text.
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+# http://www.w3.org/TR/1998/REC-CSS2-19980512/fonts.html#propdef-font-weight
+#
+_textAttributeTable["weight"] = Q_("textattr|weight")
+
+# Translators: this attribute specifies the wrap mode of the text, if any.
+# Values are "none", "char" or "word".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["wrap-mode"] = Q_("textattr|wrap mode")
+
+# Translators: this attribute specifies the way the text is written.
+# Whether the text is from left to right or right to left and whether it
+# is from top to bottom or bottom to top.
+#
+_textAttributeTable["writing-mode"] = Q_("textattr|writing mode")
+
+
+# The following are the known values of some of these text attributes.
+# These values were found in the Atk documentation at:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+# No doubt there will be more, and as they are found, they can be added
+# to this table so they can be translated.
+#
+
+# Translators: this is one of the text attribute values for the following
+# text attributes: "invisible", "editable", bg-full-height", "strikethrough",
+# "bg-stipple" and "fg-stipple".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["true"] = Q_("textattr|true")
+
+# Translators: this is one of the text attribute values for the following
+# text attributes: "invisible", "editable", bg-full-height", "strikethrough",
+# "bg-stipple" and "fg-stipple".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["false"] = Q_("textattr|false")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "underline", "wrap mode" and "direction".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["none"] = Q_("textattr|none")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "underline".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["single"] = Q_("textattr|single")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "underline".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["double"] = Q_("textattr|double")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "underline".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["low"] = Q_("textattr|low")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "wrap mode".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["char"] = Q_("textattr|char")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "wrap mode".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["word"] = Q_("textattr|word")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "direction".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["ltr"] = Q_("textattr|ltr")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "direction".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["rtl"] = Q_("textattr|rtl")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "justification".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["left"] = Q_("textattr|left")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "justification".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["right"] = Q_("textattr|right")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "justification".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["center"] = Q_("textattr|center")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "justification".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["fill"] = Q_("textattr|fill")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "stretch".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["ultra_condensed"] = Q_("textattr|ultra condensed")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "stretch".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["extra_condensed"] = Q_("textattr|extra condensed")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "stretch".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["condensed"] = Q_("textattr|condensed")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "stretch".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["semi_condensed"] = Q_("textattr|semi condensed")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "stretch" and "variant".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["normal"] = Q_("textattr|normal")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "stretch".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["semi_expanded"] = Q_("textattr|semi expanded")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "stretch".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["expanded"] = Q_("textattr|expanded")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "stretch".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["extra_expanded"] = Q_("textattr|extra expanded")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "stretch".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["ultra_expanded"] = Q_("textattr|ultra expanded")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "variant".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["small_caps"] = Q_("textattr|small caps")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "style".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["oblique"] = Q_("textattr|oblique")
+
+# Translators: this is one of the text attribute value for the following
+# text attributes: "style".
+# See:
+# http://library.gnome.org/devel/atk/1.22/AtkText.html#AtkTextAttribute
+#
+_textAttributeTable["italic"] = Q_("textattr|italic")
+
+
+def getTextAttributeKey(localizedTextAttr):
+    """Given a localized text attribute, return the original text 
+    attribute, (i.e. the key value).
+
+    Arguments:
+    - localizedTextAttr: the localized text attribute.
+
+    Returns a string representing the original text attribute key for the
+    localized text attribute.
+    """
+
+    if isinstance(localizedTextAttr, unicode):
+        localizedTextAttr = localizedTextAttr.encode("UTF-8")
+
+    for key, value in _textAttributeTable.items():
+        if value == localizedTextAttr:
+            return key
+
+    return localizedTextAttr
+
+def getTextAttributeName(textAttr):
+    """Given a text attribute, returns its localized equivalent.
+
+    Arguments:
+    - textAttr: the text attribute to get the localized equivalent of.
+
+    Returns a string representing the localized equivalent for the text
+    attribute.
+    """
+
+    if isinstance(textAttr, unicode):
+        textAttr = textAttr.encode("UTF-8")
+
+    try:
+        return _textAttributeTable[textAttr]
+    except:
+        return textAttr
+

Modified: trunk/src/orca/where_am_I.py
==============================================================================
--- trunk/src/orca/where_am_I.py	(original)
+++ trunk/src/orca/where_am_I.py	Mon Jun 23 20:37:18 2008
@@ -31,6 +31,7 @@
 import rolenames
 import settings
 import speech
+import text_attribute_names
 import urlparse, urllib2
 
 from orca_i18n import _ # for gettext support
@@ -1536,8 +1537,11 @@
                           "charDict: %s" % (charDict))
 
             for key in keys:
+                localizedKey = text_attribute_names.getTextAttributeName(key)
                 if key in charDict:
                     attribute = charDict[key]
+                    localizedValue = \
+                        text_attribute_names.getTextAttributeName(attribute)
                     if attribute:
                         # If it's the 'weight' attribute and greater than 400,
                         # just speak it as bold, otherwise speak the weight.
@@ -1551,15 +1555,15 @@
                         elif key == "underline":
                             if attribute != "none":
                                 attribStr += " "
-                                attribStr += key
+                                attribStr += localizedKey
 
                         elif key == "style":
                             if attribute != "normal":
                                 attribStr += " "
-                                attribStr += attribute
+                                attribStr += localizedValue
                         else:
                             attribStr += " "
-                            attribStr += (key + " " + attribute)
+                            attribStr += (localizedKey + " " + localizedValue)
 
             # Also check to see if this is a hypertext link.
             #



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]