Display message when there are no search results

preferencesAboutTextFull
Craig Watson 9 years ago
parent 2c484ae4a3
commit 798d98904c
  1. 5
      resources/library/search/Pixabay.wgs/index.html
  2. 6
      resources/library/search/Pixabay.wgs/locales/locales.js

@ -38,7 +38,7 @@
var searchLanguage = "en"; var searchLanguage = "en";
// Language for the widget // Language for the widget
var locale = "en"; var locale = locales["en"];
// Fetch 960px images instead of the default 640px. However the API doesn't // 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. // 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. // Loop through our results, printing them to the page.
var results = json.hits; 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++) { for (var i = 0; i < results.length; i++) {
var result = results[i]; var result = results[i];

@ -38,7 +38,8 @@ var locales = {
'image_license_comm_reuse': 'Commercial reuse', 'image_license_comm_reuse': 'Commercial reuse',
'image_license_modif': 'Modification', 'image_license_modif': 'Modification',
'image_license_comm_modif': 'Commercial modification', 'image_license_comm_modif': 'Commercial modification',
'disclaimer_title': 'Pixabay image search' 'disclaimer_title': 'Pixabay image search',
'no_result': 'No result'
}, },
'fr': { 'fr': {
'def_opts_val_size': 'Toutes', 'def_opts_val_size': 'Toutes',
@ -79,6 +80,7 @@ var locales = {
'image_license_comm_reuse': 'Usage, distribution, commercial', 'image_license_comm_reuse': 'Usage, distribution, commercial',
'image_license_modif': 'Usage, distribution, modification', 'image_license_modif': 'Usage, distribution, modification',
'image_license_comm_modif': 'Usage, distribution, modification, commercial', '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'
} }
}; };

Loading…
Cancel
Save