A super easy PHP Framework for web development!
				https://github.com/exacti/phacil-framework
			
			
		
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					60 lines
				
				1.2 KiB
			
		
		
			
		
	
	
					60 lines
				
				1.2 KiB
			| 
								 
											2 years ago
										 
									 | 
							
								<?php
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * Copyright (c) 2024. ExacTI Technology Solutions
							 | 
						||
| 
								 | 
							
								 * GPLv3 General License.
							 | 
						||
| 
								 | 
							
								 * https://exacti.com.br
							 | 
						||
| 
								 | 
							
								 * Phacil PHP Framework - https://github.com/exacti/phacil-framework
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								namespace Phacil\Framework\templateEngines\Twig\Extension\Legacy;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								use Phacil\Framework\templateEngines\Twig\Api\Extension\TranslateInterface;
							 | 
						||
| 
								 | 
							
								use Phacil\Framework\templateEngines\Twig\Extension\Legacy\TokenParser;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								class Translate extends \Twig_Extension implements TranslateInterface
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									/**
							 | 
						||
| 
								 | 
							
									 * {@inheritdoc}
							 | 
						||
| 
								 | 
							
									 */
							 | 
						||
| 
								 | 
							
									public function getTokenParsers()
							 | 
						||
| 
								 | 
							
									{
							 | 
						||
| 
								 | 
							
										return array(
							 | 
						||
| 
								 | 
							
											new TokenParser(),
							 | 
						||
| 
								 | 
							
										);
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									/**
							 | 
						||
| 
								 | 
							
									 * {@inheritdoc}
							 | 
						||
| 
								 | 
							
									 */
							 | 
						||
| 
								 | 
							
									public function getName()
							 | 
						||
| 
								 | 
							
									{
							 | 
						||
| 
								 | 
							
										return self::TWIG_TAG_INI;
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									/**
							 | 
						||
| 
								 | 
							
									 * {@inheritdoc}
							 | 
						||
| 
								 | 
							
									 */
							 | 
						||
| 
								 | 
							
									public function traduzir()
							 | 
						||
| 
								 | 
							
									{
							 | 
						||
| 
								 | 
							
										$params = func_get_args();
							 | 
						||
| 
								 | 
							
										$body = array_shift($params);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
										/** @var \Phacil\Framework\Translate */
							 | 
						||
| 
								 | 
							
										$trans = \Phacil\Framework\Registry::getInstance("Phacil\Framework\Translate");
							 | 
						||
| 
								 | 
							
										echo ($trans->translation($body));
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									/**
							 | 
						||
| 
								 | 
							
									 * {@inheritdoc}
							 | 
						||
| 
								 | 
							
									 */
							 | 
						||
| 
								 | 
							
									static public function translate() {
							 | 
						||
| 
								 | 
							
										$params = func_get_args();
							 | 
						||
| 
								 | 
							
										$body = array_shift($params);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
										/** @var \Phacil\Framework\Translate */
							 | 
						||
| 
								 | 
							
										$trans = \Phacil\Framework\Registry::getInstance("Phacil\Framework\Translate");
							 | 
						||
| 
								 | 
							
										echo ($trans->translation($body));
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								}
							 |