Jump to content

How to work out which string is incorporated with %s?


Meddysong

Recommended Posts

Posted

I've just received an email notification:

Untitled-1.jpg.0e86df442a56deddae63a5db57cdea08.jpg

In my language, that button reads 'Go to this Report'. Except it doesn't. That word in the end is a verb (an infinitive) but needs to be a noun. English happens to use the same word for both forms. So I need to do some troubleshooting.

I can see that the language string is go_to_this_x, to which will be added another language string to create go_to_this_x %s. What I don't know is what that second language string is. Here's the relevant content from the email template:

{$email->language->addToStack("go_to_this_x", FALSE, array( 'sprintf' => array( mb_strtolower( $email->language->addToStack( $report::$title, FALSE ) ) ) ) )}

How in that would I identify the language string which provides the %s? I presume it's the part array( mb_strtolower( $email->language->addToStack( $report::$title, FALSE ) ) ) but I'm not even sure about that because it looks as though the output is supposed to be converted to lowercase. You can see in my screenshot that the word is parsed Raporti rather than raporti.

Where in this sequence is the name of the language string which I need to edit?

Posted
$email->language->addToStack( $report::$title, FALSE )

return a hash

So

mb_strtolower( $email->language->addToStack( $report::$title, FALSE ) )

doesn't make sense

31 minutes ago, Meddysong said:

Where in this sequence is the name of the language string which I need to edit?

Lang string with key report

You can also change above code

{$email->language->addToStack("go_to_this_x", FALSE, array( 'sprintf' => array( mb_strtolower( $email->language->addToStack( $report::$title, FALSE ) ) ) ) )}

to

{$email->language->addToStack("go_to_this_x", FALSE, array( 'sprintf' => array( $email->language->addToStack( $report::$title, FALSE, array( 'strtolower' => TRUE ) ) ) ) )}

Before

Go to this Report

After

Go to this report

 

Posted

Here's a similar problem. I need to find where a language string is used. It's notification__new_react, which is {!#[?:%s reacted to]} %s in English.

If I go to templates and search within the templates for notification__new_react, nothing shows. Other strings do. So if a string isn't used in a template, how do I find it?

(Here's my user case. I need to locate this string and examine it because it's producing grammatically incorrect results. When I get something like "Tim reacted to a post", the result in my language needs to use the nominative case. However, the string being used is in the accusative because whatever language string is being used must have been written this way, probably because it needed to be used in a string such as "Tim added a new X", which requires the accusative for me. So I need to track these examples down and create my own strings to replace the incorrect ones.) 

Posted

Strings could also be used in php files or emails.

In your case, notification_xxxxxxx is always used inside a notification or notification email which are build dynamic inside the php files.

Posted

Cheers, @Daniel F. Whilst I've got you ... you're a German speaker. And you're translating into Croatian too. Aren't you noticing places where the approach of "here's a string" + "a word" is causing problems with grammatical case? "X added Y" and "X replied to Y" can't use the same word ("topic, entry, file etc") for Y, right?

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...