Replies: 3 comments 9 replies
-
An alternative and potentially better option would be to have an app wide configuration option that tells {{ }} to automatically translate everything that it outputs. That way a multilingual app could set the configuration option and forget about it. |
Beta Was this translation helpful? Give feedback.
-
Hi, I was looking for quite similar "issue". I do use blade translations a lot, basically anything thats visible as text, and my feel is that there should be shorter syntax for translations. My thinking was to go with something that is less cumbersome to type, is minimal and uses one of the bracket types so text editors intuitevely put a pair of them and cursor in the middle. I.e. With named parameters: And passing locale: When compared to current method Underneath it would pass the parameters to There is a way how to register tags for some custom components, but not exactly to extend template syntax. Did some more source code reading, I see the way how to build it, but would need some time to come up with proper PR. P.S, I'm still in some doubts about whether pair of curly + curved brackets is the right choice - they do look quite similar and could be missed at a glance and cause bugs. Could use curly + square brackets, but then nested replacement parameter array looks not the best. I.e. So, some compromise must be chosen, if at all and live with existing, which functions, yet there is that inner wish for it be a touch more elegant. |
Beta Was this translation helpful? Give feedback.
-
Short, ugly, but easy to implement |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Curious what everyone’s thoughts are on blade tags that automatically pass the output through the translation functions?
Currently:
{{ __(“foo”) }}
Future possibility:
{__ “foo” __}
Somewhat minor change but it would cleanup apps that are multi-lingual and have to translate all output everywhere. It also would clean up code when it’s not just a straight string
{{ __(Auth::user()->location->name) }}
{__ Auth::user()->location->name __}
Beta Was this translation helpful? Give feedback.
All reactions