Exemplo n.º 1
0
    $searches[$locale2] = $locale3_strings;
    $data[] = $tmx_target2;
}
$search_yields_results = false;
// This will hold the components names for the search filters
$components = [];
foreach ($searches as $key => $value) {
    $search_results = ShowResults::getTMXResults(array_keys($value), $data);
    $components += Project::getComponents($search_results);
    if (count($value) > 0) {
        // We have results, we won't display search suggestions but search results
        $search_yields_results = true;
        $search_id = strtolower(str_replace('-', '', $key));
        $message_count = $real_search_results > $limit_results ? "<span class=\"results_count_{$search_id}\">{$limit_results} results</span> out of {$real_search_results}" : "<span class=\"results_count_{$search_id}\">" . Utils::pluralize(count($search_results), 'result') . '</span>';
        $output[$key] = "<h2>Displaying {$message_count} for the string " . "<span class=\"searchedTerm\">{$initial_search_decoded}</span> in {$key}:</h2>";
        $output[$key] .= ShowResults::resultsTable($search_id, $search_results, $initial_search, $source_locale, $locale, $check);
    } else {
        $output[$key] = "<h2>No matching results for the string " . "<span class=\"searchedTerm\">{$initial_search_decoded}</span>" . " for the locale {$key}</h2>";
    }
}
// Remove duplicated components
$components = array_unique($components);
// Display a search hint for the closest string we have if we have no search results
if (!$search_yields_results) {
    $merged_strings = [];
    foreach ($data as $key => $values) {
        $merged_strings = array_merge($merged_strings, array_values($values));
    }
    $best_matches = Strings::getSimilar($initial_search, $merged_strings, 3);
    include VIEWS . 'results_similar.php';
    return;