Skip to content

[5.x]: Decimal separator of Number in Table field doesnt get localized in Twig if you use decimal comma #18823

@foxtrotcz

Description

@foxtrotcz

What happened?

Description

If you create Table with Number column, then the Numbers decimal separator doesnt get localized if you used decimal comma.

Steps to reproduce

  1. Have two sites. Primary site in non-English language that uses decimal comma in numbers. Secondary site in English.
  2. Create Table field with Number column. This Table field should be Not Translatable.
  3. Add this Table to some Entry.
  4. In Entry write in some number with decimal comma. For example 500,6
  5. Print the number in Twig with number filter, like row.value|number
  6. Check both English and non-English site output.

Expected behavior

500,6 for non-English (comma)
500.6 for English (point)

Actual behavior

Both show 500,6 (comma)

Additional info

If you use decimal point in the Table, then the formatting works and output of row.value|number will be correct according to site locale.

So for now I will just write all my Table Numbers with decimal point. But this could be improved in future.

Craft CMS version

5.9.22

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions