最模板 - 外贸网站建设,外贸网站模板

最模板

当前位置: 首页 > Magento > Magento教程 >

如何调试中 Magento 的翻译

时间:2014-05-28 22:40来源:未知 作者:最模板zuimoban 点击:
如何调试在 Magento 的多种翻译? 当您的存储区处理多个翻译时,有时只是想看看其中的翻译来自哪些模块列表。Magento 不能提供的方式来获取此信息,而无需编辑核心,所以我要做的事才应调

如何调试在 Magento 的多种翻译?

当您的存储区处理多个翻译时,有时只是想看看其中的翻译来自哪些模块列表。Magento 不能提供的方式来获取此信息,而无需编辑核心,所以我要做的事才应调试,然后删除。

第一,位于:

  • 文件: app/code/core/Mage/Core/Model/Translate.php
  • 类: Mage_Core_Model_Translate
  • 功能: translate()

然后,右前行"返回 $result ;",将以下代码段:

1
2
3
4
$logModule = str_pad($module, 25, "-", STR_PAD_RIGHT);
$logInString = str_pad($text, 150, "-", STR_PAD_RIGHT);
$logOutString = str_pad($result, 200, " ", STR_PAD_RIGHT);
Mage::log($logModule . '>' . $logInString . '>' . $logOutString, null, 'translate.log');

这将为每个请求,一群行向文件中写入 translate.log /var/log 下。

该文件类似于:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
2011-03-14T18:55:25+00:00 DEBUG (7): Mage_Catalog------------->Qty--------------------------------------------------------------------------------------------------------------------------------------------------->Qty
2011-03-14T18:55:25+00:00 DEBUG (7): Mage_Catalog------------->OR---------------------------------------------------------------------------------------------------------------------------------------------------->OR
2011-03-14T18:55:25+00:00 DEBUG (7): Mage_Catalog------------->Add to Wishlist--------------------------------------------------------------------------------------------------------------------------------------->Add to Wishlist
2011-03-14T18:55:25+00:00 DEBUG (7): Mage_Catalog------------->Add to Compare---------------------------------------------------------------------------------------------------------------------------------------->Add to Compare
2011-03-14T18:55:25+00:00 DEBUG (7): Mage_Catalog------------->Quick Overview---------------------------------------------------------------------------------------------------------------------------------------->Quick Overview
2011-03-14T18:55:25+00:00 DEBUG (7): Mage_Catalog------------->Details----------------------------------------------------------------------------------------------------------------------------------------------->Details
2011-03-14T18:55:25+00:00 DEBUG (7): Mage_Tag----------------->Product Tags------------------------------------------------------------------------------------------------------------------------------------------>Product Tags
2011-03-14T18:55:25+00:00 DEBUG (7): Mage_Tag----------------->Add Your Tags:---------------------------------------------------------------------------------------------------------------------------------------->Add Your Tags:
2011-03-14T18:55:25+00:00 DEBUG (7): Mage_Tag----------------->Add Tags---------------------------------------------------------------------------------------------------------------------------------------------->Add Tags
2011-03-14T18:55:25+00:00 DEBUG (7): Mage_Tag----------------->Add Tags---------------------------------------------------------------------------------------------------------------------------------------------->Add Tags
2011-03-14T18:55:25+00:00 DEBUG (7): Mage_Tag----------------->Use spaces to separate tags. Use single quotes (') for phrases.--------------------------------------------------------------------------------------->Use spaces to separate tags. Use single quotes (') for phrases.
2011-03-14T18:55:25+00:00 DEBUG (7): Mage_Checkout------------>My Cart----------------------------------------------------------------------------------------------------------------------------------------------->My Cart
2011-03-14T18:55:25+00:00 DEBUG (7): Mage_Checkout------------>You have no items in your shopping cart.-------------------------------------------------------------------------------------------------------------->You have no items in your shopping cart.
2011-03-14T18:55:25+00:00 DEBUG (7): Mage_Catalog------------->Compare Products-------------------------------------------------------------------------------------------------------------------------------------->Compare Products

你弄清楚哪些模块显示翻译后,从 Mage_Core_Model_Translate 中删除的代码行,可以快乐上路 !

(责任编辑:最模板)
------分隔线----------------------------
栏目列表
推荐内容