Extending Multilanguage

Extending Multilanguage

by Marcus Schubert -
Number of replies: 13
Hi,

i wrote a little script to extend the multilang-filter. Basicaly it is simply find and replace. To get it work you have to activate the multilang-filter (of course winken) and set in your php.ini $CFG->filterall = true; Now most of the headings should work.
Simply copy the rewrite.php into your moodle-directory and execute it via browser.

Things I did:
  • all forums are multilang
  • courselists are multilang
  • assignments are multilang
  • resources are multilang
  • choices are multilang
  • quizes are multilang (not all eg editing questions)
  • surveys are mutilang
  • glossary is multilang (except for a lil bug)
  • journal is multilang
  • outgoing emails should be multilang
  • secure things, that don't have <lang>-tags
This script is only tested for 1.5 and don't use it on productive systems, use it only for testings.

Marcus
Average of ratings: -
In reply to Marcus Schubert

Re: Extending Multilanguage

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Marcus,

great script!

I'm trying to use it as a base to expand "officially" filters support to those strings (when $CFG->filterall is enabled) and, examining your code. I can't find any reason for the "hack" that you add to the format_text() function (add the lang tags if the string haven't them).

Why is such code there?

TIA and ciao smile
In reply to Eloy Lafuente (stronk7)

Re: Extending Multilanguage

by Marcus Schubert -
Hi Eloy,

i added these extra tags cause i recognized that if some text was not written in the lang-tags moodle put before an after the text some extra lines.

In the attachement you will see the new version winken
The new features are:
  • the dropdown box for naviagtion is multilang
  • theachers and admins view to evaluation of pupils is multilang
  • the glossary-bug is solved (works only for MySQL)
  • the actual theme is patched
  • lections should be multilang
  • comments are now everywhere in the code
During these "experiments" i found out that the theme orangewhite is a little bit "buggy".

I'm glad you liked my script, im trying to maintain it with 1.5 of moodle.

Regards

Marcus

PS: Remember it's for testing only winken
In reply to Marcus Schubert

Re: Extending Multilanguage

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Marcus,

thanks for your info. I've used your script to detect and list places where we should change code. But the solution implemented doesn't use the heavy format_text() function at all. Instead we have created a new format_string() function with its own caching mechanism and less complicated than the other.

For now, I'm changing each module->name to support $CFG->filterall (and all the central places where activitiy names are showed (grades, recent activity...). You can see the "live" progress of our work in:

http://moodle.org/mod/wiki/view.php?id=2935&wikipage=CFGFilterAllSupport

Once finished the module->name support, it's planned to start with other fields. The first in the list are glossary_entries->concept and glossary_categories->name to make the glossary 100% multilang (only with $CFG->filterall enabled!). And the list can grown as we detect more fields to be supported.

So, now, the objectives would be:

- Test 1.5 (daily builts) with $CFG->filterall=true to check that everything done is working properly.
- Suggest and discuss new fields where such feature could be interesting (with a list of needed changes to use it as a base to start).

Thanks for your work! Ciao smile
In reply to Eloy Lafuente (stronk7)

Re: Extending Multilanguage

by Marcus Schubert -
Hi Eloy,

sorry for replying so late, but life was busy Breites Grinsen
I added some strings to your wiki. Im just checking the latest version of moodle and i have to admit, that you did great work. It seems that at almost all places the multilang filter was applied, but i keep looking for strings, where it has to be applied winken
So i hope you can fix the strings that are left so far.

Regards Marcus
In reply to Marcus Schubert

Re: Extending Multilanguage

by Marcus Schubert -
I just checked and found that lesson->name is not everywhere applied. For example in the view.php. This also effects the help button. Please check again.

Marcus
In reply to Marcus Schubert

Re: Extending Multilanguage

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Opps,

searching my CVS logs it seems that if forgot to aplly filterall to lesson->name. I start with it just now. Thanks!

Ciao smile
In reply to Marcus Schubert

Re: Extending Multilanguage

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi (again),

now scorm->name field supports filterall too (it was quick to change).

After seeing your changes to the FilterAll Wiki Page, I've some questions for the list of fieds below. What are them axactly? Where do you see them "untranslated"?

* toppost->subject
* Lesson: text
* Lesson: jump->answer
* Lesson: otherjump
* Lesson: page
* Lesson: thispage
* Themes: heading: heading

I'll start with resource->summary, workshop_elements and journal entry name just now...

Ciao smile
In reply to Eloy Lafuente (stronk7)

Re: Extending Multilanguage

by Marcus Schubert -
Hi,

i just try to tell you where i saw these cuties untranslated winken

Themes: heading
Every Theme got its own header.html. If you use text but no picture as your moodle head, then you have to apply the filter there.

Lesson: jump
When you try to add a branch table in your lesson, then first the headline of the branch table is untranslated and the buttons where to jump are untranslated too.

Lesson: text
I saw you already did this in another way. In the version of last week there was a bug regarding to the help button, but now it works cool

Lesson: page
If you try to edit your lesson, than you might realize, that your title of the table branch or choice are not showing. But i didn't get this to work either.

toppost->subject
    I was sure that there was work to do in the forum, but i checked the latest 1.5 and it seems to work.

Please notice, that the course block and the list of avaible courses seem completly untouched. But so far great work anerkennend

Regards Marcus
In reply to Marcus Schubert

Re: Extending Multilanguage

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi,

now:

resource->summary
workshop_elements
journal_entry->name
lesson_page->title
lesson_answer->answer and
lesson_answer->response (feedback) should support multilang too.

You can see the status of the whole think in the CFGFilterAllSupport wiki page. Feel free to comment/add new fields to the list.

Next step: glossary concepts and categories.

Ciao smile

PS: Starting from 1.5, a new (preferred) syntax for multilang texts is supported:
<span lang="en">Hello!</span><span lang="es">Hola!</span>
The old syntax is "deprecated" (but working, don't worry) wink
In reply to Eloy Lafuente (stronk7)

Re: Extending Multilanguage

by Marcus Schubert -
Great work Eloy,

I will try the new syntax next week, cause from this afternoon till monday i got holidays herausgestreckte Zunge

Nevertheless I got a question: Are the
  • ---site->fullname---
  • ---course->fullname---
  • ---category->name---
really such big changes? At least course->fullname and category->fullname shouldn't be changed hundreds of times. At least I found only 4 times where I had to change it - at least in the blocks and front page winken

Wish you much fun in making the next steps

Regards Marcus
In reply to Eloy Lafuente (stronk7)

Re: Extending Multilanguage

by Marcus Schubert -
Hi Eloy,

i just updated your Wiki with some things to do. I think in the lesson module has to be done a big job. Anyway thanks for supporting the multilang filter Breites Grinsen

Marcus
In reply to Marcus Schubert

Re: Extending Multilanguage

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
How I've started to support $CFG->filterall sitewide.

The first working string is $forum->name, please check it with the next 1.5 daily build (emails, visualization everywhere...).

I'm going to maintain a list of strings to be filtered and their status in "Developer Wiki". Feel free to add strings (db fields) to be processed by $CFG->filterall (and report any missing or wrong situation to http://moodle.org/bugs).

TIA and ciao smile