Getting Modular with Moodle

0
57
8 min read

 

Moodle 1.9 Top Extensions Cookbook

Moodle 1.9 Top Extensions Cookbook

Over 60 simple and incredibly effective recipes for harnessing the power of the best Moodle modules to create effective online learning sites

  • Packed with recipes to help you get the most out of Moodle modules
  • Improve education outcomes by situating learning in a real-world context using Moodle
  • Organize your content and customize your courses
  • Reviews of the best Moodle modules—out of the available 600 modules
  • Installation and configuration guides
  • Written in a conversational and easy-to-follow manner
        Read more about this book      

(For more resources on Moodle, see here.)

Changing site-wide settings

Activity modules and blocks can have site-wide settings that you can adjust. These settings allow consistent changes in the use of the module across an entire site, but even during testing you might want to change such settings. It may be that you just want to see what settings can be changed globally for a module.

Getting ready

To achieve this you must have your web server running with Moodle installed. You need to be able to log in as the administrator, or get the help of someone who can. You should have installed the modules that you want to change settings for.

The following steps assume you have installed the Progress Bar block, which has global settings that can be changed.

How to do it…

Log in as the site administrator and visit the root page of the site. To get to the global settings of a module, on the Site Administration menu, select Modules, then Activities or Blocks, whichever is appropriate. The Progress Bar block is a block, so select Blocks to reach its global settings.

The next step is to select the name of the module. For our test, the module name is Progress Bar. The settings for the module should appear in a form.

Moodle 1.9 Top Extensions Cookbook

Not all activity modules or blocks have global settings. For many modules, this is not necessary. Changes to the global settings affect the configuration of the module, including any instances that may already exist, and any that are added in future, across the site.

There’s more…

Be a little careful when changing global settings on a live site. If the module is currently in use, changing global settings can affect the experience of students and teachers. Accidentally using invalid global settings can detrimentally affect the running of the module on the site.

See also

  • Adding modules to Moodle
  • Getting rid of modules

Getting modules to speak your language

Another feature of Moodle is its capacity for internationalization. This means that the same software can be used by people speaking different languages. While translations for over 80 languages are available for the core functionality of Moodle, most modules only offer translations for a smaller number of languages, and the language you are teaching in may not be one of them.

Adding a translation for a module is simple to do. If you give your translation to the author of the module, your efforts could also benefit others who speak your language.

Getting ready

It is assumed that you have set the default language for your site. If not, there is more information about adding a language pack and setting the language for your site later.

In order to create a translation for a module, you don’t need any real programming experience; it’s actually quite simple. Some understanding of HTML tags can be an advantage.

You will need a text editor that can create and edit Unicode files. Word processors are not appropriate for this task, and a simple editor, such as Windows Notepad, is not up to the job. There are many free editors available that will allow you to create and edit Unicode files. One example available for Windows is Notepad++, which is a free editor and is also available as a portable application.

The steps that follow provide an example that assumes the Progress Bar block has been installed.

How to do it…

Where the module was installed, there will usually be a /lang folder. For the Progress Bar block this is located at moodle/blocks/progress/lang. Within this folder, there are folders for different languages, most of them contributed by users around the world.

Moodle 1.9 Top Extensions Cookbook

If you are reading this, it is assumed you have an understanding of English, so have a look inside the en_utf8/ folder. You will see a file called block_progress.php and another directory called help/. The block_progress.php file contains strings of text used in the module, each with a code and the string displayed on screen. Open this file in your editor to see the contents.

Moodle 1.9 Top Extensions Cookbook

Inside the lang/help/progress/ directory there are a number of HTML files, each relating to a help topic. These appear when a help icon (usually appearing as a question mark) is clicked. Opening these files in your web browser will show you the rendered version of these files and opening them in your editor will show you the HTML source of the documents.

Moodle 1.9 Top Extensions Cookbook

To add a new language, you first need to find out the two letter code for your language. To see the list of supported languages visit the following site. You will also see the code letters for each language, and you need to follow the same code. Refer to http://download.moodle.org/lang16/.

Return to the lang/ folder. For the Progress Bar block this is at moodle/blocks/progress/lang/. Assuming that you know English as a second language, copy the en_utf8/ folder and all of its content. Rename the folder with the two letter code for your language, for example, the folder for Afrikaans would be af_utf8/. Be sure to preserve the filenames and folder names within (they do not need translation, only the contents).

Open the block_progress.php file in your Unicode editor. You need to translate the string on the right of the = symbol, within the quotes. Do not translate the code value for the string on the left. You may need to see the string in use to get a sense of what the string is intended for, in order to make an accurate translation. If you include any apostrophes within the string, escape the quote with a slash, as shown in the following example, otherwise the string will be seen as coming to an end earlier than it should.

$string[‘owners’] = ‘Owner’s’;

If there is code within the strings, or HTML tags, that you are unsure about, leave these and just translate any text around them.

You can also translate the HTML files in moodle/blocks/progress/lang/help/progress/ to produce help files in your language. Open these in your editor and translate the text within the files. Again, avoid changing any HTML or code you don’t understand. Some help files also include PHP code segments within <?php and ?> tags, avoid changing this content.

Be sure to test your translated files. If, after changing a translation file, nothing appears on the course page, it may be that you have inadvertently created an error. Typically this comes from mismatched quotes around strings. Be sure each starting quote is matched with a closing quote, and any enclosed quotes are escaped. Test that your translated text items are appearing correctly and have an appropriate meaning in your language. Once created, you can use this translation throughout your site.

The final step is to send your translation to the author of the module. You should be able to find their contact details on the Moodle Modules and plugins database entry page for the module. If you have translated the language strings but not translated the help files, this is still a helpful contribution that can be shared. Zip up the files you have translated and e-mail them to the author who will usually be more than happy to include your contribution within the module for future downloaders.

How it works…

Each time the module is loaded, its code is interpreted by the web server and HTML is produced to form the part of the page where the module will appear. Within the code, instead of writing text strings in the author’s language, there are calls to functions that check the language and draw the appropriate strings from the language files. This way, all that is needed to change from one language to another is a different language file.

There’s more…

If you want to use another language throughout your Moodle site, the following sections are a basic guide for installing and selecting the language.

Adding a language pack

Visit the following site to find if a language pack is available for your language: http://download.moodle.org/lang16/.

If your language is available, download the appropriate zip file and extract its contents to the directory moodle/lang/. If your language is Afrikaans, for example, the language files should be contained in moodle/lang/af_utf8/. Ensure you do not introduce additional unnecessary directory levels.

Selecting a language for your site and courses

A language can be set as a default for courses on the site. This can be overridden at the course level if desired, or by students individually.

To set the default language, log in as administrator and go to the site root page. On the Site Administration menu, select Language, then Language Settings. The default language can be set on the page that appears.

Moodle 1.9 Top Extensions Cookbook

Individual users can set a preferred language in their profile settings.

Moodle 1.9 Top Extensions Cookbook

For individual courses a language can be set. This will “force” students to use that particular language rather than their preferred language.

Moodle 1.9 Top Extensions Cookbook

See also

  • If it’s not quite what you want…

LEAVE A REPLY

Please enter your comment!
Please enter your name here