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

Beta to master #17109

Merged
merged 6 commits into from
Sep 3, 2024
Merged

Beta to master #17109

merged 6 commits into from
Sep 3, 2024

Conversation

seanbudd
Copy link
Member

@seanbudd seanbudd commented Sep 3, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a CodeQL code scanning workflow to enhance code security by identifying vulnerabilities.
    • Implemented an automated workflow for updating English user documentation and its translations.
    • Added functionality to generate Markdown files from localized XLIFF files.
    • Launched a utility for managing markdown translations through XLIFF files, including generation and updating capabilities.
  • Tests

    • Added a comprehensive suite of unit tests for the markdown translation module to validate its functionality.

michaelDCurran and others added 6 commits September 2, 2024 13:32
Currently user documentation such as the user guide are made translatable via a custom (and very old) translation system hosted by NV Access. For many reasons we need to move away from this old system to something more mainstream and maintainable. We have already successfully moved translation of NVDA interface messages to Crowdin, and we should do the same for the user guide and other documentation.

Description of development approach
• Added markdownTranslate.py, which contains several commands for generating and updating xliff files from markdown files. These xliff files can then be uploaded to Crowdin for translation, and eventually downloaded again and converted back to markdown files. Commands include: 
◦ generateXliff: to generate an xliff file from a markdown file. Firstly a 'skeleton' of the markdown file is produced which is all the structure of a markdown file, but the translatable content on each line has been replaced by a special translation ID. Lines such as blank lines, hidden header rows, or table header separator lines are included in the skeleton in tact and are not available for translation. The xliff file is then produced, which contains one translatable string per translation unit, keyed by its respective translation ID. Each unit also contains translator notes to aide in translation, such as the line number, and any prefix or suffix markdown structure. E.g. a heading might have a prefix of ### and a suffix of {#Intro}. The skeleton is also embedded into the xliff file so that it is possible to update the xliff file keeping existing translation IDs, and or generate the existing markdown file from the xliff file.
◦ generateMarkdown: Given an xliff file, the original markdown file is reproduced from the embedded skeleton, using either the translated or source strings from the xliff file, depending on whether you want a translated or untranslated markdown file.
◦ updateXliff: to update an existing xliff file with changes from a markdown file, ensuring that IDs of existing translatable strings are kept in tact. This command extracts the skeleton from the xliff file, makes a diff of the old and new markdown files, then applies this diff to the skeleton file I.e. removes skeleton lines that were removed from the markdown file, and adds skeleton lines (with new IDs) for lines that are newly added to the markdown file. All existing lines stay as is, keeping their existing translation IDs. Finally a new xliff file is generated from the up to date markdown file and skeleton, resulting in an xliff file that contains all translatable strings from the new markdown file, but reusing translation IDs for existing strings.
◦ translateXliff: given an xliff file, and a pretranslated markdown file that matches the skeleton, a new xliff file is produced containing translations for all strings.
◦ pretranslateAllPossibleLangs: this walks the NVDA user_docs directory, and for each language, pretranslates the English xliff file using the existing pretranslated markdown file from the old translation system (if it matches the skeleton exactly) producing a translated xliff file that can be uploaded to Crowdin to bring an existing translation up to where it was in the old system.
• Added a generated xliff file for the current English user guide markdown file. Note that this has been uploaded to Crowdin for translation.
• Added a GitHub action that runs on the beta branch if English userGuide.md changes. The action regenerates the original markdown file from the current English user guide xliff, then updates the xliff file based on the changes from the original markdown file to the current markdown file. This xliff file is then uploaded to Crowdin, and also committed and pushed to beta.
Due to very good and strict permissions on branches such as beta, A normal GitHub action token cannot push to the branch.
Description of development approach
Push via ssh using a deploy key.
Summary of the issue:
CodeQL scanning was set up via the UI.
We want to configure this via YML, so we can set the branches that it runs on more easily.

Description of development approach
Uses default template to set up python scanning on master, beta,rc
@seanbudd seanbudd requested a review from a team as a code owner September 3, 2024 05:42
Copy link
Contributor

coderabbitai bot commented Sep 3, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The changes introduce two new GitHub Actions workflows for automating code scanning and documentation updates, alongside a new Python utility for managing markdown translations via XLIFF files. The workflows facilitate security assessments and streamline the synchronization of user documentation and translations. Additionally, a comprehensive suite of unit tests for the markdown translation module is added, ensuring functionality and correctness. The modifications enhance the overall documentation and security processes within the codebase.

Changes

File(s) Change Summary
.github/workflows/codeql.yml, .github/workflows/regenerate_english_userDocs_translation_source.yml New workflows for CodeQL code scanning and updating English user documentation translations.
sconstruct, user_docs/markdownTranslate.py New functionality to process localized .xliff files and manage markdown translations.
tests/unit/test_markdownTranslate.py Introduction of unit tests for the markdownTranslate module to validate translation functionalities.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant GitHubActions
    participant CodeQL
    participant MarkdownTranslate

    Developer->>GitHubActions: Push changes
    GitHubActions->>CodeQL: Trigger code scanning
    CodeQL->>GitHubActions: Report vulnerabilities
    GitHubActions->>MarkdownTranslate: Update documentation on push
    MarkdownTranslate->>GitHubActions: Commit changes if needed
    GitHubActions->>Developer: Notify results
Loading

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

Tip

Early access features: enabled

We are currently testing the following features in early access:

  • Anthropic claude-3-5-sonnet for code reviews: Anthropic claims that the new Claude model has stronger code understanding and code generation capabilities than their previous models. Note: Our default code review model was also updated late last week. Please compare the quality of the reviews between the two models by toggling the early access feature.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues on the discussion post.

@seanbudd seanbudd merged commit 805fb12 into master Sep 3, 2024
2 of 5 checks passed
@github-actions github-actions bot added this to the 2025.1 milestone Sep 3, 2024
user_docs/markdownTranslate.py Dismissed Show dismissed Hide dismissed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants