Permalink
Browse files

Fixes #823 - Add a link to Pootle or Pontoon on strings (#826)

  • Loading branch information...
Vincent Lequertier authored and flodolo committed Nov 30, 2016
1 parent 6a4994d commit 6876a6d910f94b7f645ef3346aa3911ea2e37771
Showing with 24 additions and 1 deletion.
  1. +20 −1 app/classes/Transvision/ShowResults.php
  2. +4 −0 web/style/transvision.css
@@ -250,6 +250,9 @@ public static function resultsTable($search_object, $search_results, $page)
$extra_column_header = '';
+ // Get the tool used to edit strings for the target locale
+ $toolUsedByTargetLocale = Project::getLocaleTool($locale2);
+
if ($extra_locale) {
$locale3 = $search_object->getLocale('extra');
$direction3 = RTLSupport::getDirection($locale3);
@@ -285,6 +288,7 @@ public static function resultsTable($search_object, $search_results, $page)
}
$component = explode('/', $key)[0];
+ $fileAndRawString = explode(':', $key);
$source_string = trim($strings[0]);
$target_string = trim($strings[1]);
@@ -321,6 +325,13 @@ public static function resultsTable($search_object, $search_results, $page)
if we aren't in the 3locales view and if we have a $target_string
*/
$transliterate = $locale2 == 'sr' && ! $extra_locale && $target_string && $target_string != '@@missing@@';
+ if ($current_repo == 'aurora' && $toolUsedByTargetLocale == 'locamotion') {
+ $edit_link = "https://mozilla.locamotion.org/{$locale2}/firefox/translate/{$fileAndRawString[0]}.po#search={$fileAndRawString[1]}&sfields=locations";
+ $edit_message = 'edit in Pootle';
+ } elseif ($current_repo == 'aurora' && $toolUsedByTargetLocale == 'pontoon') {
+ $edit_link = "https://pontoon.mozilla.org/{$locale2}/firefox-aurora/{$fileAndRawString[0]}?search={$fileAndRawString[1]}";
+ $edit_message = 'edit in Pontoon';
+ }
if ($transliterate) {
$transliterated_string = self::getTransliteratedString(urlencode($target_string), 'sr-Cyrl');
@@ -479,7 +490,15 @@ public static function resultsTable($search_object, $search_results, $page)
<div dir='ltr' class='result_meta_link'>
<a class='source_link' href='{$locale2_path}'>
&lt;source&gt;
- </a>
+ </a>";
+ if (isset($edit_link)) {
+ $table .= "
+ &nbsp;
+ <a class='edit_link' target='_blank' href='{$edit_link}'>
+ &lt;{$edit_message}&gt;
+ </a>";
+ }
+ $table .= "
&nbsp;
<a class='bug_link' target='_blank' href='{$bz_link[0]}'>
&lt;report a bug&gt;
@@ -451,6 +451,10 @@ td .result_meta_link .bug_link {
color: #404d6c;
}
+td .result_meta_link .edit_link {
+ color: #0095dd;
+}
+
#footer {
text-align: center;
font-size: 0.9em;

0 comments on commit 6876a6d

Please sign in to comment.