1
/* LaunchpadTranslationsItem.cs
3
* GNOME Do is the legal property of its developers. Please refer to the
4
* COPYRIGHT file distributed with this source distribution.
6
* This program is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
using System.Text.RegularExpressions;
25
namespace Do.Launchpad
27
public class LaunchpadTranslationSearchItem : LaunchpadItem
29
public LaunchpadTranslationSearchItem() { }
30
public string Name { get { return "Translation Search"; } }
31
public string Description { get { return "Search for Translations in Launchpad"; } }
35
get { return LaunchpadIcons.Instance.GetIconPath("LaunchpadTranslations.png"); }
38
public bool SupportsItems(IItem[] items)
43
public void Perform (IItem item)
45
Regex spaces = new Regex(@"\s+");
46
string query = (item as ITextItem).Text;
47
string[] qwords = spaces.Split(query);
49
Util.Environment.Open ("https://translations.launchpad.net/projects/?text=" + string.Join("+", qwords));
53
public class LaunchpadTranslationReleaseItem : LaunchpadItem
55
public LaunchpadTranslationReleaseItem() { }
56
public string Name { get { return "Release Translations"; } }
57
public string Description { get { return "Translations for Ubuntu Release Name"; } }
61
get { return LaunchpadIcons.Instance.GetIconPath("LaunchpadTranslations.png"); }
64
public bool SupportsItems(IItem[] items)
66
//Package name can't have a space
67
Regex numbers = new Regex(@"\s+");
68
return !numbers.IsMatch((items[0] as ITextItem).Text);
71
public void Perform (IItem item)
73
Util.Environment.Open(string.Format(
74
"https://translations.lauchpad.net/ubuntu/{0}/+translations",
75
(item as ITextItem).Text));