7#include "po_translations.hpp"
8#include "po_parser.hpp"
9#include "../i18n/i18n.hpp"
10#include "../utility/utility.hpp"
11#include "../settings/settings.hpp"
12#include "../unicode/unicode.hpp"
13#include "../telemetry/telemetry.hpp"
14#include "../macros.hpp"
18#include <unordered_map>
21hi_export_module(hikogui.l10n.translation);
23hi_export
namespace hi {
32 return hash_mix(msgid, language);
48hi_export
namespace hi {
56 auto key = translation_key{
std::string{msgid}, language};
68hi_inline
void load_translations(std::filesystem::path path)
70 hi_log_info(
"Loading translation file {}.", path.string());
71 return add_translations(parse_po(path));
74hi_inline
void load_translations()
81 load_translations(path);
83 hi_log_error(
"Could not load translation file. {}", e.
what());
95 auto key = translation_key{
std::string{msgid}, language_tag{}};
98 key.language = language;
100 auto const i = translations.find(key);
101 if (i != translations.cend()) {
109 hi_log_debug(
"No translation found for '{}'", msgid);
110 return {msgid, language_tag{
"en-Latn-US"}};
hi_export hi_inline generator< std::filesystem::path > glob(glob_pattern pattern) noexcept
Find paths on the filesystem that match the glob pattern.
Definition glob.hpp:880
hi_inline generator< std::filesystem::path > resource_dirs() noexcept
The directories to search for resource files.
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
The HikoGUI namespace.
Definition recursive_iterator.hpp:15
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:929
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:378
The IETF BCP 47 language tag.
Definition language_tag_intf.hpp:30
Definition translation.hpp:26