Skip to content

Node.js based forum software built for the modern web

Merge branch 'master' into develop

Barış Soner Uşaklı7fcf88e23b8b
diff --cc public/src/modules/translator.common.js
index f074ad0557,80295f6dd7..2f3a43d9f2
--- a/public/src/modules/translator.common.js
+++ b/public/src/modules/translator.common.js
@@@ -486,11 -496,9 +496,13 @@@ module.exports = function (utils, load
languageDirection: function (lang) {
return this.rtlLanguages.includes(lang) ? 'rtl' : 'ltr';
},
+ isTranslationKey: isTranslationKey,
+ hasTranslationKey: hasTranslationKey,
+ isTranslationKey: function (str) {
+ return typeof str === 'string' && /\[\[([a-zA-Z0-9_.-]+:[^[\]]+)\]\]/.test(str);
+ },
+
flush: function () {
Object.keys(Translator.cache).forEach(function (code) {
Translator.cache[code].translations = {};
diff --cc src/user/notifications.js
index 17ac26dc34,858becb74d..e907816068
--- a/src/user/notifications.js
+++ b/src/user/notifications.js
@@@ -135,11 -136,11 +136,14 @@@ UserNotifications.getNotifications = as
notificationData = await notifications.merge(notificationData);
await Promise.all(notificationData.map(async (n) => {
if (n?.bodyShort) {
- n.bodyShort = await tx.translate(n.bodyShort, userSettings.userLang);
+ n.bodyShort = posts.sanitize(await tx.translate(n.bodyShort, userSettings.userLang));
+ }
+ if (n?.bodyLong) {
+ n.bodyLong = posts.sanitize(n.bodyLong);
}
+ if (n?.bodyLong && n?.txBodyLong) {
+ n.bodyLong = await tx.translate(n.bodyLong, userSettings.userLang);
+ }
}));
const result = await plugins.hooks.fire('filter:user.notifications.getNotifications', {