Hi there.
I have just deployed AjaxSearch 1.8.0 on this Japanese language website:
http://strictlyfansite.webhop.net/. When doing so I noticed that the Japanese language file wasn’t complete. A couple of the sentences were still in English. It became apparent that there was a reason for this. The text in question is passed into sprintf, and uses number and text format specifiers %d and %s which are replaced by the number of occurrences and search string. The problem is that in Japanese, the sentence structure requires that these two fields are in the opposite order.
So, to get this to work I modified ajaxSearch.class.inc.php so that it checks the order of the %s and %d identifiers and supplies the count and search string in the correct order to the sprintf function no matter which way they are written in the language file. It would be good if this could be rolled up as a bug fix in the next release.
Here is a patch for ajaxSearch.class.inc.php:
469c469,477
< $this->varResults['resultInfoText'] = sprintf($resultsFoundText,$nbrs,$searchwords);
---
> // PMS: Allow for Japanese ordering
> if ( strpos($resultsFoundText,'%d') < strpos($resultsFoundText,'%s') )
> {
> $this->varResults['resultInfoText'] = sprintf($resultsFoundText,$nbrs,$searchwords);
> }
> else
> {
> $this->varResults['resultInfoText'] = sprintf($resultsFoundText,$searchwords,$nbrs);
> }
471c479,487
< $this->varResults['resultInfoText'] = sprintf($resultsFoundText,$nbrs,$this->searchString);
---
> // PMS: Allow for Japanese ordering
> if ( strpos($resultsFoundText,'%d') < strpos($resultsFoundText,'%s') )
> {
> $this->varResults['resultInfoText'] = sprintf($resultsFoundText,$nbrs,$this->searchString);
> }
> else
> {
> $this->varResults['resultInfoText'] = sprintf($resultsFoundText,$this->searchString,$nbrs);
> }
The Japanese characters in the language file were being escaped when I tried to include it as code. I’ll attach it as a file in a separate post...
Cheers,
Paul