服务报价 | 域名主机 | 网络营销 | 软件工具| [加入收藏]
 热线电话: #
当前位置: 主页 > php教程 > magento教程 >

如何调试中 Magento 的翻译

时间:2016-05-17 09:16来源: 作者: 点击:
如何调试在 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 中删除的代码行,可以快乐上路 !

(责任编辑:最模板)
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
栏目列表
热点内容