Browse the glossary by more than one alphabet

Browse the glossary by more than one alphabet

Joseph Rézeau -
Кількість відповідей: 17
Фото Core developers Фото Particularly helpful Moodlers Фото Plugin developers Фото Testers Фото 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!

У відповідь на Joseph Rézeau

Re: Browse the glossary by more than one alphabet

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

Вкладення 2.jpg
У відповідь на Itay Ophir

Re: Browse the glossary by more than one alphabet

Joseph Rézeau -
Фото Core developers Фото Particularly helpful Moodlers Фото Plugin developers Фото Testers Фото 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
У відповідь на Joseph Rézeau

Re: Browse the glossary by more than one alphabet

Joseph Rézeau -
Фото Core developers Фото Particularly helpful Moodlers Фото Plugin developers Фото Testers Фото 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

У відповідь на Joseph Rézeau

Re: Browse the glossary by more than one alphabet

Joseph Rézeau -
Фото Core developers Фото Particularly helpful Moodlers Фото Plugin developers Фото Testers Фото 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
У відповідь на Joseph Rézeau

Re: Browse the glossary by more than one alphabet

Joseph Rézeau -
Фото Core developers Фото Particularly helpful Moodlers Фото Plugin developers Фото Testers Фото 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
У відповідь на Joseph Rézeau

Re: Browse the glossary by more than one alphabet

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.

У відповідь на Joseph Rézeau

Re: Browse the glossary by more than one alphabet

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.?

Вкладення 2opt.gif
У відповідь на Shimon Nagar

Re: Browse the glossary by more than one alphabet

Joseph Rézeau -
Фото Core developers Фото Particularly helpful Moodlers Фото Plugin developers Фото Testers Фото 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
У відповідь на Joseph Rézeau

Re: Browse the glossary by more than one alphabet

Joseph Rézeau -
Фото Core developers Фото Particularly helpful Moodlers Фото Plugin developers Фото Testers Фото 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

Вкладення 07-10-2011 23-43-36.jpg
У відповідь на Joseph Rézeau

Re: Browse the glossary by more than one alphabet

Joseph Rézeau -
Фото Core developers Фото Particularly helpful Moodlers Фото Plugin developers Фото Testers Фото 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

Вкладення 11-10-2011 10-34-03.jpg
У відповідь на Joseph Rézeau

Re: Browse the glossary by more than one alphabet

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

У відповідь на Nicola Piccolo

Re: Browse the glossary by more than one alphabet

Joseph Rézeau -
Фото Core developers Фото Particularly helpful Moodlers Фото Plugin developers Фото Testers Фото Translators

hi  nicola

no, just create the specialalphabets field and leave it empty

joseph

У відповідь на Joseph Rézeau

Re: Browse the glossary by more than one alphabet

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

У відповідь на Nicola Piccolo

Re: Browse the glossary by more than one alphabet

Joseph Rézeau -
Фото Core developers Фото Particularly helpful Moodlers Фото Plugin developers Фото Testers Фото 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

У відповідь на Joseph Rézeau

Re: Browse the glossary by more than one alphabet

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