简体   繁体   English

WordPress WPML如何打印翻译

[英]Wordpress WPML how to print translation

I'm trying to translate texts in a WordPress template file: 我正在尝试翻译WordPress模板文件中的文本:

_e('Sport Events Organizing', 'theme-text-domain');

I've setup the translation for spanish on WPML String Translation. 我已经在WPML字符串翻译上设置了西班牙语翻译。 Checked "Finished Translation" and clicked "Save". 选中“完成翻译”,然后单击“保存”。 Then I browse my site and change the language to "Spanish". 然后,我浏览我的站点并将语言更改为“西班牙语”。 But the text still appears in english. 但是文本仍然以英语显示。 URL shows the ?lang=es parameter. URL显示?lang = es参数。

To get WPML to make the translations for this text available I had to register it with: 为了使WPML能够提供该文本的翻译版本,我必须在以下位置进行注册:

icl_register_string('theme-text-domain', 'Sports', 'Sport Events Organizing')

Why is the spanish translation not showing? 为什么西班牙翻译没有显示? Is there a way to debug this? 有办法调试吗?

First you have to translate the strings from the admin panel , the strings wrapped in __() or _e() will appear in the wpadmin panel under the String translation module if you haven't install this plugin then first install this wpml plugin below is the snapshot in which you can see the list of strings need to be translated and from there you can edit the translations from default language to other languages 首先,您必须从管理面板中翻译字符串,如果您尚未安装此插件,则包装在__()_e()中的字符串将出现在字符串翻译模块下的wpadmin面板中,然后首先在以下安装此wpml插件:您可以在其中查看需要翻译的字符串列表的快照,然后可以在其中编辑从默认语言到其他语言的翻译

在此处输入图片说明

When ever you add new strings in your theme you have to refresh the translation module to get the new strings in the translation module see below attached snaps 每当您在主题中添加新字符串时,都必须刷新翻译模块才能在翻译模块中获取新字符串,请参见下面的附件快照。

Under Theme and plugins localization menu 在主题和插件本地化菜单下

在此处输入图片说明

And in same module you will see the plugins and there strings you can rescan them and they appear in string translation module 并且在同一模块中,您将看到插件,并且您可以重新扫描它们的字符串,它们会出现在字符串翻译模块中

Hope it makes a good sense for the cycle of translation 希望它对翻译的周期有意义

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

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