Skip to content

Add ability to get the GitHub URL for any repo to generate xliff files from markdown#7

Merged
seanbudd merged 10 commits into
nvaccess:mainfrom
nvdaes:markdownTranslate
May 21, 2026
Merged

Add ability to get the GitHub URL for any repo to generate xliff files from markdown#7
seanbudd merged 10 commits into
nvaccess:mainfrom
nvdaes:markdownTranslate

Conversation

@nvdaes

@nvdaes nvdaes commented May 19, 2026

Copy link
Copy Markdown

Description

This PR adds the possibility to generate xliff files from markdown for any GitHub repository.
Previously, this was possible just for NVDA.

Development approach

A new function has been created to get the raw URL for the content of any GitHub repository. This can be used to run an md2xliff command from a GitHub repository.

Tests

I've tested this locally, running the md2xliff command in two different repos, including NVDA and nvdal10n from NV Access.

Copilot AI review requested due to automatic review settings May 19, 2026 18:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors markdownTranslate for readability and adds a new md2xliff CLI command in l10nUtil, including logic to derive a raw GitHub URL from the repository’s origin remote instead of relying on a hard-coded constant.

Changes:

  • Add md2xliff command to l10nUtil to convert Markdown to XLIFF.
  • Replace hard-coded raw GitHub repo URL with dynamic detection from git remote origin.
  • Reformat/tidy various call sites and helper functions for brevity.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
source/markdownTranslate.py Removes hard-coded raw GitHub URL and introduces repo URL detection helper; mostly formatting refactors.
source/l10nUtil.py Adds new md2xliff subcommand wiring to markdownTranslate.generateXliff.
Comments suppressed due to low confidence (1)

source/markdownTranslate.py:97

  • getGithubRepoURL() is annotated/documented to return str | None, but it never returns None (it raises on failure) and its callers treat it as a str. Either change the return type/docstring to str or implement a None/fallback behavior and handle it in callers to avoid type-check failures and confusing API semantics.
def getGithubRepoURL() -> str | None:
	"""
	Get the GitHub repository URL from git remote origin.
	return: The raw GitHub URL for the repository, or None if it cannot be determined.
	"""

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread source/l10nUtil.py Outdated
Comment thread source/markdownTranslate.py
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@seanbudd

Copy link
Copy Markdown
Member

Thanks @nvdaes - could you make the PR description and title more clear?

@nvdaes nvdaes changed the title markdownTranslate Add ability to get the GitHub URL for any repo to generate xliff files from markdown May 20, 2026
@nvdaes nvdaes force-pushed the markdownTranslate branch from 0240b06 to 6aa1b97 Compare May 20, 2026 15:05
@nvdaes

nvdaes commented May 20, 2026

Copy link
Copy Markdown
Author

@seanbudd , I've updated the description for this PR. I've tested this locally in two different repos, including NVDA and nvdal10n.

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @nvdaes - can you explain the large number of whitespace/lint changes?

Comment thread source/markdownTranslate.py Outdated
Comment thread source/markdownTranslate.py Outdated
Comment thread source/markdownTranslate.py Outdated
@nvdaes

nvdaes commented May 21, 2026

Copy link
Copy Markdown
Author

@seanbudd , now all check pass, but note that this is not true for pyright locally.
Also, according to copilot, the right word for docstring is returns, not return. Not sure if this suggestion is true.

@seanbudd

Copy link
Copy Markdown
Member

Yes I think it should be return

Comment thread source/markdownTranslate.py Outdated
@seanbudd seanbudd merged commit e8f5073 into nvaccess:main May 21, 2026
2 checks passed
@wmhn1872265132

Copy link
Copy Markdown

Please note that l10nUtil.py seems to only provide generateXliff; updateXliff should also be provided.

@nvdaes

nvdaes commented May 21, 2026

Copy link
Copy Markdown
Author

wmhn1872265132
commented

Please note that l10nUtil.py seems to only provide generateXliff; updateXliff should also be provided.

Yes, I think you're right. I'll create another PR if someone doesn't create it before me.

@wmhn1872265132

Copy link
Copy Markdown

By the way, can you fix nvdaes#5 at the same time?

@nvdaes

nvdaes commented May 21, 2026

Copy link
Copy Markdown
Author

@wmhn1872265132 , I've created PR #8, but I don't want how to fix nvdaes#5.
You may create an issue on this repo to see if someone can fix it.

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.

4 participants