An abstract class that provides support for localized strings. More...
#include <Wt/WLocalizedStrings>
Public Member Functions | |
virtual | ~WLocalizedStrings () |
Destructor. | |
virtual void | refresh () |
Rereads the message resources. More... | |
virtual void | hibernate () |
Purges memory resources, if possible. More... | |
virtual bool | resolveKey (const std::string &key, std::string &result)=0 |
Resolves a key in the current locale. More... | |
virtual bool | resolvePluralKey (const std::string &key, std::string &result,::uint64_t amount) |
Resolves the plural form of a key in the current locale. More... | |
Static Public Member Functions | |
static int | evaluatePluralExpression (const std::string &expression,::uint64_t n) |
Utility method to evaluate a plural expression. More... | |
An abstract class that provides support for localized strings.
This abstract class provides the content to localized WStrings, by resolving the key to a string using the current application locale.
|
static |
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.
|
virtual |
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.
Reimplemented in Wt::WMessageResourceBundle, and Wt::WCombinedLocalizedStrings.
|
virtual |
Rereads the message resources.
Purge any cached key/values, if applicable.
The default implementation does nothing.
Reimplemented in Wt::WMessageResourceBundle, and Wt::WCombinedLocalizedStrings.
|
pure virtual |
Resolves a key in the current locale.
This method is used by WString to obtain the UTF8 value corresponding to a key in the current locale. Returns \c true if the key could be resolved. The value is written in \p result, encoded using UTF8.
Implemented in Wt::WMessageResourceBundle, and Wt::WCombinedLocalizedStrings.
|
virtual |
Resolves the plural form of a key in the current locale.
This method is used by WString to obtain the UTF8 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 the \p amount passed. Throws a std::logic_error if the underlying implementation does not provide support for plural internationalized strings. Returns \c true if the key could be resolved. The value is written in \p result, encoded as UTF8.
Reimplemented in Wt::WMessageResourceBundle, and Wt::WCombinedLocalizedStrings.