@@ -1882,9 +1882,36 @@ def getPropertiesSpeech( # noqa: C901
18821882 textList .append (rowColSpanTranslation )
18831883 rowCount = propertyValues .get ('rowCount' ,0 )
18841884 columnCount = propertyValues .get ('columnCount' ,0 )
1885- rowAndColumnCountText = _rowAndColumnCountText (rowCount , columnCount )
1886- if rowAndColumnCountText :
1887- textList .append (rowAndColumnCountText )
1885+ if rowCount and columnCount :
1886+ rowCountTranslation : str = ngettext (
1887+ # Translators: Sub-part of the compound string to speak number of columns and rows in a table
1888+ "{rowCount} row" ,
1889+ "{rowCount} rows" ,
1890+ rowCount ,
1891+ ).format (rowCount = rowCount )
1892+ colCountTranslation : str = ngettext (
1893+ # Translators: Sub-part of the compound string to speak number of columns and rows in a table
1894+ "{columnCount} column" ,
1895+ "{columnCount} columns" ,
1896+ columnCount ,
1897+ ).format (columnCount = columnCount )
1898+ # Translators: Main part of the compound string to speak number of columns and rows in a table
1899+ # Example output: "with 3 rows and 2 columns"
1900+ # In this example {rowCountTranslation} will be replaced by "3 rows" and {colCountTranslation} by
1901+ # "2 columns"
1902+ rowAndColCountTranslation : str = _ ("with {rowCountTranslation} and {colCountTranslation}" ).format (
1903+ rowCountTranslation = rowCountTranslation ,
1904+ colCountTranslation = colCountTranslation ,
1905+ )
1906+ textList .append (rowAndColCountTranslation )
1907+ elif columnCount and not rowCount :
1908+ # Translators: Speaks number of columns (example output: with 4 columns).
1909+ columnCountTransation : str = ngettext ("with %s column" , "with %s columns" , columnCount ) % columnCount
1910+ textList .append (columnCountTransation )
1911+ elif rowCount and not columnCount :
1912+ # Translators: Speaks number of rows (example output: with 2 rows).
1913+ rowCountTranslation : str = ngettext ("with %s row" , "with %s rows" , rowCount ) % rowCount
1914+ textList .append (rowCountTranslation )
18881915 if rowCount or columnCount :
18891916 # The caller is entering a table, so ensure that it is treated as a new table, even if the previous table was the same.
18901917 _speechState .oldTableID = None
@@ -1944,37 +1971,6 @@ def getPropertiesSpeech( # noqa: C901
19441971 return textList
19451972
19461973
1947- def _rowAndColumnCountText (rowCount : int , columnCount : int ) -> Optional [str ]:
1948- if rowCount and columnCount :
1949- rowCountTranslation : str = ngettext (
1950- # Translators: Sub-part of the compound string to speak number of columns and rows in a table
1951- "{rowCount} row" ,
1952- "{rowCount} rows" ,
1953- rowCount ,
1954- ).format (rowCount = rowCount )
1955- colCountTranslation : str = ngettext (
1956- # Translators: Sub-part of the compound string to speak number of columns and rows in a table
1957- "{columnCount} column" ,
1958- "{columnCount} columns" ,
1959- columnCount ,
1960- ).format (columnCount = columnCount )
1961- # Translators: Main part of the compound string to speak number of columns and rows in a table
1962- # Example output: "with 3 rows and 2 columns"
1963- # In this example {rowCountTranslation} will be replaced by "3 rows" and {colCountTranslation} by
1964- # "2 columns"
1965- return _ ("with {rowCountTranslation} and {colCountTranslation}" ).format (
1966- rowCountTranslation = rowCountTranslation ,
1967- colCountTranslation = colCountTranslation ,
1968- )
1969- elif columnCount and not rowCount :
1970- # Translators: Speaks number of columns (example output: with 4 columns).
1971- return ngettext ("with %s column" , "with %s columns" , columnCount ) % columnCount
1972- elif rowCount and not columnCount :
1973- # Translators: Speaks number of rows (example output: with 2 rows).
1974- return ngettext ("with %s row" , "with %s rows" , rowCount ) % rowCount
1975- return None
1976-
1977-
19781974def _shouldSpeakContentFirst (
19791975 reason : OutputReason ,
19801976 role : int ,
0 commit comments