简体   繁体   English

poedit中jQuery的gettext命令语言是什么?

[英]What is the gettext command's language for jQuery in poedit?

I am making a pot file where I want the file to scan for gettext keywords in a JS jQuery file.我正在制作一个 pot 文件,我希望该文件在 JS jQuery 文件中扫描 gettext 关键字。 It scans the php perfectly, but the.js file seems not be working.它完美地扫描了 php,但 .js 文件似乎无法正常工作。 I am wondering if I have actually the extractor setup correct for the command's language.我想知道我是否真的为命令的语言设置了正确的提取器设置。 This is what I have:这就是我所拥有的:

Language: JS语言: JS
List of extensions: *.js扩展名列表: *.js
Command: xgettext --language=C --force-po -o %o %C %K %F命令: xgettext --language=C --force-po -o %o %C %K %F

It scans the file, but nothing is added.它扫描文件,但没有添加任何内容。 What is the language for jQuery? jQuery 的语言是什么?

To give more information:提供更多信息:

This is an example of the JS file:这是 JS 文件的示例:

jQuery(document).ready(function() {
    if(location.href.indexOf('/<?php esc_html_e('url_page_discount', 'custom-translation-strings' ?>/') > -1){ //rewards
        jQuery('.rs_custom_fblike_button').attr('value', '<?php esc_attr_e('I Like', 'custom-translation-strings' ?>');
        if (jQuery('#menu-item-10159').length){
            jQuery('#rs_friend_subject').attr('value', '<?php esc_attr_e('Discount for an interesting store!', 'custom-translation-strings' ?>');
        }
    }
});

I have covered the esc_attr_e() in the sources keywords:我已经介绍了源关键字中的esc_attr_e()

在此处输入图像描述

I am wondering if I have actually the extractor setup correct for the command's language我想知道我是否真的为命令的语言设置了正确的提取器设置

You don't.你没有。 The very fact that you're even configuring extraction suggests that you're either using a very old version of Poedit or you're adding custom configurations.您甚至正在配置提取这一事实表明您正在使用非常旧的 Poedit 版本,或者您正在添加自定义配置。 In either case, don't: update to the latest, delete or disable all your custom extractors, and let Poedit do its thing with defaults.在任何一种情况下,都不要:更新到最新版本,删除或禁用所有自定义提取器,并让 Poedit 使用默认值执行其操作。

Command: xgettext —language= C --force-po -o %o %C %K %F命令:xgettext —language= C --force-po -o %o %C %K %F

You're asking Poedit to treat JavaScript files as being written in C.您要求 Poedit 将 JavaScript 文件视为写入 C 文件。 The results predictably follow the GIGO principle.结果可以预见地遵循GIGO原则。

This is an example of the JS file:这是 JS 文件的示例:

You're putting (even PHP!) code into string literals .您正在将(甚至是 PHP!)代码放入string literals中。 That's a) not going to work and b) cannot have any translatable strings extracted from.那是a)不起作用,b)不能从中提取任何可翻译的字符串。

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

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