pyg3t / poproofread

GNU General Public License v3.0
0 stars 0 forks source link

Wish: View source function #16

Open KennethNielsen opened 9 years ago

KennethNielsen commented 9 years ago

When I proofread a po-file, I sometimes feel a need to check the context by looking at the source file that the message comes from.

So it would be great if clicking on a source comment, would open an editor with the source file positioned at the line indicated in the comment.

You would of course need supply the command to open the editor, and the place where the sources for the program is located.


Imported from Launchpad using lp2gh.

KennethNielsen commented 9 years ago

(by k-nielsen81) Hallo Byrial

I think this sounds like an interesting idea.

There are a few challenges to be tackled before something like this can be implemented. 1) How to handle editor support. I would prefer not to have to keep a list with all the editors out there. Probably the best way to do it is to keep a short list and allow the user to supply the command for editors not in the list. 2) How do we handle non up-todate source trees? Essentially the po-file could be for any revision of any branch for a specific module. a) The simple solution is to say that we don't handle it at all, simply use the file as is (if it exists). b) The next simplest solution is to check if the misgid is at the line it is claimed to be and otherwise search for at (assuming an updated file) c) The somewhat more complicated is to update the branch provided we can guess the version control system (obviously that would be something you could deactivate so you don't mess with your own development) e) The not not simple solution at all is to teach it to both shift branch and update, but I really don't want to implement that.

If think will be put a little while down on the prioritized list.

Regards Kenneth

KennethNielsen commented 9 years ago

(by byrial-t) Hi,

Kenneth

Ad 1) Traditionally you use environment variables VISUAL and EDITOR to indicate your prefered editor to other programs. See for instance this documented on this Ubuntu help page: https://help.ubuntu.com/community/EnvironmentVariables#Preferred_application_variables

However that way you don't know how to position the editor on a certain line.

So instead I imagine that the user simply make a command string with placeholders for file name and line number in poproofread's configuration. It could for instance be

"kate -l %l %f"

for a KDE user, or

"gedit %f +%l"

for a GNOME user if the placeholders are %f and %l.

Ad 2) I imagined that the first time you use the view source function for a given po file, poproofread would ask the user where the source is located. The user should then give the directory that the source references in the po file are relative to. Thus it would be the responsibility of the user to provide the right source tree.

If you wish, you could also add support for a URL for the location of the source, and it that case launche a webbrowser instead of an editor.