Override phrases? (just in English to re-word things)
Permalink
Hi I want to change some text in a t() function which is part of core - tried using the translation system so I don't have to completely override those files & functions. e.g. concrete/authentication/concrete/email_validated.php has t('This email address has been validated! You may now access the features of this site.') and I want to re-phrase it.
I have set the misc option 'enable_translate_locale_base_locale' to true in concrete.php so that I can translate en_US to en_US?
Then I created a messages.mo file with just that translation in it from en_US to en_US, and put it in application/languages/en_US/LC_MESSAGES
(attached messages.po and messages.mo files to this)
However the text is still the same. I also added a /site/ folder to application/languages so that I could access /dashboard/system/multilingual/translate_interface however I don't know what it supposed to go in the site folder, and that dashboard page just says "You have not created any multilingual content sections yet."
I welcome any other suggestions how to change that wording/phrasing (and others) more easily!
Thank you.
This is on concrete5.7.
I have set the misc option 'enable_translate_locale_base_locale' to true in concrete.php so that I can translate en_US to en_US?
Then I created a messages.mo file with just that translation in it from en_US to en_US, and put it in application/languages/en_US/LC_MESSAGES
(attached messages.po and messages.mo files to this)
However the text is still the same. I also added a /site/ folder to application/languages so that I could access /dashboard/system/multilingual/translate_interface however I don't know what it supposed to go in the site folder, and that dashboard page just says "You have not created any multilingual content sections yet."
I welcome any other suggestions how to change that wording/phrasing (and others) more easily!
Thank you.
This is on concrete5.7.
You know that if all you want is to change that text you could also simply copy the file to application/authentication/concrete/email_validated.php and modify it directly there. Concrete5 will pick it up.
Thanks! I'm not sure if it does though with that one - I found another answer which said you have to override the authentication controller and point it to a renamed version (overriding $apiMethods, v() function and including a renamed email_validated function), so have done that now with a application/authentication/concrete/controller.php and set up email_validated_custom.php in same folder.
That worked fine - I expect it may come up again that we want to change other bits of language though so it would be nice to know how to do that without overriding too many whole template files and functions just to change a phrase here & there.
That worked fine - I expect it may come up again that we want to change other bits of language though so it would be nice to know how to do that without overriding too many whole template files and functions just to change a phrase here & there.
I went through c5's code and I'm 99% sure the element files would be picked up from the application\authentication\concrete folder without any controller override.
What's more, I have the only 2FA package in the marketplace and it uses exactly that type of override without any issue.
It's here if you're curious:https://www.concrete5.org/marketplace/addons/two-factor-login-securi...
What's more, I have the only 2FA package in the marketplace and it uses exactly that type of override without any issue.
It's here if you're curious:https://www.concrete5.org/marketplace/addons/two-factor-login-securi...
Did you ever figure out how to change bits of the text? We are dealing with the exact same requirement and it seems silly to need to override templates and core functions just to get a simple wording change.
After mnakalay's last reply I was going to try again to just add a application/authentication/concrete/email_validated.php file to double check if it would simply pick that up that template, however the override I described in my last comment was working fine so I never got round to it I just left it at that...
So, I still have these files:
application/authentication/concrete/controller.php
application/authentication/concrete/email_validated_custom.php
In the controller.php I copied the public = $apiMethods line and changed email_validated to email_validated_custom, copied the email_validated() method but renamed it to email_validated_custom, and copied the v() method, renaming email_validated to email_validated_custom on the redirect line.
It does seem a pain to have to completely override any file at all really just to adjust the wording. I would have thought that as the text I wanted to change was wrapped in a t() function that there would be some easy way to override it through the translations system but I couldn't find one.
So, I still have these files:
application/authentication/concrete/controller.php
application/authentication/concrete/email_validated_custom.php
In the controller.php I copied the public = $apiMethods line and changed email_validated to email_validated_custom, copied the email_validated() method but renamed it to email_validated_custom, and copied the v() method, renaming email_validated to email_validated_custom on the redirect line.
It does seem a pain to have to completely override any file at all really just to adjust the wording. I would have thought that as the text I wanted to change was wrapped in a t() function that there would be some easy way to override it through the translations system but I couldn't find one.