跨语言的translate - x格式不统一(撇号vs右单引号)



支持英语和荷兰语。我设置了format .php来区分省略号(直,')和右单引号(大括号,'):

$apos = _x( ''', 'apostrophe' );
$opening_single_quote = _x( '‘', 'opening curly single quote' );
$closing_single_quote = _x( '’', 'closing curly single quote' );

这在英语中工作得很好,但在荷兰语中,它也会为撇号使用正确的单引号。我的输出:

英语:调试是一件"棘手"的事情

荷兰:调试是一件"棘手"的事情

我试过用右单引号替换’右双引号”,它确实适用于两种语言,但我不明白为什么,在荷兰语中,它总是使用右单引号而不是撇号。

没有调用format .php中的正则表达式,因为荷兰语文本中的撇号在第113 - 130行之间的某处被替换了。

// if a plugin has provided an autocorrect array, use it
        if ( isset($wp_cockneyreplace) ) {
            $cockney = array_keys( $wp_cockneyreplace );
            $cockneyreplace = array_values( $wp_cockneyreplace );
        } else {
            /* translators: This is a comma-separated list of words that defy the syntax of quotations in normal use,
             * for example...  'We do not have enough words yet' ... is a typical quoted phrase.  But when we write
             * lines of code 'til we have enough of 'em, then we need to insert apostrophes instead of quotes.
             */
            $cockney = explode( ',', _x( "'tain't,'twere,'twas,'tis,'twill,'til,'bout,'nuff,'round,'cause,'em",
                'Comma-separated list of words to texturize in your language' ) );
            $cockneyreplace = explode( ',', _x( '’tain’t,’twere,’twas,’tis,’twill,’til,’bout,’nuff,’round,’cause,’em',
                'Comma-separated list of replacement words in your language' ) );
        }
        $static_characters = array_merge( array( '...', '``', '''', ' (tm)' ), $cockney );
        $static_replacements = array_merge( array( '…', $opening_quote, $closing_quote, ' ™' ), $cockneyreplace );

注释掉这个部分可以解决这个问题。

相关内容

  • 没有找到相关文章

最新更新