How to Set Multi-Language Site Title?

I need to edit the tag, what is the global variable for MultiLang Site Title?

You may simply use Language_Load server event:$this->setProjectPhrase(“BodyTitle”, “Your New Title”);

$this->setProjectPhrase(“BodyTitle” “Your New Title”);it seems only for set-tingwhat if I want to do this:

$SiteTitle = $this->GETProjectPhrase("BodyTitle");
$SiteTitle = $SiteTitle . "123"
$this->setProjectPhrase("BodyTitle", $SiteTitle);

You may try:

$SiteTitle = "";
$SiteTitle = $this->projectPhrase("BodyTitle");
$SiteTitle = $SiteTitle . "123";
$this->setProjectPhrase("BodyTitle", $SiteTitle);

Error
Call to undefined method PHPMaker2023\project2\OrderDetailsList::projectPhrase()

// Page Data Rendered event
function Page_DataRendered(&$footer)
{
$footer .= '<script>
				loadjs.ready("head", function () {
					let original_title;
					original_title = "'. $this->projectPhrase("BodyTitle") .'";
					document.title = "123" + original_title;
					}
				});
			</script>';
}

mobhar wrote:

You may simply use > Language_Load > server event

Working, need to save to SESSION to access it.

Perhaps you might need this: How to Change Browser Title Dynamically (v2021) (it should work also for v2023).

  1. If you use Language_Load server event to the phrase, you should not need to use session because the server event is fired for all pages (in general).
  2. If v2023, you may also use CurrentPageTitle(), see Some Global Functions.
  3. Instead of using Language_Load server event, you may also use CurrentPageTitle() directly to set your page title according to CurrentLanguageID().

e.g.

$langId = CurrentLanguageID();
if ($langId == "foo") {
    $title = "xxx";
} elseif ($langId == "bar") {
    $title = "yyy";
} else {
    $title = CurrentPageTitle();	
}
CurrentPageTitle($title); // Set

I think the $title variable should be declared first before/outside the if conditional block.

That is not required because there is a “else” case.