xslt internationalization with php

DanielM

New Member
I use XSLT as template engine in my PHP framework. I set some text to Renderer script, which converts it to xml and pass to XSLTProcessor:\[code\]<?phpclass IndexController extends ActionAbstract { public function doAuth() { $this->_Renderer->some_text = 'Translatable text'; }}?>\[/code\]View looks something like this:\[code\]<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml"/> <xsl:template match="/"> <html> <head><title>Index.xsl</title></head> <body> Here is some text to be translated <br/> <xsl:value-of select="root/some_text"/> </body> </html> </xsl:template></xsl:stylesheet>\[/code\]So, I have 2 types of text in views:
  • Dynamic (setted from ActionController $this->_Renderer->some_text = 'Translatable text')
  • Hardcoded in view (Here is some text to be translated)
I can use xml dictionary to translate Harcoded texts in xslt (using \[code\]document()\[/code\] function), but how when translate texts setted from ActionController?What is the best way to translate texts in my views?UPDATE:Is it possible to print default value if no translate text was found?Thanks
 
Back
Top