? PR-4.4-dev Pending

User tests: Successful: Unsuccessful:

avatar laoneo
laoneo
28 Jun 2023

Summary of Changes

According to the discussion in #41063 the _ function in the view class should be renamed to text to be more meaningful.

avatar joomla-cms-bot joomla-cms-bot - change - 28 Jun 2023
Category Administration com_content Libraries Unit Tests
avatar laoneo laoneo - open - 28 Jun 2023
avatar laoneo laoneo - change - 28 Jun 2023
Status New Pending
avatar wilsonge
wilsonge - comment - 28 Jun 2023

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 for gettext 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)

avatar HLeithner
HLeithner - comment - 28 Jun 2023

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().

avatar laoneo
laoneo - comment - 28 Jun 2023

Thanks @wilsonge for the comparison. I would also stay on text as it is more meaningful.

avatar HLeithner HLeithner - change - 28 Jun 2023
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
avatar HLeithner HLeithner - close - 28 Jun 2023
avatar HLeithner HLeithner - merge - 28 Jun 2023

Add a Comment

Login with GitHub to post a comment