Improve docs for language values

This commit is contained in:
Oliver Hamlet
2025-06-11 17:34:56 +01:00
parent 356749df21
commit bee0f36d7b
2 changed files with 18 additions and 12 deletions
@@ -9,7 +9,10 @@ The localised content data structure is a key-value string map.
.. describe:: lang
**Required.** The language that ``text`` is written in, given as a code of the form ``ll`` or ``ll_CC``, where ``ll`` is an ISO 639-1 language code and ``CC`` is an ISO 3166 country code. For example,
**Required.** The language that ``text`` is written in, given as an XPG-format
(a.k.a. POSIX-format) locale name of the form ``ll`` or ``ll_CC``, where
``ll`` is an ISO 639-1 language code and ``CC`` is an ISO 3166 country code.
For example,
==================== =====
Language Code
+14 -11
View File
@@ -125,20 +125,23 @@ LOOT_API bool operator>=(const MessageContent& lhs, const MessageContent& rhs);
* @param content
* The MessageContent objects to choose between.
* @param language
* The locale or language code for the preferred language to select.
* Locale codes are of the form `[language code]_[country code]`.
* The preferred language to select. Values are expected to have the
* form `[language code]` or `[language code]_[country code]`, where
* `[language code]` is an ISO 639-1 language code and `[country code]`
* is an ISO 3166 country code.
* @return A MessageContent object.
* * If the vector only contains a single element, that element is
* returned.
* * If content with a language that exactly matches the given locale
* or language code is present, that content is returned.
* * If a locale code is given and there is no exact match but content
* for that locale's language is present, that content is returned.
* * If a language code is given and there is no exact match but
* content for a locale in that langauge is present, that content is
* returned.
* * If no locale or language code matches are found and content in
* the default language is present, that content is returned.
* * If content with a language that exactly matches the given language
* is present, that content is returned.
* * If the given language includes a country code and there is no exact
* match but content for the same language code is present, that
* content is returned.
* * If the given language does not include a country code and there is
* no exact match but content for thet same language code is present,
* that content is returned.
* * If no matches are found and content in the default language is
* present, that content is returned.
* * Otherwise, an empty optional is returned.
*/
LOOT_API std::optional<MessageContent> SelectMessageContent(