简体   繁体   English

Joomla JText :: _(“”)

[英]Joomla JText::_(“”)

Im trying to change the language of a Joomla! 我正在尝试更改Joomla的语言! component called DigiCom. 称为DigiCom的组件。 Actually I don't understand this line here: 其实我在这里不明白这一行:

<th class="text-center"><?php echo JText::_("COM_DIGICOM_PRICE_PLAN");?></th>

I guess this might be a reference, as the text displayed is not COM_DIGICOM_PRICE_PLAN. 我想这可能是参考,因为显示的文本不是COM_DIGICOM_PRICE_PLAN。 If I am right, do you know where can I change it? 如果我是对的,您知道我可以在哪里更改?

Here is part of the code: 这是代码的一部分:

<?php
/**
 * @package     DigiCom
 * @author      ThemeXpert http://www.themexpert.com
 * @copyright   Copyright (c) 2010-2015 ThemeXpert. All rights reserved.
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @since       1.0.0
 */

defined('_JEXEC') or die;


JHTML::_('behavior.formvalidation');

$pg_plugin = $this->pg_plugin;
$configs = $this->configs;
$data = $this->data;
?>
<div id="digicom" class="dc dc-checkout">

    <?php
    $this->setLayout('cart');
    echo $this->loadTemplate('steps');
    ?>

    <h1 class="page-title"><?php echo JText::sprintf("COM_DIGICOM_CHECKOUT_PAYMENT_DETAILS_PAGE_TITLE", $pg_plugin); ?></h1>

    <div class="dc-checkout-items">

        <h4 class="align-center"><?php echo JText::_("COM_DIGICOM_SUMMARY_YOUR_ORDER");?></h4>

JText::_() is a helper function to help with localization. JText::_()是一个帮助函数,以帮助进行本地化。 It will take a symbol like COM_DIGICOM_PRICE_PLAN and lookup the users currently set language and pull the related string from the associated language file. 它将使用类似COM_DIGICOM_PRICE_PLAN的符号,并查找当前设置语言的用户,并从关联的语言文件中提取相关的字符串。 These language files are located under the /language and /administrator/language folders. 这些语言文件位于/language/administrator/language文件夹下。

If there is no matching symbol the function will simply return the passed symbol. 如果没有匹配的符号,该函数将简单地返回传递的符号。 So, if COM_DIGICOM_PRICE_PLAN was not found in the component's language files, it would just give back COM_DIGICOM_PRICE_PLAN . 因此,如果在组件的语言文件中未找到COM_DIGICOM_PRICE_PLAN ,它将仅返回COM_DIGICOM_PRICE_PLAN Otherwise, it will give back the associated string. 否则,它将返回关联的字符串。

So, if you are wanting to change a component's localization strings you need to do one of two things. 因此,如果要更改组件的本地化字符串,则需要执行以下两项操作之一。 1) edit the language file, or 2) add an override. 1)编辑语言文件,或2)添加替代。

To edit the language file: 要编辑语言文件:

Find the component/module/plugin's language file. 查找组件/模块/插件的语言文件。 Find the associated symbol and change the string. 找到相关的符号并更改字符串。

That particular component's language filename/path would be something like 该特定组件的语言filename/path类似于

/language/en-GB/en-GB.com_digicom.ini
/administrator/language/en-GB/en-GB.com_digicom.ini
/administrator/language/en-GB/en-GB.com_digicom.sys.ini

Where en-GB is the particular language you want to change (or go through all of them, if you want to change the string for all languages). en-GB是您要更改的特定语言(如果要更改所有语言的字符串,请遍历所有语言)。

Then, look for a line like 然后,寻找一条像

COM_DIGICOM_PRICE_PLAN="Some text"

After that, just change Some Text to whatever you would like it changed to. 之后,只需将Some Text更改为您想要更改的名称即可。

Read the Joomla component tutorial about adding language management to learn more 阅读有关添加语言管理的Joomla组件教程以了解更多信息

Note though these files may be overwritten when updating the component, so you may have to re-edit those if it does ever update. 请注意,尽管在更新组件时这些文件可能会被覆盖,所以如果确实要更新,则可能必须重新编辑它们。

Add an override 添加替代

This is a better option as you do not need to edit/re-edit any files after an update. 这是一个更好的选择,因为更新后无需编辑/重新编辑任何文件。

Go to the Languages: Overrides page and add an override for the language constant. 转到“ 语言:替代”页面,并为语言常量添加替代。 You can get there by accessing menu in the backend and going to Extensions -> Languages -> Overrides 您可以通过访问后端的菜单并转到Extensions -> Languages -> Overrides来到达那里

There just put in the constant you want to override: COM_DIGICOM_PRICE_PLAN and then the text you want to appear. 只需输入要覆盖的常量: COM_DIGICOM_PRICE_PLAN ,然后输入要显示的文本。 Then save. 然后保存。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM