Class WLocalizedStrings
- Direct Known Subclasses:
WCombinedLocalizedStrings,WStdLocalizedStrings,WXmlLocalizedStrings
This abstract class provides the content to localized WStrings, by resolving the key to a string using the current application locale.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intevaluatePluralExpression(String expression, long n) Utility method to evaluate a plural expression.voidPurges memory resources, if possible.abstract LocalizedStringresolveKey(Locale locale, String key) Resolves a key in the given locale.resolvePluralKey(Locale locale, String key, long amount) Resolves the plural form of a key in the given locale.
-
Constructor Details
-
WLocalizedStrings
public WLocalizedStrings()
-
-
Method Details
-
hibernate
public void hibernate()Purges memory resources, if possible.This is called afer event handling, and is an opportunity to conserve memory inbetween events, by freeing memory used for cached key/value bindings, if applicable.
The default implementation does nothing.
-
resolveKey
Resolves a key in the given locale.This method is used by
WStringto obtain the UTF-8 value corresponding to a key in the given locale.Returns a successful
LocalizedStringif the key could be resolved.- See Also:
-
resolvePluralKey
Resolves the plural form of a key in the given locale.This method is used by
WStringto obtain the UTF-8 value corresponding to a key in the current locale, taking into account the possibility of multiple plural forms, and chosing the right plural form based on theamountpassed.Throws a std::logic_error if the underlying implementation does not provide support for plural internationalized strings.
Returns a successful
LocalizedStringif the key could be resolved. -
evaluatePluralExpression
Utility method to evaluate a plural expression.This evaluates C expressions such as used by ngettext for a particular value, which can be useful to implement plural key resolution.
-