Player12
An open source football management simulator
Loading...
Searching...
No Matches
inbox.cpp File Reference
#include "model/inbox.h"
#include <algorithm>
#include <array>
#include <cctype>
#include <cstdlib>
#include <format>
#include <string_view>
#include <utility>
#include "global/language_manager.h"
#include "global/number_format.h"
#include "model/club_article.h"
#include "model/world_rng.h"

Functions

const char * inboxCategoryKey (InboxCategory category)
 
std::string formatLocalized (const std::string &key, const std::vector< std::string > &args)
 
std::string localizedDate (const std::string &text)
 
std::string formatMoney (std::int64_t amount)
 

Function Documentation

◆ formatLocalized()

std::string formatLocalized ( const std::string &  key,
const std::vector< std::string > &  args 
)

Formats a localised template, substituting {n} with args.

Arguments starting with '@' are language keys; ISO dates ("2027-06-30") are shown with the localised month. Two placeholder forms serve grammar: "{n:di}" puts the Italian preposition and article before club name n ("della Roma", see ClubArticle), and "{n|one|other}" picks a word by whether argument n is 1 ("{0} {0|giorno|giorni}").

◆ formatMoney()

std::string formatMoney ( std::int64_t  amount)

Money for a message argument: "€" and the plain amount ("€1250000"), shown by formatLocalized() in the reader's language ("€1.25M", "€ 1,25 mln"), so saved messages follow a later change of language.

◆ inboxCategoryKey()

const char * inboxCategoryKey ( InboxCategory  category)

Language key naming category (e.g. "INBOX_CAT_MATCH").

◆ localizedDate()

std::string localizedDate ( const std::string &  text)

An ISO date ("2027-06-30", GameDateValue::toString()) in the current language, e.g. "30 giu 2027"; any other text is returned unchanged.