Cannot look up "reference" in SD dictionary!
Whenever one attempts to navigate to the definition for "reference" using SpanishDict's dictionary, one is consistently routed to SpanishDict's reference section instead. This happens if one types in "reference" and his enter or clicks on a link to the definition of reference. One can type in reference and not hit enter and instead click on the word reference in the list of suggestions...still get forwarded to the reference section instead.
3 Answers
Something like this perhaps...
Code example (javascript):
// the dictionaryUrl is http://www.spanishdict.com/translate/
// and I assume it is set somewhere and can be accessed
// globally or passed into various functions as needed
function getDefinitionUrl(var dictionaryUrl, var word) {
// deal with "reference" problem
if (word == 'reference') {
word = 'Reference';
}
// complete the url and return it
definitionUrl = dictionaryUrl + word;
return definitionUrl ;
}
Or, if the function should return the whole link and not just the url...
function getDefinitionLinkHtml(var dictionaryUrl, var word) {
// record the word in a variable call urlWord
urlWord = word;
// correct urlWord by capitalizing it if it is
// reference in lowercase
if (urlWord == 'reference') {
urlWord = 'Reference';
}
// use urlWord in the url, but use the original word
// in the link itself (so user still sees original word
// as a clickable link, but url itself is actually corrected)
link = '<a href="' + definitionUrl + urlWord + '">' + word + '</a>';
return link;
// for example, if the original word was reference, the above
// function will return the following:
// <a href="http://www.spanishdict.com/translate/Reference">reference</a>
}
Or, simply...
//all words that are to be defined would be sent here
// BEFORE adding them to the definition's url (only for
// the url part, would want to use the word in its original
// form for the part the user sees)
function correctForReferenceIssue(var word) {
// if the word is reference, then capitalize it and
// return the capitalized version. All other words
// remain unchanged.
if (word == 'reference') {
word = 'Reference';
}
return word;
}
The key is the IF statement, which will convert all cases of "reference" to "Reference"...assuming there is a single function or object that handles building definition links regardless of what is asking for the link (translate button, double-click feature, word suggester). It may not be so easy otherwise.
Okay, I noticed that the following url...
http://www.spanishdict.com/translate/reference
...will take you to the reference guide, while the url below...
http://www.spanishdict.com/translate/Reference
...will take you to the definition of reference. Notice that the second url has a capital R.
So, if you type Reference into the search bar, one gets the definition. Similarly, if one double-clicks on reference one gets the guide, but if one double-clicks on Reference one gets the definition. This issue will be difficult to fix as the url for the guide is what would normally be the url for the definition. If that is changed it will break links all over the place that link to the guide.
Instead, I would imagine that event handling code (Javascript?) for the translate button, the word suggester (the code responsible for providing suggested words as one types into the search bar) and whatever code that handles the double-clicking of words needs to be updated to convert all links to the word reference (whether capitalized or not) to link to the url with the capital R.
Hi, Web. Thank you for letting us know about this. I will report it to Paralee.