adrianmak Posted January 19, 2015 Share Posted January 19, 2015 i want to translate a string with html tag like $error = __("<h2 class='error'>this is a string</h2>"); After translated, the echoed string is <h2 class='error'>a translated string</h2>. however, when the text show up on website, the html tag in the translated string won't work. Link to comment Share on other sites More sharing options...
adrianmak Posted January 19, 2015 Author Share Posted January 19, 2015 <?php //$template = $page->template; //echo "Your are in $template->name template"; if ($user->isLoggedin()) { $session->logout(); } else { $session->redirect("/pw1"); } $logoutText = __("<h1>You have logged out</h1><p>You will be redirect to homepage in 3 seconds</p>"); ?> <html> <head> <title>Logout</title> <meta http-equiv="refresh" content="3;url=/pw1"> </head> <body> <?php echo $logoutText; ?> </body> </html> Link to comment Share on other sites More sharing options...
LostKobrakai Posted January 19, 2015 Share Posted January 19, 2015 This is meant to work that way. The translation is entity encoded, that's why your html isn't parsed as you'd expect it. Have a look here about how to do this without including the markup: https://processwire.com/api/multi-language-support/code-i18n/ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now