From a70f9c05482d6d57123bddddaba5c5b722fa52e7 Mon Sep 17 00:00:00 2001 From: srosse <none@none> Date: Wed, 27 May 2015 11:24:39 +0200 Subject: [PATCH] OO-1558: don't decorate i18n label which are resolved by the $package:i18nkey mechanism --- .../java/org/olat/core/util/i18n/I18nManager.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/olat/core/util/i18n/I18nManager.java b/src/main/java/org/olat/core/util/i18n/I18nManager.java index 2ecce3305b3..6165d3a4caa 100644 --- a/src/main/java/org/olat/core/util/i18n/I18nManager.java +++ b/src/main/java/org/olat/core/util/i18n/I18nManager.java @@ -201,11 +201,16 @@ public class I18nManager extends BasicManager { * possible and not found */ public String getLocalizedString(String bundleName, String key, Object[] args, Locale locale, boolean overlayEnabled, boolean fallBackToDefaultLocale) { - return getLocalizedString(bundleName, key, args, locale, overlayEnabled, fallBackToDefaultLocale, true, true, 0); + return getLocalizedString(bundleName, key, args, locale, overlayEnabled, fallBackToDefaultLocale, true, true, true, 0); } public String getLocalizedString(String bundleName, String key, Object[] args, Locale locale, boolean overlayEnabled, boolean fallBackToDefaultLocale, boolean fallBackToFallbackLocale, boolean resolveRecursively, int recursionLevel) { + return getLocalizedString(bundleName, key, args, locale, overlayEnabled, fallBackToDefaultLocale, fallBackToFallbackLocale, resolveRecursively, true, recursionLevel); + } + + private final String getLocalizedString(String bundleName, String key, Object[] args, Locale locale, boolean overlayEnabled, boolean fallBackToDefaultLocale, + boolean fallBackToFallbackLocale, boolean resolveRecursively, boolean allowDecoration, int recursionLevel) { String msg = null; Properties properties = null; // a) If the overlay is enabled, lookup first in the overlay property @@ -305,7 +310,7 @@ public class I18nManager extends BasicManager { } // Add markup code to identify translated strings - if (isCurrentThreadMarkLocalizedStringsEnabled() + if (allowDecoration && isCurrentThreadMarkLocalizedStringsEnabled() && !bundleName.startsWith(BUNDLE_INLINE_TRANSLATION_INTERCEPTOR) && !bundleName.startsWith(BUNDLE_EXCEPTION) && isInlineTranslationEnabledForKey(bundleName, key)) { @@ -929,7 +934,7 @@ public class I18nManager extends BasicManager { } } else { // Resolve using other bundle - String resolvedKey = getLocalizedString(toResolvedBundle, toResolvedKey, null, locale, overlayEnabled, true, true, true, recursionLevel); + String resolvedKey = getLocalizedString(toResolvedBundle, toResolvedKey, null, locale, overlayEnabled, true, true, true, false, recursionLevel); if (StringHelper.containsNonWhitespace(resolvedKey)) { resolvedValue.append(resolvedKey); lastPos = matcher.end(); -- GitLab