Skip to content
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

Set default input and translation tables according to NVDA's language #17222

Merged
merged 36 commits into from
Oct 18, 2024

Conversation

nvdaes
Copy link
Collaborator

@nvdaes nvdaes commented Sep 26, 2024

Link to issue number:

Fixes #16390
Fixes #290

Summary of the issue:

By default, NVDA should set braille tables according to the current NVDA's language.

Description of user facing changes

When NVDA starts, if no default input and translation braille tables have been set, the default tables will be selected according to NVDA's languages. This will also happen when NVDA's language is changed.

Description of development approach

  • Modified the addTable function in the brailleTables module, to create dictionaries to associate languages with input and translation tables.
  • Modified config spec, and the handler of postConfigProfileSwitch in brailleOutput and braille modules, to set the appropriate table according to NVDA language
  • Modified gui function to aply changes when language is changed.

Testing strategy:

Checked that tables are changed in fresh configurations of NVDA, and when the language is changed from the gui.

Known issues with pull request:

None.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

Summary by CodeRabbit

  • New Features

    • Introduced automatic selection of braille tables based on user language settings.
    • Added the ability to exit the initial window using the escape key or alt+f4.
    • Enhanced reporting of font formatting shortcuts in Word and Outlook.
    • Added a VS Code workspace configuration for NVDA.
  • Bug Fixes

    • Improved error messaging for Windows errors during COM re-registrations.
  • Documentation

    • Updated user documentation to reflect changes in braille table settings and new features.
  • Chores

    • Updated coding standards for compatibility with modern linting tools.

@nvdaes nvdaes changed the title Set SetSettab Set default input and translation tables according to NVDA's language Sep 26, 2024
@AppVeyorBot
Copy link

See test results for failed build of commit e673b3dfdb

@nvdaes
Copy link
Collaborator Author

nvdaes commented Sep 27, 2024

@CyrilleB79 and others, I think that this is ready for a first review. After that, I'll ask on the translators mailing list before requesting a review to NV Access.

@AppVeyorBot
Copy link

See test results for failed build of commit e56f5e5500

Copy link
Collaborator

@LeonarddeR LeonarddeR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I have no time for an in depth review, here are some considerations:

  1. I wouldn't separate languages for input and for translation, only add the ability to provide the tables language. Then, in getDefaultTableForCurLang return the first thable that has that language and has output or input enabled, respectively.
  2. If there is an indention to use liblouis metadata somewhere in the future, It should be considered to retrieve the language from metadata as well.
  3. On a first glance, this pr doesn't deal properly with the input table set to auto, I couldn't faind changes in the brailleInput module. While at it, I'd consider having a getDefaultTableForCurLang function in braille that retrieves only output tables, and a similar function in brailleInput that retrieves input table. That way, the output and input systems are clearly separated.

@nvdaes
Copy link
Collaborator Author

nvdaes commented Sep 27, 2024

@LeonarddeR , thanks for your review. I guess you are in the right way with your comments.
Anyway, you wrote:

I wouldn't separate languages for input and for translation.

I think that they should be separated, since, for example, the input and translation table from German aren't the same.

On a first glance, this pr doesn't deal properly with the input table set to auto, I couldn't faind changes in the brailleInput module. While at it, I'd consider having a getDefaultTableForCurLang function in braille that retrieves only output tables, and a similar function in brailleInput that retrieves input table. That way, the output and input systems are clearly separated.

Probably I'm missing something here. But in practice, testing changes, when I run NVDA from source without configuring braille tables, in my system, Spanish grade1 is used for input and output.

@nvdaes
Copy link
Collaborator Author

nvdaes commented Sep 27, 2024

@coderabbitai, can you review this or provide suggestions?

@nvdaes nvdaes marked this pull request as ready for review September 27, 2024 12:18
@nvdaes nvdaes requested a review from a team as a code owner September 27, 2024 12:18
@nvdaes nvdaes requested a review from seanbudd September 27, 2024 12:18
@nvdaes
Copy link
Collaborator Author

nvdaes commented Sep 27, 2024

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Sep 27, 2024

Walkthrough

The pull request introduces enhancements to the braille table management in NVDA, including a new enumeration for table types, updated methods for handling language-specific braille tables, and modifications to configuration settings for automatic selection of tables based on the system language. The changes aim to improve user experience by aligning braille table defaults with the user's language settings.

Changes

Files Change Summary
source/brailleTables.py Introduced TableType enumeration, added dictionaries for mapping languages to braille tables, created getDefaultTableForCurLang and getDefaultTableForCurrentLang functions, and updated addTable and listTables methods.
source/config/configSpec.py Updated default values for translationTable and inputTable parameters from a specific file to auto.
user_docs/en/changes.md Documented enhancements including automatic table selection, improved exit options, and coding standards updates.

Assessment against linked issues

Objective Addressed Explanation
Input and output braille table should automatically be the system language (#16390)

Possibly related PRs

Suggested labels

component/liblouis, conceptApproved


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

coderabbitai bot commented Sep 27, 2024

Tip

For best results, initiate chat on the files or code changes.

@nvdaes: I've reviewed your changes. Great work on setting the default input and translation braille tables according to NVDA's language.

I noticed a few potential issues with the language codes used in the inputForLangs and translationForLangs parameters in the addTable function calls:

  • In the following line:

    addTable("ka-in-g1.utb", _("Kannada grade 1"), inputForLangs={"ka"}, translationForLangs={"ka"})

    The language code "ka" corresponds to Georgian. The correct ISO 639-1 code for Kannada is "kn". It should be:

    addTable("ka-in-g1.utb", _("Kannada grade 1"), inputForLangs={"kn"}, translationForLangs={"kn"})
  • Similarly, in:

    addTable("km-g1.utb", _("Khmer grade 1"), inputForLangs={"kmr"}, translationForLangs={"kmr"})

    The language code "kmr" corresponds to Northern Kurdish. The correct code for Khmer is "km". It should be:

    addTable("km-g1.utb", _("Khmer grade 1"), inputForLangs={"km"}, translationForLangs={"km"})

I recommend reviewing and updating the language codes to ensure they match the correct ISO codes for the respective languages.

Additionally, in some instances, the Translators comments are included inside the addTable function calls, which might not align with the project's coding standards. It may be better to place these comments outside the function calls to maintain readability and consistency.

Moreover, to enhance maintainability, consider adding unit tests to verify the mappings between languages and braille tables. This can help prevent similar issues in the future.

Let me know if you have any questions or need further assistance.

🔗 Analysis chain
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Fetch the diff of PR #17222
gh pr diff 17222

Length of output: 28876

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Outside diff range and nitpick comments (3)
user_docs/en/changes.md (3)

Line range hint 6-10: Consider adding more context to the 2025.1 release notes

The 2025.1 release notes are quite brief compared to other releases. Consider adding more details about the significance of these changes, especially for users who may not be familiar with the technical aspects.


Line range hint 18-22: Consider elaborating on the changes

While the changes are clearly stated, it might be helpful to provide a brief explanation of why these changes were made or how they benefit users.


Line range hint 29-35: Consider adding more context to developer changes

The changes for developers section is quite technical. Consider adding brief explanations of why these changes were made or how they impact development.

📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 1573904 and 8bbb65b.

📒 Files selected for processing (3)
  • source/brailleTables.py (37 hunks)
  • source/config/configSpec.py (1 hunks)
  • user_docs/en/changes.md (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
source/brailleTables.py (2)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious. When providing code suggestions, particularly when requested, ensure GitHub's suggestion format is used, i.e.: suggestion <code changes>


Pattern **/*.py: _, pgettext, ngettext, and ngettext are defined globally, errors for this being undefined can be ignored.

source/config/configSpec.py (2)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious. When providing code suggestions, particularly when requested, ensure GitHub's suggestion format is used, i.e.: suggestion <code changes>


Pattern **/*.py: _, pgettext, ngettext, and ngettext are defined globally, errors for this being undefined can be ignored.

user_docs/en/changes.md (3)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious. When providing code suggestions, particularly when requested, ensure GitHub's suggestion format is used, i.e.: suggestion <code changes>


Pattern **/*.md: Focus on grammar, spelling, and punctuation. Also consider readability and clarity of contents. Ensure that changes follow the style of one sentence per line, suggest changes if this is not met.


Pattern user_docs/en/changes.md: Ensure each change log entry references an issue or pull request number. Change log entries can also include a reference to a GitHub author. Examples of valid change log entries: * Item with sub-items (#123, @username): * sub-item * bar (#342) * Item with. Multiple lines. (#143)

🔇 Additional comments (9)
source/config/configSpec.py (1)

74-75: LGTM! Improved default configuration for braille tables.

The changes to set auto as the default value for both translationTable and inputTable are excellent improvements. They align perfectly with the PR objectives and address the issue of NVDA defaulting to English braille tables regardless of the system language. This modification will significantly enhance the user experience, especially for non-English users and beginners, by automatically selecting appropriate braille tables based on the current language setting of NVDA.

user_docs/en/changes.md (8)

Line range hint 1-4: LGTM: Clear and concise title and introduction

The title "What's New in NVDA" and the brief introduction are clear and appropriate for a changelog document.


Line range hint 12-16: LGTM: Clear and concise new features section

The new features are well-described and easy to understand.


Line range hint 24-27: LGTM: Clear bug fixes section

The bug fixes are well-described and easy to understand.


Line range hint 37-41: LGTM: Informative introduction to 2024.4 release

The introduction provides a good overview of the key features in this release.


Line range hint 43-56: LGTM: Comprehensive new features section

The new features are well-described with good detail. The use of bullet points makes it easy to read.


Line range hint 58-64: LGTM: Clear changes section

The changes are clearly described and easy to understand.


Line range hint 66-84: LGTM: Detailed bug fixes section

The bug fixes are well-described with good technical detail.


Line range hint 86-103: LGTM: Comprehensive developer changes section

The changes for developers are well-documented and provide good technical detail.

source/brailleTables.py Outdated Show resolved Hide resolved
source/brailleTables.py Outdated Show resolved Hide resolved
source/brailleTables.py Outdated Show resolved Hide resolved
source/brailleTables.py Outdated Show resolved Hide resolved
source/brailleTables.py Outdated Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@nvdaes nvdaes marked this pull request as draft September 27, 2024 12:45
@nvdaes nvdaes marked this pull request as ready for review September 28, 2024 03:26
@nvdaes
Copy link
Collaborator Author

nvdaes commented Sep 28, 2024

@coderabbitai review

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 8bbb65b and 8b2b3f1.

📒 Files selected for processing (1)
  • source/brailleTables.py (37 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
source/brailleTables.py (2)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious. When providing code suggestions, particularly when requested, ensure GitHub's suggestion format is used, i.e.: suggestion <code changes>


Pattern **/*.py: _, pgettext, ngettext, and ngettext are defined globally, errors for this being undefined can be ignored.

📓 Learnings (1)
source/brailleTables.py (2)
Learnt from: nvdaes
PR: nvaccess/nvda#17222
File: source/brailleTables.py:112-113
Timestamp: 2024-09-27T12:32:22.176Z
Learning: The project uses the `set[str] | None` type hint syntax, so it's acceptable to use it even though it requires Python 3.10 or newer.
Learnt from: nvdaes
PR: nvaccess/nvda#17222
File: source/brailleTables.py:33-37
Timestamp: 2024-09-27T12:28:02.907Z
Learning: In this project, `StrEnum` is used; it's acceptable to use `StrEnum` even though it requires Python 3.11.
🔇 Additional comments (9)
source/brailleTables.py (9)

Line range hint 20-37: LGTM: New import and TableType enum look good.

The addition of the languageHandler import and the new TableType enum are well-structured and provide clear categorization for table types. The use of StrEnum is consistent with the project's practices.


80-85: LGTM: New language mapping dictionaries added.

The addition of _inputTableForLangs and _translationTableForLangs dictionaries provides a clear structure for mapping languages to their respective braille table filenames. This change aligns well with the PR's objective of enhancing language-specific braille table management.


115-116: LGTM: New parameters for language-specific table assignment.

The addition of inputForLangs and translationForLangs parameters to the addTable function enhances its flexibility, allowing for language-specific table assignments. The type hint set[str] | None is correctly used and aligns with the project's practices.


126-127: LGTM: Clear documentation for new parameters.

The added documentation for the inputForLangs and translationForLangs parameters is clear and consistent with the existing documentation style. It provides sufficient information for developers using this function.


133-138: LGTM: Efficient implementation of language-specific table assignments.

The new logic for populating the _inputTableForLangs and _translationTableForLangs dictionaries is well-implemented. It efficiently handles both input and translation table assignments for multiple languages.


146-147: LGTM: Proper handling of "auto" table selection.

The addition of logic to handle the "auto" table selection is a good safeguard. It ensures that a default table is used when "auto" is specified, preventing potential errors in table lookup.


864-867: LGTM: Implemented automatic table selection based on current language.

The new logic for setting default input and translation tables based on the current language is well-implemented. It correctly uses the getDefaultTableForCurLang function for both translation and input tables, fulfilling the main objective of the PR to enhance language-specific braille table selection.


Line range hint 1-867: Overall assessment: Well-implemented enhancements to braille table management.

The changes in this file successfully implement the objectives of the PR, enhancing language-specific braille table management. The code is well-structured, consistent with existing patterns, and introduces clear improvements in functionality. A few minor points were raised for improvement, but overall, the implementation is solid and achieves its goals.

Key improvements:

  1. Introduction of TableType enum for clear categorization.
  2. New dictionaries for mapping languages to table filenames.
  3. Implementation of getDefaultTableForCurLang function.
  4. Enhanced addTable function with language-specific assignments.
  5. Comprehensive updates to table assignments for various languages.
  6. Automatic table selection based on the current language.

These changes should significantly improve the user experience for non-English NVDA users by providing more accurate and language-specific braille table selections.


197-197: LGTM: Comprehensive update of language-specific table assignments.

The updates to multiple addTable calls with the new inputForLangs and translationForLangs parameters are consistent and align well with the PR objectives. The changes cover a wide range of languages and seem to improve language-specific table selection.

To ensure the accuracy of these assignments, please run the following verification script:

This script will help identify any potential inconsistencies in language code usage and provide a list of all used language codes for manual review.

Also applies to: 212-212, 218-218, 239-239, 242-242, 245-245, 263-263, 273-273, 311-311, 315-315, 325-325, 364-364, 373-373, 379-379, 382-382, 405-405, 411-411, 426-426, 432-432, 438-438, 444-444, 450-450, 476-476, 485-485, 497-497, 515-515, 530-530, 539-539, 545-545, 557-557, 566-566, 590-590, 599-599, 608-608, 629-629, 635-635, 651-651, 683-683, 698-698, 701-701, 716-716, 725-725, 737-737, 746-746, 762-770, 775-784, 794-794

✅ Verification successful

Next Steps: Correcting the Shell Script for Verification

The previous verification script failed due to an unrecognized file type. Let's update the rg command to use the correct file type for Python.

Please run the following updated verification script:

This updated script uses the correct --type py for Python files, which should resolve the previous error and allow for proper verification of the language code assignments.


Action Required: Refine the Verification Script to Exclude Irrelevant Lines

The previous script included unintended entries due to lines not matching the expected pattern. Let's refine the script to ensure only relevant lines are processed.

Please run the following updated verification script:

Changes Made:

  • Added grep 'Langs={' to filter only lines containing the Langs parameter.
  • Updated the sed command to accurately capture content within Langs={...} by using ([^}]+) instead of (.+) to prevent overmatching.

This should eliminate the unintended source/brailleTables.py- entries and provide a clean list of language codes for verification.


Action Required: Update the Verification Script to Target Correct Language Parameters

The previous script incorrectly targeted Langs={ instead of the actual parameters inputForLangs={ and translationForLangs={. This caused unintended lines to be processed. Let's refine the script to accurately extract the language codes.

Please run the following updated verification script:

Changes Made:

  • Grep Pattern: Updated to search specifically for inputForLangs={ and translationForLangs={.
  • Separate Extraction: Handled inputForLangs and translationForLangs separately to ensure accurate parsing.
  • Output Clarity: Added separate sections in the output for inputForLangs and translationForLangs for better manual review.

This refined script should accurately extract and list all language codes used in the addTable calls without capturing unrelated lines.


Verification Successful: Language Code Assignments are Consistent

All addTable calls have been verified for consistency in their inputForLangs and translationForLangs parameters. No inconsistencies or unintended entries were found, and all language codes are correctly assigned as per the PR objectives.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of language codes used in addTable calls

# Test: Check for any inconsistencies in language codes
rg --type python 'addTable\(' -A 10 | grep -E 'inputForLangs|translationForLangs' | \
  sed -E 's/.*Langs=\{(.+)\}.*/\1/' | tr ',' '\n' | sort | uniq -c | \
  awk '$1 == 1 {print "Unique language code:", $2}'

# Test: List all used language codes for manual review
echo "All used language codes:"
rg --type python 'addTable\(' -A 10 | grep -E 'inputForLangs|translationForLangs' | \
  sed -E 's/.*Langs=\{(.+)\}.*/\1/' | tr ',' '\n' | sort | uniq

Length of output: 467


Script:

# 
#!/bin/bash
# Description: Verify the consistency of language codes used in addTable calls

# Test: Check for any inconsistencies in language codes
rg --type py 'addTable\(' -A 10 | grep -E 'inputForLangs|translationForLangs' | \
  sed -E 's/.*Langs=\{(.+)\}.*/\1/' | tr ',' '\n' | sort | uniq -c | \
  awk '$1 == 1 {print "Unique language code:", $2}'

# Test: List all used language codes for manual review
echo "All used language codes:"
rg --type py 'addTable\(' -A 10 | grep -E 'inputForLangs|translationForLangs' | \
  sed -E 's/.*Langs=\{(.+)\}.*/\1/' | tr ',' '\n' | sort | uniq

Length of output: 2087


Script:

# 
#!/bin/bash
# Description: Verify the consistency of language codes used in addTable calls

# Test: Check for any inconsistencies in language codes
rg --type py 'addTable\(' -A 10 | grep -E 'inputForLangs|translationForLangs' | \
  grep 'Langs={' | sed -E 's/.*Langs=\{([^}]+)\}.*/\1/' | tr ',' '\n' | sort | uniq -c | \
  awk '$1 == 1 {print "Unique language code:", $2}'

# Test: List all used language codes for manual review
echo "All used language codes:"
rg --type py 'addTable\(' -A 10 | grep -E 'inputForLangs|translationForLangs' | \
  grep 'Langs={' | sed -E 's/.*Langs=\{([^}]+)\}.*/\1/' | tr ',' '\n' | sort | uniq

Length of output: 1900


Script:

# 
#!/bin/bash
# Description: Verify the consistency of language codes used in addTable calls

# Test: Check for any inconsistencies in language codes
rg --type py 'addTable\(' -A 10 | grep -E 'inputForLangs=\{' | \
  sed -E 's/.*inputForLangs=\{([^}]+)\}.*/\1/' | tr ',' '\n' | sort | uniq -c | \
  awk '$1 == 1 {print "Unique language code:", $2}'

rg --type py 'addTable\(' -A 10 | grep -E 'translationForLangs=\{' | \
  sed -E 's/.*translationForLangs=\{([^}]+)\}.*/\1/' | tr ',' '\n' | sort | uniq -c | \
  awk '$1 == 1 {print "Unique language code:", $2}'

# Test: List all used language codes for manual review
echo "All used language codes from inputForLangs:"
rg --type py 'addTable\(' -A 10 | grep -E 'inputForLangs=\{' | \
  sed -E 's/.*inputForLangs=\{([^}]+)\}.*/\1/' | tr ',' '\n' | sort | uniq

echo "All used language codes from translationForLangs:"
rg --type py 'addTable\(' -A 10 | grep -E 'translationForLangs=\{' | \
  sed -E 's/.*translationForLangs=\{([^}]+)\}.*/\1/' | tr ',' '\n' | sort | uniq

Length of output: 3951

source/brailleTables.py Outdated Show resolved Hide resolved
@nvdaes
Copy link
Collaborator Author

nvdaes commented Sep 28, 2024

@coderabbitai review

@nvdaes nvdaes marked this pull request as ready for review October 18, 2024 05:36
@nvdaes
Copy link
Collaborator Author

nvdaes commented Oct 18, 2024

Thanks @seanbudd . I agree with all your suggestions and should be commited now.

@seanbudd
Copy link
Member

Thanks @nvdaes

@seanbudd seanbudd merged commit 64ba6c6 into nvaccess:master Oct 18, 2024
5 checks passed
@seanbudd
Copy link
Member

Congrats on another 3 digit issue solved!

@github-actions github-actions bot added this to the 2025.1 milestone Oct 18, 2024
@@ -1125,6 +1125,8 @@ def _updateCurrentMirrorURL(self):

def postSave(self):
if self.oldLanguage != config.conf["general"]["language"]:
config.conf["braille"]["translationTable"] = "auto"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I consider this to be a bit aggressive actually. I sometimes change my NVDA language from Dutch to English, and then my braille tables will get changed without notice.

@nvdaes
Copy link
Collaborator Author

nvdaes commented Oct 18, 2024

@LeonarddeR , I like this behavior, but a checkbox or something maybe added for this option. Maybe done in a different PR.

@Adriani90
Copy link
Collaborator

I agree this is too aggressive. I can understand some japanese when hearing, but I cannot read japanese Braille. This pr should definitely have an optional checkbox or auto entry in the combo boxes. Otherwise users of braille will be really confused.

@LeonarddeR
Copy link
Collaborator

Personally, I also prefer the auto entry in the combo boxes.

@nvdaes
Copy link
Collaborator Author

nvdaes commented Oct 18, 2024

I think that these aspects should be discussed in a new issue. I prefer a checkbox since the auto option makes difficult to know what table is currently selected.
In the case of voice variants, they are automatically selected when NVDA's language is changed without warning. I understand that changing braille tables can have other effects, but I think that this can be discussed before an implementation, and having this merged makes possible to test this now.

@Adriani90
Copy link
Collaborator

Adriani90 commented Oct 18, 2024 via email

@nvdaes
Copy link
Collaborator Author

nvdaes commented Oct 18, 2024

@Adriani90 , I'll create a PR with a checkbox this weekend.
You are a member of the community with experience triaging issues, so I'll trust you if you say that this doesn't need to be triaged.

@LeonarddeR
Copy link
Collaborator

I really believe that we should go back to the drawing board first. Let's first list the options and carefully weigh the pros and cons.

@cary-rowen
Copy link
Contributor

There are enough controls in the braille panel, and I think using "Auto (follow system language)" in the language selection combo box is a good solution.

@CyrilleB79
Copy link
Collaborator

It has already been written before. But I'd really encourage people to discuss this in a new issue.

It's obvious that not all participant in this discussion agree on the best solution.
Discussing in a new issue would allow:

  • to summarize the issue with the current solution (the one present in alpha) with an issue template, e.g. steps to reproduce the issue.
  • to allow to present the various alternatives and ppros / cons for each possible solution in a more organized way.

I have no opinion for now on the solution because, I have not reviewed the current implementation.
Note that in the possible solutions, we may also have "Auto" with the name of the language between brackets, as done in the language combo-box when starting NVDA with the --lang command line flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.
Projects
None yet
8 participants