Voir le bouton :
Je ne serais pas surpris si le problème était présent dans toutes les info-bulles.
Users reported an encoding issue with special characters—specifically apostrophes—in onboarding tooltips on Discourse, particularly affecting French translations. Canapin first highlighted the problem with a screenshot, noting it might affect all tooltips. Arkshine investigated the code and found that the escape function is applied to button labels and content, questioning whether escaping is necessary since templates may handle it automatically. pequiste suggested replacing the programming apostrophe (') with the correct French typographic apostrophe (’), which is standard on modern French keyboards (AFNOR AZERTY or BÉPO), though not on older layouts. evenlo confirmed the issue on Discourse 3.4.1 and shared a workaround using custom JavaScript to replace ' with ’ in I18n.translations, carefully preserving HTML tags. Finally, pmusaraj confirmed the issue has been resolved in Discourse via a recent commit, thanking users for the report. The core problem was improper escaping of typographic characters in translated strings, and while a workaround exists, the official fix is now merged.
Voir le bouton :
Je ne serais pas surpris si le problème était présent dans toutes les info-bulles.
J’ai rencontré le même problème.
Un rapide coup d’œil à Discourse montre que escape est utilisé sur l’étiquette du bouton, le titre et le contenu.
Qu’est-ce que escape :
Dans un contexte textuel, cela semble être tous les caractères valides à utiliser.
Je me demande si c’est nécessaire ici ?
Je crois que le HTML non marqué avec htmlSafe sera échappé par le template ? ![]()
A fix could be to replace the programming apostrophe with the actual French apostrophe.
Use: ’
Not: '
This symbol does not exist on US QWERTY keyboards and does not exist either on older AZERTY ones but it does exist on both new AFNOR (Association française de normalisation) standard French keyboards, either new AZERTY or BÉPO.
It wouldn’t fix the deeper issue that the programmatic apostrophe is not correctly escaped, but the real French apostrophe is the correct one to use and should be the one most French speakers will use in typing once a majority of them will be on standard keyboards.
The old AZERTY was never actually standardized by any official body.
J’ai le même problème sur Discourse 3.4.1…
Je ne peux pas remplacer tous les ' sur le site web. Avez-vous des suggestions ?
J’ai juste résolu ce problème avec du code personnalisé, remplacez ' par ’ dans 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);
}
});
Ceci devrait être corrigé maintenant suite à ce commit : FIX: user tips in languages with apostrophes by pmusaraj · Pull Request #34118 · discourse/discourse · GitHub
Merci pour le signalement !
Ce sujet a été automatiquement fermé après 3 jours. Les nouvelles réponses ne sont plus autorisées.