Change language strings in Moodle

Moodle is widely known and used in many countries around the globe. You can run moodle in over a 70 languages (English - of course ;-), German, French, but also Japanese or Hindi.). You can find full list of languages here

We call these language packages language packs (or langpacks in short). They are consisting of php files with lines:
define['somedefinition'] = "What the definition means, in selected language"
You can change the right sides of these lines to change literal meanings of definitions on the left sides.

Language variables are separated into different files for better navigation, mostly with names of modules/blocks they belong to. General strings are found in moodle.php file

Let say, we want to change label Course categories that is on the Front page to something different. Like Lesson categories for example.

Here is step by step approach.

  1. Login as administrator
  2. Go to Site Administration block
  3. Choose Language link
  4. Choose Language editing
  5. Select language pack you want to edit (if you have more than one installed)
  6. Choose Edit words or phrases
  7. Select file to edit (moodle.php in our case)
  8. Find there a "Course categories" string (with CTRL+F)
  9. Change the meaning of the definition to "Lesson categories"
  10. You will find Save changes button at the bottom on the page

Problems you may run into:
Definition meanings are not writable
Solution: Your server (apache user) don't have needed rights for write in language directory. Change permissions (chmod or set it in gui).

Better Solution: Let Moodle create your "local" directory with yours changed strings. In this case you will not loose your edits next time you will be updating. (In Moodle 1.9 it is not possible to change original language packs with administration gui, only create local directory)

You can find button needed for creating local directory on Edit words or phrases page.

I don't know what file to edit
Solution: Use some IDE that can search through directories and files in. I am using free PSPad It's very helpful for programming and creating Moodle customs and it's is really user friendly.

And as usually you can find small video (1:07, 1.4MB) with higher mentioned process HERE

No comments: