Repository navigation
Add plural forms for needed strings in NVDA's code base #15864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
34d8487
95dc8f6
f1fc977
d6318de
8d7942d
fca18e1
bad1de6
9b6ffe5
009744a
d3e70e4
795a6dd
dcea438
72f6475
4024f2f
0f2fef6
6a3f2c6
9cc41e3
5b4b35c
70d32e4
3ec7c14
93abb27
6db8c7d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1883,10 +1883,18 @@ def getPropertiesSpeech( # noqa: C901 | |
| rowCount=propertyValues.get('rowCount',0) | ||
| columnCount=propertyValues.get('columnCount',0) | ||
| if rowCount and columnCount: | ||
| # Translators: Sub-part of the compound string to speak number of columns and rows in a table | ||
| rowCountTranslation: str = _("{rowCount} rows").format(rowCount=rowCount) | ||
| # Translators: Sub-part of the compound string to speak number of columns and rows in a table | ||
| colCountTranslation: str = _("{columnCount} columns").format(columnCount=columnCount) | ||
| rowCountTranslation: str = ngettext( | ||
| # Translators: Sub-part of the compound string to speak number of columns and rows in a table | ||
| "{rowCount} row", | ||
| "{rowCount} rows", | ||
| rowCount, | ||
| ).format(rowCount=rowCount) | ||
| colCountTranslation: str = ngettext( | ||
| # Translators: Sub-part of the compound string to speak number of columns and rows in a table | ||
| "{columnCount} column", | ||
| "{columnCount} columns", | ||
| columnCount, | ||
| ).format(columnCount=columnCount) | ||
| # Translators: Main part of the compound string to speak number of columns and rows in a table | ||
| # Example output: "with 3 rows and 2 columns" | ||
| # In this example {rowCountTranslation} will be replaced by "3 rows" and {colCountTranslation} by | ||
|
|
@@ -2791,12 +2799,21 @@ def getTableInfoSpeech( | |
| newTable=False | ||
| textList=[] | ||
| if newTable: | ||
| # Translators: Sub-part of the compound string to report a table | ||
| columnCount=tableInfo.get("column-count",0) | ||
| # Translators: Sub-part of the compound string to report a table | ||
| rowCount=tableInfo.get("row-count",0) | ||
| columnCountText = _("{columnCount} columns").format(columnCount=columnCount) | ||
| rowCountText = _("{rowCount} rows").format(rowCount=rowCount) | ||
| columnCountText = ngettext( | ||
| # Translators: Sub-part of the compound string to report a table | ||
| "{columnCount} column", | ||
| "{columnCount} columns", | ||
| columnCount, | ||
| ).format(columnCount=columnCount) | ||
| rowCountText = ngettext( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps all these repeated components should be factored out into helper functions that just take the count? e.g.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I do not understand which part of the code I can put in a common helper function. Could you clarify please?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The following component is repeated multiple times in this code, same with the row equivalent:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @seanbudd, I do not see the point in making a helper function to just call If you do not agree with this approach, I can revert this change.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it should be reverted. The reason this was suggested is there is 2 instances of each of these components. The current approach doesn't remove the duplication - the components are still here, only the other usage of the components were refactored.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK I got it. Done in 6db8c7d. Note that I have kept the function |
||
| # Translators: Sub-part of the compound string to report a table | ||
| "{rowCount} rows", | ||
| "{rowCount} rows", | ||
| rowCount, | ||
| ).format(rowCount=rowCount) | ||
| # Translators: Main part of the compound string to report a table | ||
| # Example output: table with 3 columns and 5 rows | ||
| # {columnCountText} is replaced by "3 columns" and {rowCountText} by "5 rows" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.