Re: [greenstone-users] Translation question...

From xiaofyu
DateMon, 2 Apr 2007 21:46:32 +1200
Subject Re: [greenstone-users] Translation question...
In-Reply-To (dfb4b74f0703310110j363201f5gf1570271a1701dec-mail-gmail-com)
>For example when I do a search I get the following string:
>in English "27 documents matched the query."
>in Dari " 27 اسنادی که با پرس و جو تطبیق کرده اند ."

>Whereas it would be nice if I coudl get the total to be displayed as ۲۷ rather than 27.

Hi Graeme,

In Greenstone, query result is generated by the server through the macro _resultline_, which is in the query.dm file in the macros directory. It is composed by the number of matching documents ( i.e. 27 in this case, which is dynamically returned from the server) plus another macro _textlotsdocs_ in the corresponding macro file (in the case of English, english.dm). If the number of matching documents exceeds the up-to limit (it is set in the 'preferences' page), another macro called _textmorethan_ (again, in english.dm) will be prefixed before the matching number (eg. 27), resulting in "more than xx documents matched the query".

You can get the content of _resultline_ by putting a html element in place of the macro, for example, <div id=some_id>_resultline_</div>, then writing a javaScript in the file query.dm to get the content of _resultline_ using the id. Then you can parse the content and translate the digits and the text separately. You can define a macro that contains your script by following the other macros like _formpagescriptextra_ and put it in  .

Finally, you need to work out how to invoke your translation function when the page is loaded. For example, window.onload=''your_function_name".

Cheers
xiao




 

_____________________________________
greenstone-users mailing list
greenstone-users@list.scms.waikato.ac.nz
https://list.scms.waikato.ac.nz/mailman/listinfo/greenstone-users