Merge lp:~tintou/slingshot/translate-actions into lp:~elementary-pantheon/slingshot/trunk

Proposed by Corentin Noël
Status: Merged
Approved by: Cody Garver
Approved revision: 618
Merged at revision: 630
Proposed branch: lp:~tintou/slingshot/translate-actions
Merge into: lp:~elementary-pantheon/slingshot/trunk
Diff against target: 101 lines (+31/-1)
2 files modified
lib/synapse-core/desktop-file-service.vala (+8/-0)
lib/synapse-plugins/desktop-file-plugin.vala (+23/-1)
To merge this branch: bzr merge lp:~tintou/slingshot/translate-actions
Reviewer Review Type Date Requested Status
elementary Pantheon team Pending
Review via email: mp+281304@code.launchpad.net

Commit message

Translate applications actions

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/synapse-core/desktop-file-service.vala'
--- lib/synapse-core/desktop-file-service.vala 2014-08-21 14:08:17 +0000
+++ lib/synapse-core/desktop-file-service.vala 2015-12-23 15:11:31 +0000
@@ -53,6 +53,7 @@
53 public string generic_name { get; construct set; }53 public string generic_name { get; construct set; }
54 public string comment { get; set; default = ""; }54 public string comment { get; set; default = ""; }
55 public string icon_name { get; construct set; default = ""; }55 public string icon_name { get; construct set; default = ""; }
56 public string gettext_domain { get; construct set; }
5657
57 public bool needs_terminal { get; set; default = false; }58 public bool needs_terminal { get; set; default = false; }
58 public string filename { get; construct set; }59 public string filename { get; construct set; }
@@ -73,6 +74,7 @@
73 74
74 public EnvironmentType show_in { get; set; default = EnvironmentType.ALL; }75 public EnvironmentType show_in { get; set; default = EnvironmentType.ALL; }
7576
77 private const string[] SUPPORTED_GETTEXT_DOMAINS_KEYS = {"X-Ubuntu-Gettext-Domain", "X-GNOME-Gettext-Domain"};
76 private static const string GROUP = "Desktop Entry";78 private static const string GROUP = "Desktop Entry";
7779
78 public DesktopFileInfo.for_keyfile (string path, KeyFile keyfile,80 public DesktopFileInfo.for_keyfile (string path, KeyFile keyfile,
@@ -125,6 +127,12 @@
125 throw new DesktopFileError.UNINTERESTING_ENTRY ("Screensaver desktop entry");127 throw new DesktopFileError.UNINTERESTING_ENTRY ("Screensaver desktop entry");
126 }128 }
127 }129 }
130 foreach (var domain_key in SUPPORTED_GETTEXT_DOMAINS_KEYS) {
131 if (keyfile.has_key (GROUP, domain_key)) {
132 gettext_domain = keyfile.get_string (GROUP, domain_key);
133 break;
134 }
135 }
128136
129 DesktopAppInfo app_info;137 DesktopAppInfo app_info;
130 app_info = new DesktopAppInfo.from_keyfile (keyfile);138 app_info = new DesktopAppInfo.from_keyfile (keyfile);
131139
=== modified file 'lib/synapse-plugins/desktop-file-plugin.vala'
--- lib/synapse-plugins/desktop-file-plugin.vala 2015-09-20 17:50:48 +0000
+++ lib/synapse-plugins/desktop-file-plugin.vala 2015-12-23 15:11:31 +0000
@@ -48,12 +48,25 @@
48 public AppInfo? app_info { get; set; default = null; }48 public AppInfo? app_info { get; set; default = null; }
49 public bool needs_terminal { get; set; default = false; }49 public bool needs_terminal { get; set; default = false; }
5050
51 private const string[] SUPPORTED_GETTEXT_DOMAINS_KEYS = {"X-Ubuntu-Gettext-Domain", "X-GNOME-Gettext-Domain"};
51 private string action_name;52 private string action_name;
5253
53 public ActionMatch (string desktop_id, string action_name)54 public ActionMatch (string desktop_id, string action_name)
54 {55 {
55 var desktop_app_info = new DesktopAppInfo (desktop_id);56 var desktop_app_info = new DesktopAppInfo (desktop_id);
57 string? textdomain = null;
58 foreach (var domain_key in SUPPORTED_GETTEXT_DOMAINS_KEYS) {
59 textdomain = desktop_app_info.get_string (domain_key);
60 if (textdomain != null) {
61 break;
62 }
63 }
64
56 this.title = desktop_app_info.get_action_name (action_name);65 this.title = desktop_app_info.get_action_name (action_name);
66 if (textdomain != null) {
67 this.title = GLib.dgettext (textdomain, this.title);
68 }
69
57 this.icon_name = desktop_app_info.get_icon ().to_string ();70 this.icon_name = desktop_app_info.get_icon ().to_string ();
58 this.description = "";71 this.description = "";
59 this.app_info = desktop_app_info;72 this.app_info = desktop_app_info;
@@ -71,6 +84,7 @@
71 // for Match interface84 // for Match interface
72 public string title { get; construct set; }85 public string title { get; construct set; }
73 public string description { get; set; default = ""; }86 public string description { get; set; default = ""; }
87 public string? gettext_domain { get; construct set; default = null; }
74 public string icon_name { get; construct set; default = ""; }88 public string icon_name { get; construct set; default = ""; }
75 public bool has_thumbnail { get; construct set; default = false; }89 public bool has_thumbnail { get; construct set; default = false; }
76 public string thumbnail_path { get; construct set; }90 public string thumbnail_path { get; construct set; }
@@ -114,6 +128,7 @@
114 this.title_unaccented = Utils.remove_accents (this.title_folded);128 this.title_unaccented = Utils.remove_accents (this.title_folded);
115 this.desktop_id = "application://" + info.desktop_id;129 this.desktop_id = "application://" + info.desktop_id;
116 this.generic_name = info.generic_name;130 this.generic_name = info.generic_name;
131 this.gettext_domain = info.gettext_domain;
117 }132 }
118 }133 }
119134
@@ -197,6 +212,7 @@
197 unowned string unaccented_title = dfm.title_unaccented;212 unowned string unaccented_title = dfm.title_unaccented;
198 unowned string comment = dfm.description;213 unowned string comment = dfm.description;
199 unowned string generic_name = dfm.generic_name;214 unowned string generic_name = dfm.generic_name;
215 unowned string gettext_domain = dfm.gettext_domain;
200216
201 bool matched = false;217 bool matched = false;
202 // FIXME: we need to do much smarter relevancy computation in fuzzy re218 // FIXME: we need to do much smarter relevancy computation in fuzzy re
@@ -229,7 +245,13 @@
229 var desktop_app_info = new DesktopAppInfo (id);245 var desktop_app_info = new DesktopAppInfo (id);
230 string[] actions = desktop_app_info.list_actions ();246 string[] actions = desktop_app_info.list_actions ();
231 foreach (string action in actions) {247 foreach (string action in actions) {
232 string title = desktop_app_info.get_action_name (action).down ();248 string title = desktop_app_info.get_action_name (action);
249 if (gettext_domain != null) {
250 title = GLib.dgettext (gettext_domain, title).down ();
251 } else {
252 title = title.down ();
253 }
254
233 foreach (var matcher in matchers)255 foreach (var matcher in matchers)
234 {256 {
235 MatchInfo action_info;257 MatchInfo action_info;

Subscribers

People subscribed via source and target branches