2014-01-07 30 views
0

我需要使用JText,這樣我才能將其轉換爲我想要翻譯的語言。已經嘗試在調用JText函數之前設置/加載該語言,但儘管語言加載的結果是成功的,但它始終會返回默認語言的關鍵字。該網站默認爲西班牙語,但有一個組件需要強行爲其獲取英文關鍵字。這就是我試圖做的:joomla - 強制從特定語言獲取關鍵字

JText::_("HELLO"); // This returns the Spanish word 
JFactory::getLanguage()->load('joomla', JPATH_BASE, 'en-GB, true); // Loading English language 
echo JFactory::getLanguage()->getTag(); // This returns en-GB tag! 
JText::_("HELLO"); // This returns the Spanish word, too!!! 

我希望JText類有這樣的事情:

JText::_("HELLO", 'en-GB'); // Return English keyword of the specified key 

回答

0

沒關係,我已經成功通過給「語言」參數來加載英語網址:

http://example.com/index.php?option=com_test&view=test&language=en-GB