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 <boost/signals2/connection.hpp>
8
9#include <filesystem>
10#include <vector>
11
12namespace MR::Locale
13{
14
16MRVIEWER_API const std::locale& get();
19MRVIEWER_API const std::string& getName();
22MRVIEWER_API const std::locale& set( std::string localeName );
24MRVIEWER_API boost::signals2::connection onChanged( const std::function<void ( const std::string& )>& cb );
25
28MRVIEWER_API std::vector<std::string> getAvailableLocales();
29
34MRVIEWER_API void addCatalogPath( const std::filesystem::path& path );
39MRVIEWER_API int addDomain( const char* domainName );
43MRVIEWER_API int addDomain( const std::string& domainName );
48MRVIEWER_API int findDomain( const char* domainName );
52MRVIEWER_API int findDomain( const std::string& domainName );
53
60MRVIEWER_API std::string getDisplayName( const std::string& localeName );
62MRVIEWER_API void setDisplayName( const std::string& localeName, const std::string& displayName );
63
64}
65#endif
Definition MRMeshFwd.h:805
void setDisplayName(const std::string &localeName, const std::string &displayName)
Adds or updates a display name for the given locale.
int 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...
int 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 & set(std::string localeName)
Loads and sets the active locale by its name. UTF-8 is always used as an encoding.
const std::locale & get()
Returns the active locale.