qtranslation - x格式在不同语言之间不一致(撇号与右单引号)

时间:2021-03-22 22:29:50

English and Dutch languages enabled. I have my formatting.php set up to differentiate apostrophes (straight, ') and right single quotes (curly, ’):

能够使用英语和荷兰语。我有自己的格式。php用于区分撇号(直,')和右单引号(大括号,'):

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

This works fine in English, but in Dutch it instead takes the right single quote for the apostrophe as well. My output:

这在英语中很管用,但在荷兰语中,撇号也用了正确的单引号。我的输出:

English: Debugging's a ‘tricky’ thing

调试是一件棘手的事情

Dutch: Debugging’s a ‘tricky’ thing

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

I've tried subbing the right single quote ’ with right double quote ”, and it does apply to both languages, but I can't figure out why, in Dutch, it will always take the right single quote instead of the apostrophe.

我试过用正确的双引号来代替正确的单引号,它确实适用于两种语言,但我不知道为什么,在荷兰,它总是用正确的单引号而不是撇号。

Any help is greatly appreciated.

非常感谢您的帮助。

1 个解决方案

#1


0  

The regexes in formatting.php weren't getting called because the apostrophe in the Dutch text was replaced somewhere between lines 113 - 130.

regex的格式。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 );

Commenting this section out solves the problem.

注释这一部分解决了这个问题。

#1


0  

The regexes in formatting.php weren't getting called because the apostrophe in the Dutch text was replaced somewhere between lines 113 - 130.

regex的格式。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 );

Commenting this section out solves the problem.

注释这一部分解决了这个问题。