/usr/include/Wt/WLocalizedStrings is in libwt-dev 3.3.4+dfsg-6ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef WLOCALIZED_STRINGS_
#define WLOCALIZED_STRINGS_
#include <string>
#include <Wt/WDllDefs.h>
namespace Wt {
class WString;
/*! \class WLocalizedStrings Wt/WLocalizedStrings Wt/WLocalizedStrings
* \brief 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.
*
* \sa WString::tr(), WApplication::setLocalizedStrings()
*/
class WT_API WLocalizedStrings
{
public:
/*! \brief Destructor.
*/
virtual ~WLocalizedStrings();
/*! \brief Rereads the message resources.
*
* Purge any cached key/values, if applicable.
*
* The default implementation does nothing.
*/
virtual void refresh();
/*! \brief 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.
*/
virtual void hibernate();
/*! \brief 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.
*
* \if cpp
* Returns \c true if the key could be resolved. The value is written
* in \p result, encoded using UTF8.
* \endif
*
* \if java
* Returns the value if the key could be resolved. Returns \c null otherwise.
* \endif
*
* \sa WApplication::locale(), WString::tr()
*/
#ifndef WT_TARGET_JAVA
virtual bool resolveKey(const std::string& key, std::string& result) = 0;
#else // WT_TARGET_JAVA
virtual std::string *resolveKey(const std::string& key) = 0;
#endif // WT_TARGET_JAVA
/*! \brief 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.
*
* \if cpp
* Returns \c true if the key could be resolved. The value is written
* in \p result, encoded as UTF8.
* \endif
*
* \if java
* Returns the value if the key could be resolved. Returns \c null
* otherwise.
* \endif
*
* \sa WApplication::locale(), WString::trn()
*/
#ifndef WT_TARGET_JAVA
virtual bool resolvePluralKey(const std::string& key,
std::string& result,
::uint64_t amount);
/*! \brief 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.
*
* \sa resolvePluralKey()
*/
static int evaluatePluralExpression(const std::string &expression,
::uint64_t n);
#else // WT_TARGET_JAVA
//TODO make this work for java
//virtual std::string *resolveKey(const std::string& key) = 0;
#endif // WT_TARGET_JAVA
};
}
#endif // WSTRING_TRANSLATOR_
|