Skip to content

Typography: Casting float value to string makes it comma separated in some locales (PHP version < 8) #57607

@g12i

Description

@g12i

Description

In Typography fluid fonts generator float values are directly casted to string when generating CSS variables. This respects server locale and in some languages (e.g. Polish) it will cause floating point numbers to be comma separated (see picture).

https://github.com/WordPress/gutenberg/blob/08dc545f281489c584c5f78e26b31a97e4f46952/lib/block-supports/typography.php#L412C17-L412C38

Ref: https://stackoverflow.com/questions/17587581/php-locale-dependent-float-to-string-cast

Step-by-step reproduction instructions

  1. Set PHP locale to Polish

Screenshots, screen recording, code snippet

image

image

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

Labels

Backwards CompatibilityIssues or PRs that impact backwards compatabilityInternationalization (i18n)Issues or PRs related to internationalization efforts[Feature] TypographyFont and typography-related issues and PRs[Priority] LowUsed to indicate that the issue at hand isn't a top priority to address and can be handled later[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions