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

Link to correct line when editing a translation #1075

Open
mgeisler opened this issue Aug 13, 2023 · 6 comments
Open

Link to correct line when editing a translation #1075

mgeisler opened this issue Aug 13, 2023 · 6 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@mgeisler
Copy link
Collaborator

On a whim, I tried adding a #Lnnn fragment to a URL which opens the GitHub code editor... and it works! Check out line 3456 of the Korean translation.

With this, we are able to create useful links on the published pages for the translations. Currently, we simply link to the xx.po file, but we should instead link to the first message of each page. We could do so in a few different ways:

  • We could post-process the HTML. Something like loading each page, find the first paragraph, look it up in the xx.po file, get the line number, inject the line number into the link on the page.
  • We could use the GitHub API to download the file on demand when clicking the edit link. We would then search like above and send people to the right spot in the editor. The PO files are 500-800 KB in size, so that might be a little heavy-handed.

We could go with a hybrid version: generate and publish a small xx.json file with the correct line number for every path. Then download this file when clicking the link. That ought to be fairly simple since it's easy to load JSON files from JavaScript, and it will be pretty simple to produce this file when we publish the course.

Implementing this would drastically improve the editing experience for our translators.

@mgeisler mgeisler added enhancement New feature or request help wanted Extra attention is needed labels Aug 13, 2023
@mgeisler mgeisler added the good first issue Good for newcomers label Sep 16, 2023
@ishqDehlvi
Copy link

How can I reproduce this issue??

@mgeisler
Copy link
Collaborator Author

How can I reproduce this issue??

Try clicking the little pencil in the top-right corner of a translation. It will take you to the xx.po file, but it won't jump to the relevant line in the file.

@mgeisler
Copy link
Collaborator Author

@ishqDehlvi
Copy link

ishqDehlvi commented Nov 2, 2023

Is this that thing??

Screen.Recording.2023-11-02.at.8.05.00.AM.mov

@mgeisler
Copy link
Collaborator Author

mgeisler commented Nov 3, 2023

Yes, precisely! If you use the pencil on one of the English pages, then you're taking to the correct Markdown file in GitHub. However, if you do it on a translated page (like in your video), then you're taking to the huge PO file instead. That's not very useful for people who want to submit fixes to the translations.

@ishqDehlvi
Copy link

Got it lemme figure out something and raise a pr for this issue... Thanks for clarification

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants