Decimal separator: Difference between revisions

From MoodleDocs
m (Added link to spanish translation of page)
(Decimal separator)
Tag: Removed redirect
Line 1: Line 1:
#REDIRECT [[dev:Decimal separator]]
The langconfig file is an important file in a language pack, dealing with all the configuration parameters of that language, including the decimal separator.
 
The original Moodle code in English uses a [https://en.wikipedia.org/wiki/Decimal_mark decimal point as a separator], but some countries (and their language packs) might use a decimal comma.
 
==Countries where a dot "." is used as decimal mark:==
* Australia
* Bangladesh
* Botswana
* British West Indies
* Brunei
* Canada (when using English)
* China, People's Republic of
* Dominican Republic
* Egypt
* Ghana
* Guatemala
* Honduras
* Hong Kong
* India
* Ireland
* Israel
* Japan
* Jordan
* Kenya
* Korea (both North and South)
* Lebanon
* Luxembourg (uses both marks officially)
* Macau (in Chinese and English text)
* Malaysia
* Malta
* Mexico
* Mongolia
* Nepal
* New Zealand
* Nicaragua
* Nigeria
* Pakistan
* Palestine
* Panama
* Philippines
* Singapore
* Sri Lanka
* Switzerland
* Taiwan
* Tanzania
* Thailand
* Uganda
* United Kingdom
* United States (including insular areas)
* Zimbabwe
 
==Countries where a comma "," is used as decimal mark:==
* Albania
* Algeria
* Andorra
* Angola
* Argentina
* Armenia
* Austria
* Azerbaijan
* Belarus
* Belgium
* Bolivia
* Bosnia and Herzegovina
* Brazil
* Bulgaria
* Cameroon
* Canada (when using French)
* Chile
* Colombia
* Costa Rica
* Croatia (comma used officially, but both forms are in use)
* Cuba
* Cyprus
* Czech Republic
* Denmark
* East Timor
* Ecuador
* Estonia
* Faroes
* Finland
* France
* Germany
* Georgia
* Greece
* Greenland
* Hungary
* Iceland
* Indonesia
* Italy
* Kazakhstan
* Kosovo
* Kyrgyzstan
* Latvia
* Lebanon
* Lithuania
* Luxembourg (uses both marks officially)
* Macau (in Portuguese text)
* Macedonia
* Moldova
* Mongolia
* Morocco
* Mozambique
* Namibia
* The Netherlands
* Norway
* Paraguay
* Peru
* Poland
* Portugal
* Romania
* Russia
* Serbia
* Slovakia
* Slovenia
* South Africa
* Spain
* Switzerland
* Sweden
* Tunisia
* Turkey
* Ukraine
* Uruguay
* Uzbekistan
* Venezuela
* Vietnam
 
===Problems with language packs using a decimal comma===
If a language pack uses a comma (,) as a decimal separator, it '''must''' use a semicolon (;) as a [https://docs.moodle.org/dev/Translation_langconfig#listsep.2Ccore_langconfig list separator], or serious errors might happen.
 
* See all the reported issues (fixed and not-fixed) at [https://tracker.moodle.org/browse/MDL-28238?jql=text%20~%20%22decimal%20comma%22 the Moodle Tracker]
 
* It is not uncommon for Moodle users with a language pack that has a comma used as a decimal separator to experience problems when using formulas copied from the Moodle English online and built-in documentation.
 
====Gradebook problems====
The [https://docs.moodle.org/en/Grader_report Gradebook] calculations might use "=average(item1, item2, item3, item4, item5, item6)" which is easy to understand and use in English, but a teacher with (for example) the international spanish (es) language pack will strugle until he/she realizes that this formula should be changed to "=average(item1; item2; item3; item4; item5; item6)"
 
====Cloze questions problems====
Cloze marks a correct numeric answer as a wrong one while using a comma as a decimal separator. See MDL-33744
 
====Pmatch and other Open University question types problems=====
[https://docs.moodle.org/31/en/Pattern-match_question_type Pmatch] (and other question types made by the Open University) was created for use in an English university. Therefore, all the special code for handing numbers just assumes the decimal separator is a full stop. See [https://moodle.org/mod/forum/discuss.php?d=340313 this forum thread]. The suggested fix is to only use a full stop as a decimal separator.
 
====Quiz problems====
As reported in [https://moodle.org/mod/forum/discuss.php?d=312003 this forum thread], there are no hints on interactive with multiple tries quiz when using comma on some languages that use a comma as decimal marker in the answer (as opposed to a full stop). The quiz does not show hints (using interactive with multiple attempts). The quiz instead regards the use of the comma as "incomplete" even though it will mark this answer as correct or incorrect on deferred feedback. The suggested fix is to never use a decimal comma as a thousand separator.
 
==Problem fixing==
A Moodle adminer who uses a language pack with a decimal comma must check the [https://docs.moodle.org/dev/Translation_langconfig langconfig file] and make sure that the decsep, listsep and thousandssep characters are properly set for the language or use the  [https://docs.moodle.org/en/Language_customisationLanguage customization] to fix his/her server.
 
==Using English language pack with a decimal comma==
* If you want English text, but with non-english decimal separator, the way to achieve this is to make a new language pack en_commadecimal, or something like that.
* You should only need to create the langconfig.php part of the language pack, to say that the parent language is English, and what the decimal and thousands separators are.
* See https://docs.moodle.org/dev/Starting_a_new_language_pack and https://docs.moodle.org/31/en/Language_packs
* See [https://moodle.org/mod/forum/discuss.php?d=342323 this forum thread]
 
 


[[es:Separador decimal]]
[[es:Separador decimal]]

Revision as of 12:46, 2 August 2022

The langconfig file is an important file in a language pack, dealing with all the configuration parameters of that language, including the decimal separator.

The original Moodle code in English uses a decimal point as a separator, but some countries (and their language packs) might use a decimal comma.

Countries where a dot "." is used as decimal mark:

  • Australia
  • Bangladesh
  • Botswana
  • British West Indies
  • Brunei
  • Canada (when using English)
  • China, People's Republic of
  • Dominican Republic
  • Egypt
  • Ghana
  • Guatemala
  • Honduras
  • Hong Kong
  • India
  • Ireland
  • Israel
  • Japan
  • Jordan
  • Kenya
  • Korea (both North and South)
  • Lebanon
  • Luxembourg (uses both marks officially)
  • Macau (in Chinese and English text)
  • Malaysia
  • Malta
  • Mexico
  • Mongolia
  • Nepal
  • New Zealand
  • Nicaragua
  • Nigeria
  • Pakistan
  • Palestine
  • Panama
  • Philippines
  • Singapore
  • Sri Lanka
  • Switzerland
  • Taiwan
  • Tanzania
  • Thailand
  • Uganda
  • United Kingdom
  • United States (including insular areas)
  • Zimbabwe

Countries where a comma "," is used as decimal mark:

  • Albania
  • Algeria
  • Andorra
  • Angola
  • Argentina
  • Armenia
  • Austria
  • Azerbaijan
  • Belarus
  • Belgium
  • Bolivia
  • Bosnia and Herzegovina
  • Brazil
  • Bulgaria
  • Cameroon
  • Canada (when using French)
  • Chile
  • Colombia
  • Costa Rica
  • Croatia (comma used officially, but both forms are in use)
  • Cuba
  • Cyprus
  • Czech Republic
  • Denmark
  • East Timor
  • Ecuador
  • Estonia
  • Faroes
  • Finland
  • France
  • Germany
  • Georgia
  • Greece
  • Greenland
  • Hungary
  • Iceland
  • Indonesia
  • Italy
  • Kazakhstan
  • Kosovo
  • Kyrgyzstan
  • Latvia
  • Lebanon
  • Lithuania
  • Luxembourg (uses both marks officially)
  • Macau (in Portuguese text)
  • Macedonia
  • Moldova
  • Mongolia
  • Morocco
  • Mozambique
  • Namibia
  • The Netherlands
  • Norway
  • Paraguay
  • Peru
  • Poland
  • Portugal
  • Romania
  • Russia
  • Serbia
  • Slovakia
  • Slovenia
  • South Africa
  • Spain
  • Switzerland
  • Sweden
  • Tunisia
  • Turkey
  • Ukraine
  • Uruguay
  • Uzbekistan
  • Venezuela
  • Vietnam

Problems with language packs using a decimal comma

If a language pack uses a comma (,) as a decimal separator, it must use a semicolon (;) as a list separator, or serious errors might happen.

  • It is not uncommon for Moodle users with a language pack that has a comma used as a decimal separator to experience problems when using formulas copied from the Moodle English online and built-in documentation.

Gradebook problems

The Gradebook calculations might use "=average(item1, item2, item3, item4, item5, item6)" which is easy to understand and use in English, but a teacher with (for example) the international spanish (es) language pack will strugle until he/she realizes that this formula should be changed to "=average(item1; item2; item3; item4; item5; item6)"

Cloze questions problems

Cloze marks a correct numeric answer as a wrong one while using a comma as a decimal separator. See MDL-33744

Pmatch and other Open University question types problems=

Pmatch (and other question types made by the Open University) was created for use in an English university. Therefore, all the special code for handing numbers just assumes the decimal separator is a full stop. See this forum thread. The suggested fix is to only use a full stop as a decimal separator.

Quiz problems

As reported in this forum thread, there are no hints on interactive with multiple tries quiz when using comma on some languages that use a comma as decimal marker in the answer (as opposed to a full stop). The quiz does not show hints (using interactive with multiple attempts). The quiz instead regards the use of the comma as "incomplete" even though it will mark this answer as correct or incorrect on deferred feedback. The suggested fix is to never use a decimal comma as a thousand separator.

Problem fixing

A Moodle adminer who uses a language pack with a decimal comma must check the langconfig file and make sure that the decsep, listsep and thousandssep characters are properly set for the language or use the customization to fix his/her server.

Using English language pack with a decimal comma