Adding Language Tags (HTML) Takes a Long Time

Adding Language Tags (HTML) Takes a Long Time

by Scott Gale -
Number of replies: 1
Is there an easier way to add all the language tags in my courses? I have installed a language pack, added tags to our titles, course descriptions, and quizzes and things are working great. To add the tags I am going into each field and adding <span class="multilang" lang="en">My Text</span> or using the Lang drop down box and the HTML editor to add the tags. I have to go into every location, every text box and do this for a few languages. This takes a long time. Is there a better way to add these tags?
Average of ratings: -
In reply to Scott Gale

Re: Adding Language Tags (HTML) Takes a Long Time

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
I'd say yes...well it can't be any harder than what you are doing already.

For each language $string (meaning one word, or a group of words) you can create your own custom language file for each language you need for your courses.

So you would need to compile these custom php files containing all the strings.
And all you would need to do in the page you are working on would be to instead of a span would be <?php get_string('a sentence','mylangfile.php'): ?> where the completed language file 'mylangfile.php' is stored in your Moodledata file in each the relevant lang folder, or in the relevant lang folder of your theme when you come to use Moodle.2.0.

Creating the individual files will be the big job, but the beauty of this is you are only having to write your original in English so the $string stays the same, all you need to change is it's equivalent in the language you need to have it displayed in but once created you can update them in a text editor like notepad and upload them to your Moodle site via Site Admin in Moodle 1.9x or upload them to your Theme folder in Moodle 2.0. as and when you need to.

It actually works in a similar way to how I got my theme to handle menu titles, se my It's all Greek to me! post in the forum.

Hope this helps.
Mary