Skip to content

Commit

Permalink
Fixes #823 - Add a link to Pootle or Pontoon on strings (#826)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Lequertier authored and flodolo committed Nov 30, 2016
1 parent 6a4994d commit 6876a6d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
21 changes: 20 additions & 1 deletion app/classes/Transvision/ShowResults.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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]);

Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions web/style/transvision.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6876a6d

Please sign in to comment.