7#include "translation.hpp"
8#include "po_parser.hpp"
9#include "../i18n/i18n.hpp"
10#include "../formula/formula.hpp"
11#include "../utility/utility.hpp"
12#include "../settings/settings.hpp"
13#include "../unicode/unicode.hpp"
14#include "../telemetry/telemetry.hpp"
15#include "../macros.hpp"
19#include <unordered_map>
22hi_export_module(hikogui.l10n.translation);
33 return hash_mix(msgid, language);
57 auto key = translation_key{
std::string{msgid}, language};
61inline void add_translations(po_translations
const &po_translations)
noexcept
63 for (hilet &
translation : po_translations.translations) {
69inline void load_translations(std::filesystem::path path)
71 hi_log_info(
"Loading translation file {}.", path.string());
72 return add_translations(parse_po(path));
75inline void load_translations()
82 load_translations(path);
84 hi_log_error(
"Could not load translation file. {}", e.
what());
96 auto key = translation_key{
std::string{msgid}, language_tag{}};
99 key.language = language;
101 hilet i = translations.find(key);
102 if (i != translations.cend()) {
110 hi_log_debug(
"No translation found for '{}'", msgid);
111 return {msgid, language_tag{
"en-Latn-US"}};
hi_export generator< std::filesystem::path > glob(glob_pattern pattern) noexcept
Find paths on the filesystem that match the glob pattern.
Definition glob.hpp:879
DOXYGEN BUG.
Definition algorithm.hpp:16
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
hi_export generator< std::filesystem::path > resource_dirs() noexcept
The directories to search for resource files.
constexpr plurality cardinal_plural(language_tag language, std::integral auto n) noexcept
Get plural information of a number in a given language.
Definition unicode_plural.hpp:927
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377
The IETF BCP 47 language tag.
Definition language_tag_intf.hpp:28
Definition translation.hpp:27