info.magnolia.i18nsystem
Class TranslationServiceImpl
java.lang.Object
info.magnolia.i18nsystem.TranslationServiceImpl
- All Implemented Interfaces:
- TranslationService
@Singleton
public class TranslationServiceImpl
- extends Object
- implements TranslationService
A TranslationService which relies on a "global" message bundle, as loaded per DefaultMessageBundlesLoader
.
Each given key is looked up in the given locale, then in less specific locales, then in the fallback locale.
That is, if [a, b, c] are passed as keys, with country-specific Locale such as de_CH, and "b" is defined in the de_CH
message bundle, it will be returned, even if "a" is defined in the less specific "de" Locale.
When a basename is explicitly specified, it however uses MessagesManager
to look the keys up, falls back
to the default bundle of MessagesManager, then finally falls back on its own global message bundle.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TranslationServiceImpl
public TranslationServiceImpl()
setupMessageBundles
protected DefaultMessageBundlesLoader setupMessageBundles()
translate
public String translate(LocaleProvider localeProvider,
String[] keys)
- Specified by:
translate
in interface TranslationService
translate
public String translate(LocaleProvider localeProvider,
String basename,
String[] keys)
- Specified by:
translate
in interface TranslationService
basename
- Usage of a basename is deprecated since 5.1. This method is here to allow backwards compatibility.
handleUnknownKey
protected String handleUnknownKey(Locale locale,
String basename,
String[] keys)
reloadMessageBundles
public void reloadMessageBundles()
- Description copied from interface:
TranslationService
- Allows to reload all the message bundles - useful in development.
- Specified by:
reloadMessageBundles
in interface TranslationService
Copyright © 2003-2013 Magnolia International Ltd.. All Rights Reserved.