Clarification for "Overriding core and package translations"

Permalink
Hi,

SHORT VERSION: I want to change some of the English texts in a package. I don't understand the "Overriding core and package translations" example in the Translation Files documentation - can someone post a working override file?

LONG VERSION:
I have a package that already has multiple language translations.

I am just using standard (English).

There are several strings I want to override, but in the same language.

Ex. t("some text") I want to show as "some other text".

I don't want to change the string within t("some text") in the php files themselves, as it will break the translations.

In the documentation for Translation Files here
https://documentation.concrete5.org/developers/interface-customizati...

it looks like there is a way to override specific strings, which is just waht I want. However I thing the information is either incorrect or I don;t understand due to lack of detail. Would be grateful for these items clarified (documentation text follows, my specific questions IN BOLD):


"In order to override a string used by the concrete5 core of by a package, you simply have to create a php file under the /application/src directory."

WHAT DOES THIS PHP FILE NEED TO BE NAMED? DOES IT SIT IN /application/src OR DOES IT NEED TO BE NESTED UNDER A FOLDER NAMED AS THE PACKAGE?

"For instance, you may want its contents to be
<?php
defined('C5_EXECUTE') or die('Access Denied.');
return;
t('String');

so that you can override the translation of the String string."

SO MANY QUESTIONS. THIS EXAMPLE LOOKS LIKE IT WOULD JUST RETURN NOTHING, AND THERE DOESN'T SEEM TO BE A CHANGED TRANSLATION? CAN SOMEONE POST A FILE THAT IS ALREADY WORKING?

Thanks in advance for any assistance. I will be happy to log in and update the documentation once this is clarified.

 
mlocati replied on at Permalink Reply
mlocati
> WHAT DOES THIS PHP FILE NEED TO BE NAMED? DOES IT SIT IN /application/src OR DOES IT NEED TO BE NESTED UNDER A FOLDER NAMED AS THE PACKAGE?

It can have any name and in can be placed anywhere under the application/src directory (yep, even in a sub folder, or sub sub sub sub folder). It only needs to have the .php extension).

> THIS EXAMPLE LOOKS LIKE IT WOULD JUST RETURN NOTHING, AND THERE DOESN'T SEEM TO BE A CHANGED TRANSLATION? CAN SOMEONE POST A FILE THAT IS ALREADY WORKING?

That file isn't meant to be executed: concrete5 reads its content without actually executing it. That file is already a working example.
dmeller replied on at Permalink Reply
Hi, Thank you so much for your reply. That is very helpful. That leads to a couple more questions. Sorry I was YELLING before ;)

Can multiple overrieds be in one file, or does each file need to be only one?

I'm still not sure I'm understanding the syntax of the content of the file -- In the working example, what is the string being translated TO?

I was expecting it to be something like

t('String') = 'New String';
//or
t('String','Replaced String');

Is this right?

As a side note, is there a reason this isnt setup more like the the normal configs, in a nested array? ex:

'language' => [
     'en' => [
           'String' => 'New String']
      ]
]


Thanks!!
dmeller replied on at Permalink Reply
This actually seems to be what I'm looking for, how to enable en_US as a translatable option

https://www.concrete5.org/community/forums/internationalization/prov...