-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.2] Issue #11285 - Ability to capitalize translation placeholders #11337
Conversation
c73d181
to
31b9d09
Compare
} elseif (strpos($line, ':'.ucfirst($key)) !== false) { | ||
$line = str_replace(':'.ucfirst($key), ucfirst($value), $line); | ||
} | ||
|
||
$line = str_replace(':'.$key, $value, $line); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not possible to do following?
$search = [':'.strtoupper($key), ':'.ucfirst($key), ':'.$key];
$replace = [strtoupper($value), ucfirst($value), $value];
$line = str_replace($search, $replace, $line);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had realized the strpos() conditionals are pointless overhead (too much Whisky this evening perhaps!) when I saw your comment. That's a much better improvement!
31b9d09
to
2a7bda1
Compare
…translation placeholders for both Validation Rules and Strings
@AdenFraser , I suggest add tests for this change. |
Probably a wise suggestion actually, will do! |
Feel free. |
Nice! I do like what this adds, albeit small, its handy. |
Great that my proposal made it into core. Could this be backported to a 5.1 maintenance release please? |
No, because it's breaking. |
Ability to capitalize translation placeholders for both Validation Rules and Strings.
As suggested in Issue #11285.
The makeReplacements method (on the Translator) and the doReplacements() method (on the Validator) now first check and string replace all capital attributes/placeholders with the same case (all capital) replacement, followed by uppercased attributes/placeholders and finally replacing the lowercase attributes/placeholders as before.