Some translations don’t seem to work

Solved8.71K viewsCoretranslation
0

Hi Rahul,

I’ve noticed that some translations do not work. For example, using Loco Translate, I am changing string “Edited Answer” to “Edited Response”. Despite saving the string, this is not reflected in what is already posted. I expect that the values are being written to the database instead. Can you confirm ?

Thanks

Question is closed for new answers.
selected answer
0

SOLVED: Well – sort of.

I ended up installing the Code Snippets plugin, and adding this as a snippet, which works

function my_ap_activity_actions( $actions ) {
$actions[’new_a’][’verb’] = ‘Responded to discussion’;
$actions[’edit_a’][’verb’] = ‘Edited response’;
return $actions;
}
add_filter( ‘ap_activity_actions’, ‘my_ap_activity_actions’ );

My question here is why does this not work within the child theme functions.php file ? Or within the themes/anspress directory ?

commented on answer

May be you are adding codes in wrong place. You can ping me on slack with your code snippet.

0

Ok. This is still an issue. Changing class-activity-helper.php (see below) works

‘edit_a’ => array(
‘ref_type’ => ‘answer’,
‘verb’ => __( ‘Edited response‘, ‘anspress-question-answer’ ),
‘icon’ => ‘apicon-answer’,
),

But this function does not work at all

function my_ap_activity_actions( $actions ) {
$actions[’edit_a’][’verb’] = ‘Edited response‘;
return $actions;
}
add_filter( ‘ap_activity_actions’, ‘my_ap_activity_actions’ );

Any ideas please ?

edited answer
0

Here it is:

https://gist.github.com/rahularyan/376fb0f31adb81d783dfb82a9ce3829c

commented on answer

Tried your code – pretty much the same as mine, and doesn’t seem to work ?

I’m also assuming that this function should be placed into the child theme functions.php file ?

0

I’m missing something here. Even this doesn’t seem to work

add_filter( ‘ap_activity_actions’, ‘new_ap_activity_actions’);
function new_ap_activity_actions($args) {
$args[’new_q’][’ref_type’][’verb’] = “Testing”;
return $args;
}

0

@rahul – can you provide a sample please ?

Thanks

0

Thanks Rahul,

I want to avoid overriding core files, which is why I’m asking. Can you please provide an example of the hook ?

Regards

deleted comment
0

Hello,

Please avoid overriding core files. Instead use hooks for your needs. I think you are trying to modify activity verb then you can use filter

ap_activity_actions

0

Found what I want to override. Is there a way I can override one class ?

0

Found what I needed in class-activity-helper.php – is there a way I can override this so that my changes are not overwritten on each update ?