Browse the glossary by more than one alphabet

Browse the glossary by more than one alphabet

by Joseph Rézeau -
Number of replies: 17
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

I am opening this new topic, further to the discussion: Glossary navigation bar/index language issue

I have managed to make available to the Glossary module a new feature to Browse the glossary by more than one alphabet. Before proposing a patch to the Moodle Tracker I need to have this hack tested by as many glossary users as possible in as many languages as possible (especially non-Roman alphabets).

Please go to my moodle test site (currently running moodle 1.9) http://rezeau.info/moodle and log in as teacher1, password Teacher1!

Go to course "Demo" and in Topic 0 (Documentation) click on Multilingual Glossary.

By default I have set it to display indexes in Greek, Hebrew and Russian (and English). I have entered a few words in those languages, but you are welcome to enter more words, of course.

You can Update the glossary to see for yourself how a teacher can select the various alphabets to be displayed, from the list of languages currently available on that moodle test site. If you need more languages to be added to the site, please let me know.

You can also change your user language on the site's front page, and experiment with how the Glossary index is displayed then.

Please post any remarks, bug reports, queries, etc. in this forum discussion.

Joseph

PS.- I have no idea if arabic, japanese, chinese, etc. use that alphabet index for browsing the glossary. Please let me know!

In reply to Joseph Rézeau

Re: Browse the glossary by more than one alphabet

by Nadav Kavalerchik -
Picture of Core developers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Joseph smile

Your solution looks great! i have palyed around with it a little bit and even add a new topic (in Hebrew) which came out just fine in the index.

Also, your theme looks great too. very clear.

smile
In reply to Joseph Rézeau

Re: Browse the glossary by more than one alphabet

by Itay Ophir -

Hi Joseph,

Your solution looks and works great!!

I tested it in Hebrew.

I checked the logic of which alphabet is the top one and that works great too - the user's language is the top navigation bar.

One question/scenario:

I noticed that when the user/course language is set to Hebrew the glossary entries start with English items and after them comes the Hebrew ones (in the default "all" display). I am thinking if there is a need to make the entries in the user's/course's language come first?

Example in the picture below. notice the Hebrew nav bar is the top one, plus the interface is in Hebrew. but the glossary items start with the English ones.

thanks,

Itay Ophir

Attachment 2.jpg
In reply to Itay Ophir

Re: Browse the glossary by more than one alphabet

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Thank you for your comments, Nadav and Itay. I will look into the question of the order of the glossary listings by languages and report progress here.
Joseph
In reply to Joseph Rézeau

Re: Browse the glossary by more than one alphabet

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Further to Itay's request, here's my findings.

When the entries in a moodle glossary are displayed in alphabetical order, that order follows the standard unicode order. More about the Unicode Chart.

Thus, latin alphabets come first (0-127 etc.), followed by Greek (880-1023), then by Cyrillic (1024-1279), ... Hebrew (1424-1535), etc...

This is not dependent on Moodle itself, and cannot be changed easily.

Joseph

In reply to Joseph Rézeau

Re: Browse the glossary by more than one alphabet

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
I have made the patches available (for moodle 1.9.8) in the bug tracker, MDL-22233.
Please read carefully the comments before applying the patch (on test site first) and report here and in the tracker any problems.
Joseph
In reply to Joseph Rézeau

Re: Browse the glossary by more than one alphabet

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
BUMP!
Anyone tried this new feature on my test site and would like to report? Anyone applied the patch on their own moodle site?
Joseph
In reply to Joseph Rézeau

Re: Browse the glossary by more than one alphabet

by Shimon Nagar -

Hi Joseph,

I test it in Hebrew with ie8, ff3.6, Chrome, Safari4, Opera

Best results in ff and ie.

All items direction is RTL while it should be sensitive to language direction.

Wonderful job.

Thanks.

Shimon

(Edited by Joseph Rézeau - original submission Thursday, 27 May 2010, 02:54 PM)

Removed formatting garbage due to copy-paste from MS Word. Please note : never ever copy-paste from your word processor into Moodle's HTLM editor.

In reply to Joseph Rézeau

Re: Browse the glossary by more than one alphabet

by Shimon Nagar -

Hi Joseph

I did some tests and noticed that when English is the interface language then navigation bar displays only in English. When I switch interface language to Hebrew the Hebrew navigation bar added to be displayed.
Is that behavior O.K.?

Attachment 2opt.gif
In reply to Shimon Nagar

Re: Browse the glossary by more than one alphabet

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
This is the normal behavior of Moodle. It normally displays the alphabet listing in the current user's language. In order to have several alphabets displayed, you need to properly install my patches and follow the instructions in MDL-22233.
Joseph
In reply to Joseph Rézeau

Re: Browse the glossary by more than one alphabet

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

To anyone interested: I have almost finished updating my patch to work on Moodle 2.1. I will post it to MDL-22233 shortly.

Attached screenshot (Moodle 2.1) displaying English + Spanish + Russian alphabets, with Russian alphabet letter Ж selected.

Joseph

Attachment 07-10-2011 23-43-36.jpg
In reply to Joseph Rézeau

Re: Browse the glossary by more than one alphabet

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Patch for Moodle 2.1 now available from bug tracker MDL-22233.

I invite anyone interested (and using moodle 2.1) to test this and report here.

Please note that the patch will enable browsing a glossary with multiple alphabets not only "by alphabet" but also "by author", as shown on attached screenshot. This may be useful in moodle sites/courses where students are enroled with names (surname & first name) in more than one alphabet.

Joseph

Attachment 11-10-2011 10-34-03.jpg
In reply to Joseph Rézeau

Re: Browse the glossary by more than one alphabet

by Nicola Piccolo -

Hi Joseph,

                thank you for your efforts, I've really appreciated it!

I've read the description of the patch on Moodle tracker and I'll apply it on my local Moodle installation for some tests. Do I need to insert some values inside the new "specialalphabets" column of mdl_glossary table or should I leave it empty?

Thank you again and have a good night, ciao!
Nicola

In reply to Nicola Piccolo

Re: Browse the glossary by more than one alphabet

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

hi  nicola

no, just create the specialalphabets field and leave it empty

joseph

In reply to Joseph Rézeau

Re: Browse the glossary by more than one alphabet

by Nicola Piccolo -

Hi Joseph,
                 finally I'm back to you patch; I downloaded its 3 files and applied the script on my local MySql and everything is working great.

I've noticed that, if I choose Japanese language in the settings form, then the glossary shows me a new bar with latin alphabet for browsing also in Japanese language; I think there is some kind of fallback mechanism that shows the default alphabet (i.e. latin) for languages without it: I'd like instead to see a new bar with hiragana symbols in the glossary instance.

Is this behaviour possible with the new patch?

Thank you in advance,
Nicola

In reply to Nicola Piccolo

Re: Browse the glossary by more than one alphabet

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Nicola,

I'm afraid I've only tested my patch with Russian and Hebrew languages. Testing with Japanese is beyond my skills. Sorry!

Joseph

In reply to Joseph Rézeau

Re: Browse the glossary by more than one alphabet

by Nicola Piccolo -

That's ok Joseph,
                            thank you! If you need more information about this topic, I'll be glad to help you.

Take care,

Nicola

In reply to Joseph Rézeau

Re: Browse the glossary by more than one alphabet

by El Fot -

OK i think i found the quickest possible workaround for this problem (tested and working on moodle 1.9.17).

Pros/Cons:

+No mod/plugin installation

+reliable and safe if you do it right

-you must mess with moodle's php source

-takes 5mins from your time

 

Ok i wanted to add the Greek alphabet in our Glossaries. 

So on your server go to moodle/mod/glossary and open the lib.php file.

Find this (line 1394)

$alphabet = explode(",", get_string("alphabet")); 

and replace it with 

$alphabet = explode(",", 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Α,Β,Γ,Δ,Ε,Ζ,Η,Θ,Ι,Κ,Λ,Μ,Ν,Ξ,Ο,Π,Ρ,Σ,Τ,Υ,Φ,Χ,Ψ,Ω'); 

In other words you just replace the variable alphabet (english alphabet - located in moodle/lang/en_utf8/langconfig.php) with a string generated by yourself. Advantadges are that you dont mess with any variables and do no harm on your installation even if you are inexperienced with php programming.

Obviously you use your language's characters instead of greek (always seperated by commas).

I also changed the $letters_by_line = 14; to $letters_by_line = 25; to get a symmetrical and beautiful alphabet listing. The outcome is something like this:

Edited Glossary Alphabet