symfony / ux

Symfony UX initiative: a JavaScript ecosystem for Symfony
https://ux.symfony.com/
MIT License
784 stars 274 forks source link

[Translator] TranslationsDumper builds invalid constant names #1950

Open aleho opened 4 days ago

aleho commented 4 days ago

If the translation sources contain strings instead of identifiers the dumper builds invalid constant names.

"The passwords don't match.": "Die Passwörter stimmen nicht überein."
"Your password should be at least {{ limit }} characters.": "Ihr Passwort sollte mindestens {limit} Zeichen lang sein."

results in

export const THE_PASSWORDS_DON'T_MATCH. = {"id":"The passwords don't match.","translations":{"validators+intl-icu":{"en":"The passwords don't match.","de":"Die Passw\u00f6rter stimmen nicht \u00fcberein."}}};
export const YOUR_PASSWORD_SHOULD_BE_AT_LEAST_{{_LIMIT_}}_CHARACTERS. = {"id":"Your password should be at least {{ limit }} characters.","translations":{"validators+intl-icu":{"en":"Your password should be at least {limit} characters.","de":"Ihr Passwort sollte mindestens {limit} Zeichen lang sein."}}};

Are messages as IDs not supported or is this a bug? If bug, should the IDs be run through e.g. AsciiSlugger?

jmsche commented 4 days ago

See https://github.com/symfony/symfony/issues/57612

aleho commented 4 days ago

@jmsche Ah! Didn't consider there could have been a breaking change in the String component.

Kocal commented 10 hours ago

Note that it also broke the Translator demo on the Symfony UX website:

image image