Skip to content

Commit 6876a6d

Browse files
Vincent Lequertierflodolo
authored andcommitted
Fixes #823 - Add a link to Pootle or Pontoon on strings (#826)
1 parent 6a4994d commit 6876a6d

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

app/classes/Transvision/ShowResults.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ public static function resultsTable($search_object, $search_results, $page)
250250

251251
$extra_column_header = '';
252252

253+
// Get the tool used to edit strings for the target locale
254+
$toolUsedByTargetLocale = Project::getLocaleTool($locale2);
255+
253256
if ($extra_locale) {
254257
$locale3 = $search_object->getLocale('extra');
255258
$direction3 = RTLSupport::getDirection($locale3);
@@ -285,6 +288,7 @@ public static function resultsTable($search_object, $search_results, $page)
285288
}
286289

287290
$component = explode('/', $key)[0];
291+
$fileAndRawString = explode(':', $key);
288292
$source_string = trim($strings[0]);
289293
$target_string = trim($strings[1]);
290294

@@ -321,6 +325,13 @@ public static function resultsTable($search_object, $search_results, $page)
321325
if we aren't in the 3locales view and if we have a $target_string
322326
*/
323327
$transliterate = $locale2 == 'sr' && ! $extra_locale && $target_string && $target_string != '@@missing@@';
328+
if ($current_repo == 'aurora' && $toolUsedByTargetLocale == 'locamotion') {
329+
$edit_link = "https://mozilla.locamotion.org/{$locale2}/firefox/translate/{$fileAndRawString[0]}.po#search={$fileAndRawString[1]}&sfields=locations";
330+
$edit_message = 'edit in Pootle';
331+
} elseif ($current_repo == 'aurora' && $toolUsedByTargetLocale == 'pontoon') {
332+
$edit_link = "https://pontoon.mozilla.org/{$locale2}/firefox-aurora/{$fileAndRawString[0]}?search={$fileAndRawString[1]}";
333+
$edit_message = 'edit in Pontoon';
334+
}
324335

325336
if ($transliterate) {
326337
$transliterated_string = self::getTransliteratedString(urlencode($target_string), 'sr-Cyrl');
@@ -479,7 +490,15 @@ public static function resultsTable($search_object, $search_results, $page)
479490
<div dir='ltr' class='result_meta_link'>
480491
<a class='source_link' href='{$locale2_path}'>
481492
&lt;source&gt;
482-
</a>
493+
</a>";
494+
if (isset($edit_link)) {
495+
$table .= "
496+
&nbsp;
497+
<a class='edit_link' target='_blank' href='{$edit_link}'>
498+
&lt;{$edit_message}&gt;
499+
</a>";
500+
}
501+
$table .= "
483502
&nbsp;
484503
<a class='bug_link' target='_blank' href='{$bz_link[0]}'>
485504
&lt;report a bug&gt;

web/style/transvision.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,10 @@ td .result_meta_link .bug_link {
451451
color: #404d6c;
452452
}
453453

454+
td .result_meta_link .edit_link {
455+
color: #0095dd;
456+
}
457+
454458
#footer {
455459
text-align: center;
456460
font-size: 0.9em;

0 commit comments

Comments
 (0)