Language packs: Difference between revisions
(Re-organized ==Why do some languages have several different language packs available?==) |
Tim Bahula 2 (talk | contribs) m (→Can I make a language pack for kids?: clean up, typos fixed: may 2023) → May 2023)) |
||
(32 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
{{Language}} | {{Language}} | ||
==Language pack installation and uninstallation== | ==Language pack installation and uninstallation== | ||
[[File:installing a lang pack.png|thumb|Installing a language pack]] | |||
Over 100 language packs are available for an administrator to install on your Moodle site in 'Language packs' in the Site administration. Simply select the languages you require from the list of available language packs and click on the "Install selected language pack" button. | |||
'''New in 3.11:''' A new search box allows administrators to quickly locate a language pack for installation. | |||
Multiple language packs may be selected for install by holding down the Apple or Ctrl key whilst clicking on the language packs. | Multiple language packs may be selected for install by holding down the Apple or Ctrl key whilst clicking on the language packs. | ||
Line 8: | Line 10: | ||
Installing many (20+) language packs has [https://moodle.org/mod/forum/discuss.php?d=241098 almost 0 impact] on Moodle performance. | Installing many (20+) language packs has [https://moodle.org/mod/forum/discuss.php?d=241098 almost 0 impact] on Moodle performance. | ||
Language packs are a work-in-progress, since new language strings are added for new features in each new version of Moodle. [https://download.moodle.org/langpack/ | Multiple language packs may be uninstalled, once selected, by clicking the 'Uninstall selected language packs" button. | ||
===Language packs and manual download=== | |||
Language packs are a work-in-progress, since new language strings are added for new features in each new version of Moodle. Lang packs can be manually downloaded from [https://download.moodle.org/langpack/{{Version}}/ Language packs for Moodle {{Version}}]. The page also lists the percentage of language strings translated in each language pack. | |||
==Parent language packs and child language packs== | ==Parent language packs and child language packs== | ||
Certain language packs (a child language pack) contain only the modified language strings from their parent language, rather than a complete set. Thus, it is necessary to install the parent language pack too. On <nowiki>https://download.moodle.org/langpack/3.11/</nowiki> (replace 3.11 by the correct version number) you can see those languages printed in ''italic''). | |||
Note: If your site uses a child language pack and if you use the [[Multi-language content filter]], you need to be very careful about how to use if (as reported in MDL-55197). See [[Multi-language content filter]] for more details and examples. | |||
==Manual language pack installation== | ==Manual language pack installation== | ||
In general, the easiest way to install additional language packs is from within Moodle. However, it is also possible to install a language pack manually by downloading the zip file from [https://download.moodle.org/langpack/{{Version}}/ Language packs for Moodle {{Version}}] and unzipping it to a directory called ''lang'' in your ''moodledata'' directory. | |||
In general, the easiest way to install additional language packs is from within Moodle. However, it is also possible to install a language pack manually by downloading the zip file from [https://download.moodle.org/langpack/ | |||
==Language pack updates== | ==Language pack updates== | ||
* Language packs can be updated via ''Administration > Site administration > Language > Language packs''. | * Language packs can be updated via ''Administration > Site administration > Language > Language packs''. | ||
* You can see which language packs have updates because they are listed in both 'Installed language packs' and 'Available language packs'. | * You can see which language packs have updates because they are listed in both 'Installed language packs' and 'Available language packs'. | ||
Line 41: | Line 26: | ||
* The English language pack is updated automatically each time the site is upgraded. | * The English language pack is updated automatically each time the site is upgraded. | ||
* As most language packs are a work in progress, it is a good idea to update them regularly. | * As most language packs are a work in progress, it is a good idea to update them regularly. | ||
All installed language packs are updated as a [[Scheduled tasks|scheduled task]]. By default the task is run daily. | All installed language packs are updated as a [[Scheduled tasks|scheduled task]]. By default the task is run daily. | ||
==Moodle can not connect to download.moodle.org== | |||
This can happen if: | |||
* You configured over-zealous security restrictions in your server. Check that your server can contact the download.moodle.org server. | |||
* The download.moodle.org server is down and if you try to manually download the language pack, it fails too. Please try again later. | |||
* Your internet service is faulty :( | |||
[[File:ERROR language import not available.png|600px]] | |||
==Inside a language pack== | ==Inside a language pack== | ||
A standard Moodle comes with an English language pack only. It is installed in ''moodledata/lang/en.'' | A standard Moodle comes with an English language pack only. It is installed in ''moodledata/lang/en.'' | ||
The English language terms (or 'strings') | The English language terms (or 'strings') for the main (core) Moodle features such as administration, roles etc., are stored in ''lang/en.'' Language files relating to modules, blocks and other plugins are stored with the files of that particular plugin. So if you wanted to see the language strings for the badges block for example, you would look in ''blocks/badges/lang/en''. If you wanted to see the language files for the workshop module, you would look in'' mod/workshop/lang/en''. | ||
If you install another language pack, you will then get a folder such as ''lang/fr'' which would have French translations of Moodle terms. Unlike with English, other language packs such as ''lang/fr'' will contain all translations along with the main core terms so you would find see for example the badges strings in ''lang/fr/block_badges.php'' and the workshop strings in ''lang/fr/workshop.php''. | |||
These files (which all end in .php) contain short phrases, often called "strings". Strings may contain a placeholder (between the curly brackets below). This placeholder is replaced with the chosen words from the language pack when the string is displayed. The term between the square brackets is called the 'string identifier' or the 'string name'. Examples: | |||
$string['addnewcourse'] = 'Add a new course'; | $string['addnewcourse'] = 'Add a new course'; | ||
$string['hidesection'] = 'Hide section {$a}'; | $string['hidesection'] = 'Hide section {$a}'; | ||
If a string hasn't been translated, then Moodle will use the parent language or the original English version. Thus, you might see a Moodle site where some terms have been translated into a language but others still display in English. | If a string hasn't been translated, then Moodle will use the parent language or the original English version. Thus, you might see a Moodle site where some terms have been translated into a language but others still display in English. | ||
==Can I personalize language strings per theme?== | ==Can I personalize language strings per theme?== | ||
Not directly, but you can use new local (child) language packs to achieve different courses behaviours/looks | Not directly, but you can use new local (child) language packs to achieve different courses behaviours/looks | ||
Line 64: | Line 49: | ||
You can have a course with a different theme 'and' a different child language pack. You will then have personalized language strings in the only course that uses that particular theme. | You can have a course with a different theme 'and' a different child language pack. You will then have personalized language strings in the only course that uses that particular theme. | ||
===Changing the behaviour of a course=== | ===Changing the behaviour of a course=== | ||
* If you do not want a student to see any reference to grades when he/she finishes a lesson, by editing the correct text string, it is possible to replace "Your score is 9 (out of 10)" with "Be sure to get your certificate". Or change "Congratulations - end of lesson reached" to "We hoped this lesson helped you". See [[ | * If you do not want a student to see any reference to grades when he/she finishes a lesson, by editing the correct text string, it is possible to replace "Your score is 9 (out of 10)" with "Be sure to get your certificate". Or change "Congratulations - end of lesson reached" to "We hoped this lesson helped you". See [[Lesson FAQ#Can I change the End of Lesson page display|how to change the end of lesson page display]]. | ||
* You can have several different courses, each using a different (child) language pack and each one showing personalized language strings. | * You can have several different courses, each using a different (child) language pack and each one showing personalized language strings. | ||
* See [https://moodle.org/mod/forum/discuss.php?d=220671 this forum post] for detailed instructions on how to create your new child languages. | * See [https://moodle.org/mod/forum/discuss.php?d=220671 this forum post] for detailed instructions on how to create your new child languages. | ||
==Can I install one particular language pack and supplement the missing translations using a second (related) language pack?== | ==Can I install one particular language pack and supplement the missing translations using a second (related) language pack?== | ||
* | * The short answer is No. | ||
* | * But there is a complicated way to achieve this :( | ||
* See the Spanish language Moodle Documentation page at [https://docs.moodle.org/all/es/Personalizaci%C3%B3n_del_idioma_(transplantar_archivos) https://docs.moodle.org/all/es/Personalización del idioma (transplantar archivos)] about grafting files from one language into another. | ** You can use the [[Language customization]] tool. If you do make your own translations, please consider [https://docs.moodle.org/dev/Contributing_a_translation contribuiting your translated strings] to the language pack maintainers, so that your language pack can grow. | ||
** See the Spanish language Moodle Documentation page at [https://docs.moodle.org/all/es/Suplementar_todas_las_traducciones_faltantes_del_Espa%C3%B1ol_internacional_con_traducciones_del_Espa%C3%B1ol_de_M%C3%A9xico Suplementar todas las traducciones faltantes del Español internacional] and [https://docs.moodle.org/all/es/Personalizaci%C3%B3n_del_idioma_(transplantar_archivos) https://docs.moodle.org/all/es/Personalización del idioma (transplantar archivos)] about grafting files from one language into another. | |||
==Can I make a language pack for kids?== | ==Can I make a language pack for kids?== | ||
* Yes. | * Yes. | ||
* The current existing language packs for kids are: | * The current (May 2023) existing language packs for kids are: | ||
** de_kids | ** de_kids (which requires de) | ||
** en_kids (which | ** el_kids (which requires el) | ||
** en_kids (which requires the default en) | |||
** es_mx_kids (which requires es_mx) | |||
** he_kids (which requires he) | ** he_kids (which requires he) | ||
** hi_kids (which requires hi) | |||
** ja_kids (which requires ja) | ** ja_kids (which requires ja) | ||
Line 85: | Line 72: | ||
** Install the (en_kids) English for kids language pack in your local Moodle server | ** Install the (en_kids) English for kids language pack in your local Moodle server | ||
** You will have to edit 10 files (which are stored in the moodledata/lang/en_kids folder). | ** You will have to edit 10 files (which are stored in the moodledata/lang/en_kids folder). | ||
** You can use [https://notepad-plus-plus.org/ Notepad++ | ** You can use [https://notepad-plus-plus.org/ Notepad++] or any other text editor, but avoid using MS Word or MS Notepad. | ||
* Start with langconfig.php and choose your main language as the parentlanguage | * Start with langconfig.php and choose your main language as the parentlanguage | ||
* When you have finished translating all the strings, you can | * When you have finished translating all the strings, you can [https://docs.moodle.org/dev/Starting_a_new_language_pack request a new language pack] to the person administering all Moodle language packs. | ||
* Upload into AMOS the 10 files in your | * Upload into AMOS the 10 files in your moodledata/lang/en_kids folder | ||
* Remember to keep updating and expanding your new language pack | * Remember to keep updating and expanding your new language pack | ||
==Why do some languages have several different language packs available?== | ==Why do some languages have several different language packs available?== | ||
See [https://docs.moodle.org/dev/Translation_FAQ#Moodle_languages_with_several_available_language_packs the developer's documentation] about this. | See [https://docs.moodle.org/dev/Translation_FAQ#Moodle_languages_with_several_available_language_packs the developer's documentation] about this. | ||
==Why has my language pack suddenly forgotten some translations?== | |||
See the following image showing (Insignias) a properly translated Spanish language string (green rectangle) and an unstranslated English language string (red rectangle) for 'Badges' plus a mixture of translated and untranslated strings with a language pack that should have 100% of the core strings translated. | |||
[[File:Language packs mixed-up llanguages shown.png|200px]] | |||
If you try to update your language packs you will get a message indicating 'Update of 'xxxx_old' language pack skipped. | |||
[[File:Something_old language pack can not be updated.png|300px]] | |||
Read the following section for the cause and the fix. | |||
==Why do I have a language pack named xx_old' that I never installed?== | |||
Sometimes you may find (see image below) that your server has, in addition to your usual language packs (e.g., en, es_mx), an odd-named language pack with an _old name ending (e.g., es_mx_old), that -obviously- can not be updated. | |||
* This came from an incomplete automated language pack update because the lang pack update fails in the middle of the process. | |||
**The update first renames the existing lang directory so that it has the _old suffix and then it tries to unzip the new one. | |||
** If unzipping is successful, the old directory is removed. | |||
** Check that the [https://docs.moodle.org/405/en/admin/environment/php_extension/zip ZIP] PHP extension is OK in the [[Environment]]. | |||
** If your server has languages other than English, the language packs update process will need to download all the corresponding language packs, which will take some time. If you have a low speed internet provider, you could get a script timeout error. To prevent this, you will need to edit the server/php/php.ini file and change the line that has 'max_execution_time = 30' into 'max_execution_time = 600'. | |||
* There may also be a language pack that has mixed languages, like 'English (es_mx)', that obviously can not be. | |||
[[File:Odd-named installed language pack.png|400px]] | |||
* The reason why the language menu shows it is because moodledata/lang/es_mx/ is incomplete and its langconfig.php is missing so the translation of the string "thislanguage" (name of it) falls back to the default English. | |||
* You must uninstall all strange-looking language packs and re-install your usual language packs. | |||
[[File:Language packs uninstall all mixed-up languages.png|400px]] | |||
==See also== | ==See also== | ||
* List of [http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes language codes] on Wikipedia | * List of [http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes language codes] on Wikipedia | ||
[[eu:Hizkuntza-paketeak]] | [[eu:Hizkuntza-paketeak]] | ||
[[es:Paquetes de idioma]] | [[es:Paquetes de idioma]] |
Latest revision as of 16:51, 11 January 2024
Language pack installation and uninstallation
Over 100 language packs are available for an administrator to install on your Moodle site in 'Language packs' in the Site administration. Simply select the languages you require from the list of available language packs and click on the "Install selected language pack" button.
New in 3.11: A new search box allows administrators to quickly locate a language pack for installation.
Multiple language packs may be selected for install by holding down the Apple or Ctrl key whilst clicking on the language packs.
Installing many (20+) language packs has almost 0 impact on Moodle performance.
Multiple language packs may be uninstalled, once selected, by clicking the 'Uninstall selected language packs" button.
Language packs and manual download
Language packs are a work-in-progress, since new language strings are added for new features in each new version of Moodle. Lang packs can be manually downloaded from Language packs for Moodle 4.5. The page also lists the percentage of language strings translated in each language pack.
Parent language packs and child language packs
Certain language packs (a child language pack) contain only the modified language strings from their parent language, rather than a complete set. Thus, it is necessary to install the parent language pack too. On https://download.moodle.org/langpack/3.11/ (replace 3.11 by the correct version number) you can see those languages printed in italic).
Note: If your site uses a child language pack and if you use the Multi-language content filter, you need to be very careful about how to use if (as reported in MDL-55197). See Multi-language content filter for more details and examples.
Manual language pack installation
In general, the easiest way to install additional language packs is from within Moodle. However, it is also possible to install a language pack manually by downloading the zip file from Language packs for Moodle 4.5 and unzipping it to a directory called lang in your moodledata directory.
Language pack updates
- Language packs can be updated via Administration > Site administration > Language > Language packs.
- You can see which language packs have updates because they are listed in both 'Installed language packs' and 'Available language packs'.
- To update all installed language packs (except English and any local language packs) click the 'Update all installed language packs' button.
- For sites with a large number of language packs installed, to update just a few installed language packs at a time, select the languages from the 'Available language packs' list and click the 'Install selected language pack(s)' button.
- The English language pack is updated automatically each time the site is upgraded.
- As most language packs are a work in progress, it is a good idea to update them regularly.
All installed language packs are updated as a scheduled task. By default the task is run daily.
Moodle can not connect to download.moodle.org
This can happen if:
- You configured over-zealous security restrictions in your server. Check that your server can contact the download.moodle.org server.
- The download.moodle.org server is down and if you try to manually download the language pack, it fails too. Please try again later.
- Your internet service is faulty :(
Inside a language pack
A standard Moodle comes with an English language pack only. It is installed in moodledata/lang/en.
The English language terms (or 'strings') for the main (core) Moodle features such as administration, roles etc., are stored in lang/en. Language files relating to modules, blocks and other plugins are stored with the files of that particular plugin. So if you wanted to see the language strings for the badges block for example, you would look in blocks/badges/lang/en. If you wanted to see the language files for the workshop module, you would look in mod/workshop/lang/en.
If you install another language pack, you will then get a folder such as lang/fr which would have French translations of Moodle terms. Unlike with English, other language packs such as lang/fr will contain all translations along with the main core terms so you would find see for example the badges strings in lang/fr/block_badges.php and the workshop strings in lang/fr/workshop.php.
These files (which all end in .php) contain short phrases, often called "strings". Strings may contain a placeholder (between the curly brackets below). This placeholder is replaced with the chosen words from the language pack when the string is displayed. The term between the square brackets is called the 'string identifier' or the 'string name'. Examples:
$string['addnewcourse'] = 'Add a new course'; $string['hidesection'] = 'Hide section {$a}';
If a string hasn't been translated, then Moodle will use the parent language or the original English version. Thus, you might see a Moodle site where some terms have been translated into a language but others still display in English.
Can I personalize language strings per theme?
Not directly, but you can use new local (child) language packs to achieve different courses behaviours/looks
Changing the look of a course
You can have a course with a different theme 'and' a different child language pack. You will then have personalized language strings in the only course that uses that particular theme.
Changing the behaviour of a course
- If you do not want a student to see any reference to grades when he/she finishes a lesson, by editing the correct text string, it is possible to replace "Your score is 9 (out of 10)" with "Be sure to get your certificate". Or change "Congratulations - end of lesson reached" to "We hoped this lesson helped you". See how to change the end of lesson page display.
- You can have several different courses, each using a different (child) language pack and each one showing personalized language strings.
- See this forum post for detailed instructions on how to create your new child languages.
- The short answer is No.
- But there is a complicated way to achieve this :(
- You can use the Language customization tool. If you do make your own translations, please consider contribuiting your translated strings to the language pack maintainers, so that your language pack can grow.
- See the Spanish language Moodle Documentation page at Suplementar todas las traducciones faltantes del Español internacional and https://docs.moodle.org/all/es/Personalización del idioma (transplantar archivos) about grafting files from one language into another.
Can I make a language pack for kids?
- Yes.
- The current (May 2023) existing language packs for kids are:
- de_kids (which requires de)
- el_kids (which requires el)
- en_kids (which requires the default en)
- es_mx_kids (which requires es_mx)
- he_kids (which requires he)
- hi_kids (which requires hi)
- ja_kids (which requires ja)
- If you want to make a language pack for kids in a language different from the ones listed above, use the following method:
- Install the (en_kids) English for kids language pack in your local Moodle server
- You will have to edit 10 files (which are stored in the moodledata/lang/en_kids folder).
- You can use Notepad++ or any other text editor, but avoid using MS Word or MS Notepad.
- Start with langconfig.php and choose your main language as the parentlanguage
- When you have finished translating all the strings, you can request a new language pack to the person administering all Moodle language packs.
- Upload into AMOS the 10 files in your moodledata/lang/en_kids folder
- Remember to keep updating and expanding your new language pack
Why do some languages have several different language packs available?
See the developer's documentation about this.
Why has my language pack suddenly forgotten some translations?
See the following image showing (Insignias) a properly translated Spanish language string (green rectangle) and an unstranslated English language string (red rectangle) for 'Badges' plus a mixture of translated and untranslated strings with a language pack that should have 100% of the core strings translated.
If you try to update your language packs you will get a message indicating 'Update of 'xxxx_old' language pack skipped.
Read the following section for the cause and the fix.
Why do I have a language pack named xx_old' that I never installed?
Sometimes you may find (see image below) that your server has, in addition to your usual language packs (e.g., en, es_mx), an odd-named language pack with an _old name ending (e.g., es_mx_old), that -obviously- can not be updated.
- This came from an incomplete automated language pack update because the lang pack update fails in the middle of the process.
- The update first renames the existing lang directory so that it has the _old suffix and then it tries to unzip the new one.
- If unzipping is successful, the old directory is removed.
- Check that the ZIP PHP extension is OK in the Environment.
- If your server has languages other than English, the language packs update process will need to download all the corresponding language packs, which will take some time. If you have a low speed internet provider, you could get a script timeout error. To prevent this, you will need to edit the server/php/php.ini file and change the line that has 'max_execution_time = 30' into 'max_execution_time = 600'.
- There may also be a language pack that has mixed languages, like 'English (es_mx)', that obviously can not be.
- The reason why the language menu shows it is because moodledata/lang/es_mx/ is incomplete and its langconfig.php is missing so the translation of the string "thislanguage" (name of it) falls back to the default English.
- You must uninstall all strange-looking language packs and re-install your usual language packs.
See also
- List of language codes on Wikipedia