MeshLib C++ Docs
Loading...
Searching...
No Matches
MRLocale.h
Go to the documentation of this file.
1#pragma once
2
3#include "config.h"
4#ifndef MRVIEWER_NO_LOCALE
5#include "exports.h"
6
7#include "MRMesh/MRMeshFwd.h"
8
9#include <boost/signals2/connection.hpp>
10
11#include <filesystem>
12#include <vector>
13
14namespace MR::Locale
15{
16
18MRVIEWER_API const std::locale& get();
21MRVIEWER_API const std::string& getName();
24MRVIEWER_API const std::locale& set( const std::string& localeName );
26MRVIEWER_API boost::signals2::connection onChanged( const std::function<void ( const std::string& )>& cb );
27
31MRVIEWER_API std::vector<std::string> getAvailableLocales();
32
37MRVIEWER_API void addCatalogPath( const std::filesystem::path& path );
42MRVIEWER_API LocaleDomainId addDomain( const char* domainName );
46MRVIEWER_API LocaleDomainId addDomain( const std::string& domainName );
51MRVIEWER_API LocaleDomainId findDomain( const char* domainName );
55MRVIEWER_API LocaleDomainId findDomain( const std::string& domainName );
56
63MRVIEWER_API std::string getDisplayName( const std::string& localeName );
65MRVIEWER_API void setDisplayName( const std::string& localeName, const std::string& displayName );
66
69MRVIEWER_API std::vector<std::string> getSystemLocales();
70
71}
72#endif
Definition MRMeshFwd.h:810
void setDisplayName(const std::string &localeName, const std::string &displayName)
Adds or updates a display name for the given locale.
LocaleDomainId addDomain(const char *domainName)
Adds a new domain. The active locale is reloaded on every call.
void addCatalogPath(const std::filesystem::path &path)
Adds a path to .mo files. The path is expected to have the following directory structure: <locale nam...
const std::string & getName()
Returns the active locale's name.
std::vector< std::string > getAvailableLocales()
Returns the list of the names of locales with available .mo files. "en" is always included as the def...
const std::locale & set(const std::string &localeName)
Loads and sets the active locale by its name. UTF-8 is always used as an encoding.
LocaleDomainId findDomain(const char *domainName)
Find an id for the given domain that can be passed to the translate functions.
std::string getDisplayName(const std::string &localeName)
Returns a display name for the given locale.
boost::signals2::connection onChanged(const std::function< void(const std::string &)> &cb)
Connects to a signal emitted every time the active locale is changed.
const std::locale & get()
Returns the active locale.
std::vector< std::string > getSystemLocales()
Returns a list of system locales. The first one in the list is always the active system locale.