簡體   English   中英

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

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

我正在制作一個 pot 文件,我希望該文件在 JS jQuery 文件中掃描 gettext 關鍵字。 它完美地掃描了 php,但 .js 文件似乎無法正常工作。 我想知道我是否真的為命令的語言設置了正確的提取器設置。 這就是我所擁有的:

語言: JS
擴展名列表: *.js
命令: xgettext --language=C --force-po -o %o %C %K %F

它掃描文件,但沒有添加任何內容。 jQuery 的語言是什么?

提供更多信息:

這是 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' ?>');
        }
    }
});

我已經介紹了源關鍵字中的esc_attr_e()

在此處輸入圖像描述

我想知道我是否真的為命令的語言設置了正確的提取器設置

你沒有。 您甚至正在配置提取這一事實表明您正在使用非常舊的 Poedit 版本,或者您正在添加自定義配置。 在任何一種情況下,都不要:更新到最新版本,刪除或禁用所有自定義提取器,並讓 Poedit 使用默認值執行其操作。

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

您要求 Poedit 將 JavaScript 文件視為寫入 C 文件。 結果可以預見地遵循GIGO原則。

這是 JS 文件的示例:

您正在將(甚至是 PHP!)代碼放入string literals中。 那是a)不起作用,b)不能從中提取任何可翻譯的字符串。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM