User tests: Successful: Unsuccessful:
According to the discussion in #41063 the _
function in the view class should be renamed to text
to be more meaningful.
Category | ⇒ | Administration com_content Libraries Unit Tests |
Status | New | ⇒ | Pending |
I also thought about t()
but it also doesn't say anything what it is doing on, trans
is longer and then text
and is not a complete word ;-) beside that, as brain mentioned and I also mentioned internally could look like "more work the developer that doesn't like to translate text" (just an opinion).
__
is only 2 characters shorter then text
and actually has no meaning, especially for people which are not developer and only want to modify a template override.
So I'm in favor for text()
.
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-06-28 12:21:27 |
Closed_By | ⇒ | HLeithner | |
Labels |
Added:
?
PR-4.4-dev
|
So it's worth noting that
_
is a native PHP Function - which I assume is why it was picked in the first place which is an alias forgettext
https://www.php.net/gettext (not that we're using this but I assume that people were assumed to be familiar with it)So did some digging around just to compare what people do. Several bigger projects effectively build their own global function which is designed to mimic the PHP API:
Laravel (
__
https://laravel.com/docs/10.x/localization)Wordpress (
__
https://developer.wordpress.org/apis/internationalization/internationalization-functions/)Things that are more like this proposal:
Drupal https://www.drupal.org/docs/7/api/localization-api/localization-api-overview (a
t
function)Symfony https://symfony.com/doc/6.2/the-fast-track/en/28-intl.html (via twig has a
trans
function)