Constructor and Description |
---|
LangImpl(NinjaProperties ninjaProperties) |
Modifier and Type | Method and Description |
---|---|
void |
clearLanguage(Result result)
Clears the current language.
|
com.google.common.base.Optional<java.lang.String> |
getLanguage(Context context,
com.google.common.base.Optional<Result> result)
Retrieve the current language or null if not set.
|
java.util.Locale |
getLocaleFromStringOrDefault(com.google.common.base.Optional<java.lang.String> language)
application.conf usually contains the following:
application.languages=en,de
This little helper converts a language code
like (en, en-US etc) to a Java locale.
|
boolean |
isLanguageDirectlySupportedByThisApplication(java.lang.String language)
application.conf usually contains the following:
application.languages=en,de
This little helper checks if the language is supported.
|
Result |
setLanguage(java.lang.String locale,
Result result)
Force a language in Ninja framwork.
|
@Inject public LangImpl(NinjaProperties ninjaProperties)
public void clearLanguage(Result result)
Lang
clearLanguage
in interface Lang
public Result setLanguage(java.lang.String locale, Result result)
Lang
setLanguage
in interface Lang
locale
- (fr, ja, it ...)public com.google.common.base.Optional<java.lang.String> getLanguage(Context context, com.google.common.base.Optional<Result> result)
Lang
getLanguage
in interface Lang
public boolean isLanguageDirectlySupportedByThisApplication(java.lang.String language)
Lang
isLanguageDirectlySupportedByThisApplication
in interface Lang
language
- The language to check (en, en-US etc)public java.util.Locale getLocaleFromStringOrDefault(com.google.common.base.Optional<java.lang.String> language)
Lang
getLocaleFromStringOrDefault
in interface Lang
language
- The language to check (en, en-US etc)Copyright © 2014. All Rights Reserved.