Localization

Localization is concerned with the adaptation of software so that it can be used in different locales. A locale is linked to a region where certain cultural aspects apply, such as, language, formatting of dates and times, calendric representation, and so on.

As Moodle is used throughout the world, and given the fact that many educational establishments span across continents, it is important that localization is fully supported. The key areas in which Moodle can be configured are language-related settings and calendric information.

Tip

If your main language is something other than (UK or USA) English, make sure you select this during installation. This way, locale settings as well as role names and descriptions will be localized properly.

Languages, idiomas, 语言, and اللغات

Moodle supports over 75 languages, including Latin! To represent the character sets of multiple languages, a standard called Unicode has been adopted; it covers the most modern scripts that are used throughout the world. Moodle also fully supports right-to-left writing systems such as Arabic.

Languages, idiomas, 语言, and اللغات

Language packs

Locales are characterized by standardized two-letter region codes representing a language and optional letters. For example, pt represents Portuguese as spoken in Portugal, whereas, pt_br represents Brazilian Portuguese. Moodle uses the same representation for its more than 100 available language packs. Some packs of nonstandardized languages have made their way into Moodle, such as Deutsch Kids, an adopted version that's targeted at young learners. For these specialized packs, new codes have been made up by their creators, for example, de_kids.

In order to support a language, you have to install its language pack, which contains all the terms used in Moodle. Moodle will download any requested language packs from https://download.moodle.org/. Go to Language | Language packs to include new packs:

Language packs

In the preceding screenshot, six language packs, consisting of Arabic, German, English, French, Polish, and simplified Chinese, have been installed (you can see them in the list on the left-hand side). To add more language packs, select one or many locales on the right-hand side and click on the Install selected language pack(s) button. To reverse this operation, select a single or multiple language packs in the list on the left-hand side and click on the Uninstall selected language pack(s) button.

The English(en) language pack cannot be uninstalled. It is used as a reference language in cases where strings in other languages are not translated. Some language packs are not complete, and sometimes, only non-admin features have been translated.

Once installed, the user can choose a language (if configured) from the language menu, which is usually located in the header or from within their profile. Bear in mind that only terms and phrases that are part of Moodle will change. Any content created will not be translated unless the content is configured to make use of the multilingual feature (refer to the Language customization section). We've already looked at multilingual menu items, which were covered in Chapter 7, Moodle Look and Feel.

Language packs

Language packs are kept and maintained at download.moodle.org/langpack/3.x (where, x is the current release version number). Some packs are updated more frequently than others; clicking on the Update all installed language packs button copies the latest versions to your server.

Language settings

Moodle offers a number of language settings that you can find by going to Language | Language settings. These settings are listed in the following table:

Settings

Description

Language auto detect

By default, Moodle detects the language from the used web browser locale. If you wish to override this and use the default site language instead, uncheck the checkbox.

Default language

This allows you to select the language that will be used throughout the site, unless it's overridden by individual users via the language menu or from their profile. Only those languages appear for which a language pack has been installed and is shown in the language menu.

Display language menu

If enabled, the language menu will be displayed on the front page header. The user will always have the ability to change the language in their profile, no matter what the setting is. Some themes do not support this feature.

Languages on language menu

If left empty, all the installed languages will appear in the language menu. To narrow down this list, specify a comma-separated list of locale codes.

Cache language menu

Unless you add or remove language packs, it is recommended that you leave this setting enabled. It caches the language menu on the front page.

Cache all language strings

Unless you modify a language pack, it is recommended that you leave this setting enabled. It caches all the language strings rather than loading them dynamically.

Site wide locale

The localization operations are internally driven by system locales, which are selected on the basis of the chosen language pack. If you wish to change this (which is hardly ever required), select the site-wide locale in its operating system format such as en_US.UTF-8. The file has to be installed as part of the operating system.

Excel encoding

When downloading data in the Microsoft Excel format (such as in gradebook reports or log files), Moodle uses the Unicode format. Older versions of Excel only support Latin encoding.

There are three additional language-related settings that are placed elsewhere:

  • The Full name format option, which you can see by going to Users | Permissions | User policies, allows you to choose the format of the full name. There are a number of placeholders that can be used in the field, for example, first name and first name phonetic. If the language placeholder (default) is entered, the format of the full name is decided by the current language pack. This way, you can cater to local sensitivities with regard to first names.
  • The Alternative fullname format option, which you can see by navigating to Users | Permissions | User policies, is the same as Full name format, but it defines how names are shown to users with the moodle/site:viewfullnames capability
  • The Allow extended characters in usernames parameter, which you can see by going to Security | Site policies, removes the limitation of only using alphanumeric characters in usernames.

Language customization

Each phrase, term, and string used in Moodle is represented in language files, which are tied to certain modules in Moodle (these are located in the lang directory). There are almost 20,000 (!) language strings in Moodle, which demonstrate the scale of the system. You have the ability to change any language string in Moodle. You might want to change words or phrases, for example, you may want to change Grades to Marks, Outcomes to Work indicators, Teacher to Instructor, and so on.

To customize a language file, go to Language | Language customization, where you will first have to choose a language to be customized. Clicking on the Open language pack for editing button will lead to the checkout step; this might take a few seconds. Once this has been done, you can click on the Continue button.

Tip

Moodle creates a local directory, located inside $CFG->dataroot, where it stores your edited phrases. Make sure that you have write access to the lang directory to avoid any error messages.

Moodle keeps a separate language file for each module. This separation is beneficial as it frees the underlying code (developed by programmers) from the localization (worked on by translators). However, the disadvantage is that you need to know where (that is, in which PHP module) the respective strings are located. However, Moodle offers a good filtering mechanism to simplify the search for strings that are to be modified.

Let's say you wish to change the term Guest to Visitor. As it is likely that the term Guest appears in a number of different modules, it is safe to select all the items in the Show strings of these components list.

You further have filter criteria to choose from. The options include Customised only for strings that have been changed in previous sessions, Help only for balloon help tool tips, and Modified only for phrases that are changed in the current session. The Only strings containing parameter requires the word or phrase you are looking for (in our case, guest). Internally, Moodle uses string identifiers, which can also be used to search content. To do this, just enter the string identifier in the String identifier textbox:

Language customization

Once the search has been successful, the following information is shown for each string that matches the filter:

Language customization

Item

Description

Component

This is the system component to which the string belongs. This also includes third-party add-ons.

String

This is the string identifier (mainly used by programmers).

Standard text

This consists of the string text or phrases in English. If the language that's been chosen is other than English, the translated version is displayed underneath.

Local customisation

This is where you can override the current text.

You might have spotted the $a parameter in the fifth phrase from the top. This is a so-called placeholder, which is substituted on the fly; in this instance, it is substituted with the name of a course. These have to be included in the local customization. Some placeholders will contain a parameter, such as $a->id or $a->query. You should keep them as they are used to avoid any problems.

Make sure that you click on the Save changes to the language pack button to reflect the changes on your Moodle site. These changes will be maintained when your site is updated.

You can grant users access to the Language customization menu via the report/customlang:edit and report/customlang:view role capabilities.

There is also a setting called Show origin of languages strings, which you can see by going to Development | Debugging, that is useful when you customize a language pack. If this setting is enabled, it shows the file and string identifier besides each string as the output on the screen.

If you wish to contribute to a language pack or want to create a new one, go to the Moodle languages portal at https://lang.moodle.org/. On this site, you will find information on how to utilize the AMOS tool and the AMOS Moodle block (for more details, take a look at https://docs.moodle.org/dev/AMOS_manual).

Multilingual content

If you have users who deal with multilanguage content, it is recommended that you turn on the Multi-Language Content filter by going to Plugins | Filters | Manage filters. The Multi-Language Content filter supports the <span lang="xx"class="multilang"> tag by default; the older <lang> tag can be enabled as well in the settings of the filter. Your designers and content creators might want to make use of this feature, especially when dealing with language-related content.

An additional plugin has already been mentioned in the previous chapter when we dealt with availability restrictions (https://moodle.org/plugins/availability_language). Once the add-on has been installed, your users will have the ability to restrict individual activities and resources that are based on the selected language. In addition to the available standard restrictions, such as activity completion and user profile, course authors will also be able to specify a language as the criteria.

Calendaric information

Different cultures represent calendric information—date, times, and time zones—in different formats.

Tip

Locales have to be installed for non-English calendars to work properly. On Unix systems, check with the locale-a locale. Otherwise, your days in the calendar will be displayed in English.

Calendars

By default, Moodle formats date and time according to the set locale for Gregorian calendars. Other calendars are supported but they have to be installed as a plugin. To do so, follow the instructions in Chapter 8, Moodle Plugins and browse in the Calendars section in the plugins database.

A few additional settings are changeable by going to Appearance | Calendar. The fields that are relevant to localization are shown in the following screenshot (I have installed the Japanese calendar plugin):

Calendars

Calendar type is the default setting for the site and all its users, which can be overridden in the user profile via Preferred calendar. If you need to see all the calendar events, turn on Admins see all; otherwise, you will only see your own events. Times are displayed according to the selected locale; Time display format can be overridden by a 12-hour or a 24-hour clock. Different countries have a different start day for the week, for instance, in North America, the week starts from Sunday, whereas in Europe, it starts from Monday (Start of week). Not all countries use the default values of Saturday and Sunday as the weekend days. For example, in Islamic countries, the weekend is on Friday and Saturday, whereas Sunday is a normal working day. This can be specified in the Weekend days parameter.

Time zones

Moodle supports systems that span across time zones. This happens in three scenarios:

  • In countries that cover more than a single time zone
  • Sites that have learners from multiple countries/time zones
  • In a situation where the server is hosted outside the time zone of the organization, for example, with an Internet Service Provider

To modify the default time zone parameters, go to Location | Location settings:

Time zones

The value selected in the Default timezone parameter is used throughout the system. The default value is set during installation, but this might not reflect your local time. Each learner can change this setting in their user profile, unless it is forced to a particular time. Displayed times, for example, for an assignment deadline, are adjusted to the selected time zone. If specified, Default country and Default city are used for new user accounts.

Every so often, rules in certain time zones (there are almost 2,300 separate ones!) change, for instance, the adjustment of daylight savings time. In this case, you should update these settings by navigating to Location | Update timezones. New versions of Moodle always contain the latest version of the time zone rules.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.176.194