Commit 798d9890 authored by Craig Watson's avatar Craig Watson

Display message when there are no search results

parent 2c484ae4
......@@ -38,7 +38,7 @@
var searchLanguage = "en";
// Language for the widget
var locale = "en";
var locale = locales["en"];
// Fetch 960px images instead of the default 640px. However the API doesn't
// provide size information in this case, so it is disabled by default.
......@@ -176,7 +176,8 @@
// Loop through our results, printing them to the page.
var results = json.hits;
//TODO: display a message on page when there are zero results. Would require locales, ideally
if (results.length == 0)
$("<p>"+locale.no_result+"</p>").appendTo(contentDiv);
for (var i = 0; i < results.length; i++) {
var result = results[i];
......
......@@ -38,7 +38,8 @@ var locales = {
'image_license_comm_reuse': 'Commercial reuse',
'image_license_modif': 'Modification',
'image_license_comm_modif': 'Commercial modification',
'disclaimer_title': 'Pixabay image search'
'disclaimer_title': 'Pixabay image search',
'no_result': 'No result'
},
'fr': {
'def_opts_val_size': 'Toutes',
......@@ -79,6 +80,7 @@ var locales = {
'image_license_comm_reuse': 'Usage, distribution, commercial',
'image_license_modif': 'Usage, distribution, modification',
'image_license_comm_modif': 'Usage, distribution, modification, commercial',
'disclaimer_title': 'Recherche d\'images sur Pixabay'
'disclaimer_title': 'Recherche d\'images sur Pixabay',
'no_result': 'Aucun résultat'
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment