프랑스어 온보딩 팁에서 특수 문자 인코딩 문제

See the button:

I wouldn’t be surprised if the issue was present inall the tooltips.

6개의 좋아요

I stumbled on the same issue.

A quick look to Discourse shows that escape is used on the button label, title and content.

https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/components/user-tip.gjs#L38-L39

https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/components/user-tip.gjs#L54-L58

What does escape:
https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/lib/escape.js

In a text context, this seems all valid characters to use.

I wonder, is it required here?
I believe html not marked with htmlSafe will be escaped by the template? :thinking:

2개의 좋아요

수정 방법은 프로그래밍용 아포스트로프를 실제 프랑스어 아포스트로프로 대체하는 것입니다.

사용:
사용 금지: '

이 기호는 미국 QWERTY 키보드에는 존재하지 않으며, 구형 AZERTY 키보드에도 존재하지 않습니다. 그러나 새로운 AFNOR(Association française de normalisation) 표준 프랑스어 키보드에는 모두 존재하며, 새로운 AZERTYBÉPO 키보드에서 사용할 수 있습니다.

이것은 프로그래밍용 아포스트로프가 올바르게 이스케이프되지 않는다는 근본적인 문제를 해결하지는 못하지만, 실제 프랑스어 아포스트로프가 올바른 기호이며, 다수의 사용자가 표준 키보드를 사용하게 될 경우 프랑스어 사용자들이 타이핑할 때 가장 많이 사용할 기호가 되어야 합니다.

구형 AZERTY는 어떤 공식 기관에 의해 실제로 표준화된 적이 없습니다.

1개의 좋아요

Got same issue on Discourse 3.4.1 …
I can’t possibly replace all the ' on the website. Do you have any suggestions?

I just fixed thiss issue with some custom code, replace ' to in I18n.translations

withPluginApi("0.8.18", (api) => {
    const locale = I18n.currentLocale();

    function replaceSingleQuotes(obj) {
        if (typeof obj === 'string') {
            // Split the string into HTML tags and non-tag parts
            return obj.split(/(<[^>]+>)/g).map(segment => {
                // If the segment is an HTML tag, do not replace anything
                if (segment.startsWith('<') && segment.endsWith('>')) {
                    return segment;
                } else {
                    // Replace single quotes only in non-HTML parts
                    return segment.replace(/'/g, '’');
                }
            }).join('');
        } else if (typeof obj === 'object' && obj !== null) {
            // Recursively process object properties
            for (const key in obj) {
                obj[key] = replaceSingleQuotes(obj[key]);
            }
        }
        return obj;
    }

    if (I18n.translations[locale].js) {
        I18n.translations[locale].js = replaceSingleQuotes(I18n.translations[locale].js);
    }
});

1개의 좋아요

이 커밋 이후 이제 수정되었을 것입니다: FIX: user tips in languages with apostrophes - Pull Request #34118 - discourse/discourse - GitHub

리포트 감사합니다!

4개의 좋아요

이 주제는 3일 후 자동으로 닫혔습니다. 새 답변은 더 이상 허용되지 않습니다.