Package org.opencms.i18n
Class CmsRemoveInnerNameFallback
java.lang.Object
org.opencms.i18n.CmsRemoveInnerNameFallback
- All Implemented Interfaces:
CmsMultiMessages.I_KeyFallbackHandler
,I_CmsRegexSubstitution
public class CmsRemoveInnerNameFallback
extends Object
implements CmsMultiMessages.I_KeyFallbackHandler, I_CmsRegexSubstitution
Message key fallback handler used to enable reuse of localization keys for editor labels.
This handler, when given a key of the form label.foo.bar (starting with 'label' and containing at least three dot-separated components), removes the second component (in the example, this results in the key label.bar).
This can be useful if you want to reuse the same key for fields of multiple content types.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncom.google.common.base.Optional<String>
getFallbackKey
(String key) Gets the fallback key for the given key, or the absent value if there is no fallback key.substituteMatch
(String string, Matcher matcher) Should return the substitution for the current match of the matcher.
-
Field Details
-
REGEX_STR
Regex string.- See Also:
-
PATTERN
Regex pattern instance.
-
-
Constructor Details
-
CmsRemoveInnerNameFallback
Creates a new instance.- Parameters:
config
- the configuration (ignored)
-
-
Method Details
-
getFallbackKey
Description copied from interface:CmsMultiMessages.I_KeyFallbackHandler
Gets the fallback key for the given key, or the absent value if there is no fallback key.- Specified by:
getFallbackKey
in interfaceCmsMultiMessages.I_KeyFallbackHandler
- Parameters:
key
- the original key- Returns:
- the fallback key
- See Also:
-
substituteMatch
Description copied from interface:I_CmsRegexSubstitution
Should return the substitution for the current match of the matcher.- Specified by:
substituteMatch
in interfaceI_CmsRegexSubstitution
- Parameters:
string
- the base string in which the match occurredmatcher
- the matcher which is currently being used- Returns:
- the substitution which should be used for the current match of the matcher
- See Also:
-