Bug 204276 - Clicking source file references do nothing
Summary: Clicking source file references do nothing
Status: RESOLVED FIXED
Alias: None
Product: lokalize
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Unspecified
: NOR normal
Target Milestone: ---
Assignee: Nick Shaforostoff
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-18 14:09 UTC by Karl Ove Hufthammer
Modified: 2016-02-21 23:11 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karl Ove Hufthammer 2009-08-18 14:09:32 UTC
Version:            (using KDE 4.3.0)
Installed from:    Unlisted Binary Package

Click the source file references (e.g., kcm/kcmdolphingeneral.cpp:56) in Lokalize does nothing at all, even though they are shown as links.

A suggestion for what it should do: Use http://lxr.kde.org/ to search for the file. Provide the results as a list of links to source code view of the files (or jump directly to the source code view if there’s only one search result). The line number should be appended to the links, e.g., "http://.../file.cpp#37", so that they take you directly to the relevant line.

It would be nice if the results could be displayed in a pane *inside* Lokalize, instead of launched in a separate browser. Using the alternate stylesheet ‘Flat’ on the lxr.kde.org side could be useful to get rid of the margins.
Comment 1 Nick Shaforostoff 2009-11-04 19:26:18 UTC
thank you for the suggestion, i'll implement it.

right now only opening local files is implemented. For it to work you need to checkout http://websvn.kde.org/trunk/l10n-kde4/scripts/lokalize/ (retaining SVN folder layout) and put http://websvn.kde.org/trunk/l10n-kde4/ru/lokalize-scripts/opensrc.rc to YOUR_LANG/lokalize-scripts and restart Lokalize
Comment 2 Nick Shaforostoff 2009-11-04 19:27:03 UTC
oh, and also you need to checkout KDE source, also retaining SVN folder layout ))
Comment 3 Laszlo Papp 2010-05-04 00:59:23 UTC
What's the state of this report ?
Comment 4 Adrián Chaves (Gallaecio) 2014-02-16 20:55:04 UTC
Nick, what about asking users for a root path when they click this and Lokalize is unable to show the file? After the user chooses the sources root folder, all source paths in the PO file can be considered relative to the path that the user specified.
Comment 5 Nick Shaforostoff 2014-12-21 22:41:18 UTC
Adrián: una idea buena
Comment 6 Adrián Chaves (Gallaecio) 2015-03-08 15:24:01 UTC
I see three possible scenarios here:

- Projects where translation files show paths relative to the translation file paths. Most projects that I know do this. I’ve just opened a review request for a patch that would handle opening the source files of these projects.
- Projects where translation files show paths relative to some root source path. For these projects, the solution would be to ask for a root source folder path, as I suggested in my previous comment. This root source folder path would have to be stored on the project configuration, so it is not as trivial as my patch for the previous scenario. It would be easy enought to do, though.
- Complex projects, like KDE, where paths are neither relative to the translation file nor relative to a common root source folder path. These projects require a project script to handle them.

The first scenario is solved with my patch.

The second scenario has not been reported here, so a different bug should be reported for it, assuming there is people interested in having it solved. It would be a feature request, not a bug per se.

The third scenario is the one reported here, and I personally think that this is an invalid bug. There is no simple way to deal with these paths in projects like KDE, a project script is necessary. And it should be the KDE documentation the one explaining translators how to deal with this issue, not Lokalize. Lokalize should is not a tool to translate KDE, is a tool to translate any project. I think Lokalize already does its job here by pointing users to the chapter of the manual that explains how to write a script to deal with opening source files for a complex project.
Comment 7 Nick Shaforostoff 2015-03-09 21:57:48 UTC
thanks for notifying me. i'll review the patch now...
Comment 8 Alexander Potashev 2015-03-11 07:41:47 UTC
For KDE I use my script opensrc_generate_list.rb (trunk/l10n-kde4/scripts/lokalize/opensrc_generate_list.rb) to scan the whole $HOME folder and generate opensrc_list.py and then the script "opensrc" works perfectly well.
Comment 9 Nick Shaforostoff 2016-02-21 23:11:53 UTC
Git commit 70c340bfb316767e81ce6058bd19305913e924d7 by Nick Shaforostoff.
Committed on 21/02/2016 at 23:07.
Pushed by shaforo into branch 'master'.

CHANGELOG: handle source file links found in po files nicely: either open lxr.kde.org lookup or search files locally
Related: bug 244686

M  +86   -3    src/editortab.cpp
M  +4    -0    src/lokalize.notifyrc
M  +115  -0    src/project/project.cpp
M  +9    -0    src/project/project.h
M  +3    -0    src/project/projectlocal.kcfg
M  +1    -1    src/tm/jobs.cpp

http://commits.kde.org/lokalize/70c340bfb316767e81ce6058bd19305913e924d7