This code works based on the language you set in Settings > General > Site Language.
The language you set will output in the HTML source code which you can view in Chrome by right clicking > View Page Source which generates a HTML document like this:
Note: The code changes the title on the front end but not in the HTML of the page source.
In this example, it displays a different title when the site language setting is set to French like this:
It replaces the title set in Settings > General > Site Title:
Here’s the code for logged in members: