如何使用函数__(?

时间:2015-01-07 作者:alex

目前,我正在翻译一个带有_uuu(和_e(函数和poedit))的WP主题。现在对于单词和句子来说,它工作正常,但我不知道如何处理主题中的“硬编码”正文文本?

我可以这样做吗:

    __(\'WordPress is web software you can use to create a beautiful website or blog. We like to say that WordPress is both free and priceless at the same time.
The core software is built by hundreds of community volunteers, and when you’re ready for more there are thousands of plugins and themes available to transform your site into almost anything you can imagine. Over 60 million people have chosen WordPress to power the place on the web they call “home” — we’d love you to join the family.\',\'my-theme\');
是否有最大大小函数\\uuuu(并且poedit可以处理???

当做

1 个回复
最合适的回答,由SO网友:Rarst 整理而成

我找不到关于这个问题的硬答案的参考,但它可能可以很好地处理大字符串。通过快速查看WP自己的文件,可以看到以下内容:

__(\'Your account has been activated. You may now <a href="%1$s">log in</a> to the site using your chosen username of &#8220;%2$s&#8221;. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.\')
在采购订单中存储为多行:

#: wp-activate.php:96
msgid ""
"Your account has been activated. You may now <a href=\\"%1$s\\">log in</a> to "
"the site using your chosen username of &#8220;%2$s&#8221;. Please check your "
"email inbox at %3$s for your password and login instructions. If you do not "
"receive an email, please check your junk or spam folder. If you still do not "
"receive an email within an hour, you can <a href=\\"%4$s\\">reset your "
"password</a>."
因此,它似乎天生具有感知能力,适合处理大型字符串。

结束

相关推荐

Custom metabox translation

我已经创建了一个自定义的帖子类型,并添加了一些自定义的元数据库,现在我想知道我在我的网站上使用了什么样的翻译插件?我对它们都没有经验,所以我不知道谁会支持我的自定义元数据库,谁不会。