Bug 181528 - Menu items in Tools -> External Tools are untranslatable
Summary: Menu items in Tools -> External Tools are untranslatable
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Unspecified
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-21 22:06 UTC by Burkhard Lück
Modified: 2019-12-02 20:48 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:
aspotashev: Translation_missing+


Attachments
Replaced 'name' to 'Name' in externaltools (1.22 KB, patch)
2011-02-23 17:16 UTC, Pranav Ravichandran
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Burkhard Lück 2009-01-21 22:06:24 UTC
Version:            (using Devel)
Installed from:    Compiled sources

These untranslatable items in Tools -> External Tools are taken from kdesdk/kate/plugins/externaltools/externaltools:
name=Compare Current Document to Version Control System
name=Compare Directory of Current Document to Version Control System
name=Email CVS Diff for Current Document
name=Google Selection
name=Run Script

These messages are not extracted for translation since afaik KDE 3.3.0

How to fix this issue:

1. Patch the i18n tool chain aka scripty to process this file (add externaltools to the filelist in less l10n-kde4/scripts/findfiles)
-> I can do that

2. Change "name" to "Name" in externaltools, because that is one of the keywords defined in l10n-kde4/scripts/applycontext.cpp to enable scripty to extract these values to the message catalog desktop_kdesdk and merge the translation back into the file externaltools

3. kate has to be patch to read the localized Name string (via KDesktopFile?) and display them in the menu.
Comment 1 Pranav Ravichandran 2011-02-23 17:16:53 UTC
Created attachment 57471 [details]
Replaced 'name' to 'Name' in externaltools
Comment 2 Lamarque V. Souza 2011-04-06 08:04:48 UTC
This problem seems fixed in 4.6.1. Can I close this bug?
Comment 3 Burkhard Lück 2011-04-06 08:58:31 UTC
(In reply to comment #2)
> This problem seems fixed in 4.6.1. Can I close this bug?

Using kate using locale x-test in master + 4.6 I still see untranslatable menu items.
Comment 4 Albert Astals Cid 2011-05-25 10:07:39 UTC
Lamarque why do you say it's fixed? Here I don't see any translation inside kate/plugins/externaltools/externaltools nor those texts extracted to kate.pot
Comment 5 Lamarque V. Souza 2011-05-25 17:40:43 UTC
Because when I tested it I did not see anything unstranslated, but externaltools is not enabled by default. When it is enabled I see the unstranslated strings.
Comment 6 Christoph Cullmann 2011-08-09 16:21:17 UTC
External Tools is removed for 4.8, lack of maintainer, closing bugs, asking for somebody to step up, all bugs to look at listed there for archiving.
http://kate-editor.org/2011/08/09/maintainer-needed-kate-external-tools-plugin/
Comment 7 Dominik Haumann 2019-09-21 20:42:24 UTC
PS: It's back. We have to check translation issues, though.
https://kate-editor.org/post/2019/2019-09-21-external-tools-plugin/
Comment 8 Alexander Potashev 2019-12-02 11:28:40 UTC
Tested with Kate 19.11.90 on ArchLinux with Russian and Ukrainian translations, still does not work (menu items are all in English), I don't know why.

The messages are correctly extracted into kateexternaltoolsplugin.pot by kate.git/addons/externaltools/Messages.sh
Comment 9 Dominik Haumann 2019-12-02 20:32:39 UTC
Git commit df460443bf6e651812acb17d31ec1a9d26c71c6a by Dominik Haumann.
Committed on 02/12/2019 at 20:31.
Pushed by dhaumann into branch 'fix-translation'.

Fix: Do not translate KActionCollection identifier

M  +1    -1    addons/externaltools/kateexternaltoolsview.cpp

https://invent.kde.org/kde/kate/commit/df460443bf6e651812acb17d31ec1a9d26c71c6a
Comment 10 Dominik Haumann 2019-12-02 20:32:42 UTC
Git commit df460443bf6e651812acb17d31ec1a9d26c71c6a by Dominik Haumann.
Committed on 02/12/2019 at 20:31.
Pushed by scmsync into branch 'fix-translation'.

Fix: Do not translate KActionCollection identifier

M  +1    -1    addons/externaltools/kateexternaltoolsview.cpp

https://commits.kde.org/kate/df460443bf6e651812acb17d31ec1a9d26c71c6a
Comment 11 Alexander Potashev 2019-12-02 20:40:44 UTC
I think I know how to fix it: these must be i18nc() calls, not just i18n() because strings are extracted with contexts "External tool name" or "External tool category".


diff --git a/addons/externaltools/kateexternaltool.cpp b/addons/externaltools/kateexternaltool.cpp
index 3a8ce0e31..45c0ac879 100644
--- a/addons/externaltools/kateexternaltool.cpp
+++ b/addons/externaltools/kateexternaltool.cpp
@@ -144,12 +144,12 @@ void KateExternalTool::save(KConfigGroup &cg) const
 
 QString KateExternalTool::translatedName() const
 {
-    return name.isEmpty() ? QString() : i18n(name.toUtf8().data());
+    return name.isEmpty() ? QString() : i18nc("External tool name", name.toUtf8().data());
 }
 
 QString KateExternalTool::translatedCategory() const
 {
-    return category.isEmpty() ? QString() : i18n(category.toUtf8().data());
+    return category.isEmpty() ? QString() : i18nc("External tool category", category.toUtf8().data());
 }
 
 bool operator==(const KateExternalTool &lhs, const KateExternalTool &rhs)
Comment 12 Dominik Haumann 2019-12-02 20:42:10 UTC
Ah I think that makes a lot of sense! Thanks, will post a patch.
Comment 13 Alexander Potashev 2019-12-02 20:45:20 UTC
Quite a hacky approach, huh? I would use the standard translatable .json files if I was implementing this from scratch, like this one https://cgit.kde.org/purpose.git/tree/src/plugins/twitter/metadata.json
Comment 14 Dominik Haumann 2019-12-02 20:46:16 UTC
Git commit f65192bbe6a6d259e13a2bab9408442b7f4dbe6b by Dominik Haumann.
Committed on 02/12/2019 at 20:45.
Pushed by dhaumann into branch 'ext-tools-fix-translation'.

Fix translation of external tools

M  +2    -2    addons/externaltools/kateexternaltool.cpp

https://invent.kde.org/kde/kate/commit/f65192bbe6a6d259e13a2bab9408442b7f4dbe6b
Comment 15 Dominik Haumann 2019-12-02 20:46:20 UTC
Git commit f65192bbe6a6d259e13a2bab9408442b7f4dbe6b by Dominik Haumann.
Committed on 02/12/2019 at 20:45.
Pushed by scmsync into branch 'ext-tools-fix-translation'.

Fix translation of external tools

M  +2    -2    addons/externaltools/kateexternaltool.cpp

https://commits.kde.org/kate/f65192bbe6a6d259e13a2bab9408442b7f4dbe6b
Comment 16 Alexander Potashev 2019-12-02 20:47:19 UTC
OTOH those JSONs assume that you are using KPlugin while here we won't ever use a plugin per external command...
Comment 17 Dominik Haumann 2019-12-02 20:48:29 UTC
Merge request: https://invent.kde.org/kde/kate/merge_requests/50