@@ -24,10 +24,13 @@ #define OF_LOCALIZED(ID, ...) \ [[OFLocalization sharedLocalization] \ localizedStringForID: ID \ fallback: __VA_ARGS__, nil] +@class OFMutableArray OF_GENERIC(ObjectType); +@class OFDictionary OF_GENERIC(KeyType, ObjectType); + /*! * @class OFLocalization OFLocalization.h ObjFW/OFLocalization.h * * @brief A class for querying the locale and retrieving localized strings. */ @@ -35,10 +38,12 @@ { OFString *_language; OFString *_territory; of_string_encoding_t _encoding; OFString *_decimalPoint; + OFMutableArray OF_GENERIC(OFDictionary OF_GENERIC(OFString*, id)*) + *_localizedStrings; } /** * The language of the locale. * @@ -115,10 +120,17 @@ * * @return The decimal point of the system's locale */ + (OFString*)decimalPoint; +/*! + * @brief Adds a directory to scan for language files. + * + * @param path The path to the directory to scan for language files + */ ++ (void)addLanguageDirectory: (OFString*)path; + /*! * @brief Initializes the OFLocalization singleton with the specified locale. * * @warning You should never call this yourself, except if you do not use * @ref OFApplication. In this case, you need to allocate exactly one @@ -127,10 +139,17 @@ * * @param locale The locale used, as returned from `setlocale()` */ - initWithLocale: (char*)locale; +/*! + * @brief Adds a directory to scan for language files. + * + * @param path The path to the directory to scan for language files + */ +- (void)addLanguageDirectory: (OFString*)path; + /*! * @brief Returns the localized string for the specified ID, using the fallback * string if it cannot be looked up or is missing. * * @note This takes a variadic argument, terminated by `nil`, that consists of @@ -147,10 +166,11 @@ * looked up or is missing * @return The localized string */ - (OFString*)localizedStringForID: (OFConstantString*)ID fallback: (OFConstantString*)fallback, ... OF_SENTINEL; + /** * @brief Returns the localized string for the specified ID, using the fallback * string if it cannot be looked up or is missing. * * @note This takes a variadic argument, terminated by `nil` and passed as