- Issue created by @arti_parmar
- Issue was unassigned.
- Status changed to Needs review
over 1 year ago 10:20am 22 June 2023 - Open on Drupal.org →Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Waiting for branch to pass - Status changed to RTBC
over 1 year ago 11:49am 22 June 2023 - 🇵🇭Philippines clarkssquared
Hi arti_parmar
I applied your patch #2 to the VIews Conditional Module v8.x-1.x-dev and I confirmed that your patch fixed all the PHPCS issues.
Please look at the screenshot attached for your reference
Thank you
- Status changed to Needs work
over 1 year ago 12:01pm 22 June 2023 - 🇺🇸United States shelane
Removing translation from an if statement specifically intended on providing translation is not how to fix the t usage issue.
- Status changed to Fixed
about 1 year ago 4:12pm 7 November 2023 - 🇺🇸United States shelane
I have verified the current use case of t() with the variables:
Your code checks the 'then_translate' and 'or_translate' options before applying translation. This approach ensures that the t() function is only used when necessary and adheres to good coding practices. The use of variables for translation strings in conditional scenarios, like yours, is a valid and practical use case.
Given the constraints of your code and the requirement to translate conditionally based on user settings, you've handled the situation correctly. It's important to balance best practices with the practicality of your specific use case, and your implementation seems appropriate given the context.
I've applied these fixes and more that come up with I check for strict rules.
Automatically closed - issue fixed for 2 weeks with no activity.