为什么字符串没有出现在“字符串翻译"中?WPML? [英] Why strings don't appear in "String translation" of WPML?

查看:28
本文介绍了为什么字符串没有出现在“字符串翻译"中?WPML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 php 文件中有这样的字符串:

I have in my php files string like this:

<?php
__('My string A', 'a_theme');
_e('My string B', 'a_theme');
?>

并且没有出现在字符串翻译"中.

and there are not appearing in "String translation" .

我也购买并安装了这个主题:http:///preview.ait-themes.com/index.php?bartype=desktop&theme=touroperator 和来自该主题的字符串也没有出现在 WPML 的字符串翻译"中.

I have also bought and installed this theme: http://preview.ait-themes.com/index.php?bartype=desktop&theme=touroperator and strings from that theme aren't also appearing in "Strings translation" of WPML.

这是我安装时已经在主题中的字符串示例:

This is one example of string which was already in theme when I installed it:

<input type="text" id="dir-searchinput-location" class="dir-searchinput-select" placeholder="{__ 'Destination'}">

我需要做一些额外的配置还是其他什么?

Is there some extra configuration which I need to do or something else?

感谢帮助

推荐答案

要让字符串出现在字符串翻译中,首先需要进入主题和插件本地化.向下滚动到主题中的字符串部分,然后单击扫描主题中的字符串按钮.然后 WPML 将检测任何未注册或新添加的字符串,这些字符串的格式正确以进行本地化.

To get strings to appear in String Translation, you first need to go to Theme and plugins localization. Scroll down to the Strings in the theme section and then click the Scan the theme for strings button. WPML will then detect any unregistered or newly added strings that are properly formatted for localization.

如果有效,您将看到您的主题 a-theme 列在 Domain 列中,并在 Count 列中看到检测到的字符串数量> 列.单击查看需要翻译的字符串按钮将带您进入字符串翻译.如果任何字符串的本地化格式不正确,则不会更新计数.

If it works, you'll see your theme a-theme listed in the Domain column and the number of detected strings in the Count column. Clicking the View strings that need translation button will take you to String Translation. If any of the strings aren't properly formatted for localization, the count won't be updated.

如果您更新现有字符串或添加新字符串,则需要在 WPML 将它们添加到字符串翻译之前重新扫描.

If you update existing strings or add new ones, you'll need to rescan before WPML adds them to String Translation.

第一个示例中的格式看起来没问题,WPML 应该检测字符串,但在第二个示例中,您尚未声明域.如果没有域,WPML 将无法提取字符串.

The formatting in your first example looks OK and WPML should detect the strings, but in the second example, you haven't declared a domain. Without a domain, WPML won't pick up the string.

正确的格式是

__('你的字符串', '你的域名')或者_e('你的字符串', '你的域名')

在这种情况下,域应该是您的主题名称,'a_theme'.

In this case, the domain should be the name of your theme, 'a_theme'.

这篇关于为什么字符串没有出现在“字符串翻译"中?WPML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆