66 auto language_name = to_language_name(
language);
68 if (load_language(language_name)) languages_[language_name] = language_name;
69 language_values_[languages_[language_name]][key] = value;
109 auto language_name = to_language_name(
language);
111 if (!load_language(language_name))
return value;
112 if (!language_values_[languages_[language_name]].contains_key(value))
return value;
113 return language_values_[languages_[language_name]][value].c_str();
120 static bool load_language(
const xtd::string&
language) {
return load_language(
language, xtd_locale_path(), application_locale_path());}
124 static xtd::collections::generic::dictionary<xtd::string, xtd::collections::specialized::string_dictionary> language_values_;
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:63
@ xtd_locale
The xtd locale folder.
Definition environment.hpp:249
@ application_resources
The application resources folder.
Definition environment.hpp:245
static xtd::string get_folder_path(environment::special_folder folder)
Gets the path to the system special folder that is identified by the specified enumeration.
Definition environment.hpp:613
Represents translator class. This class cannot be inherited.
Definition translator.hpp:28
static bool parse_file(const xtd::string &file, const xtd::string &language)
Parses a specified file that contains translations for a specified language.
static xtd::array< xtd::string > languages()
Gets an array of languages supported by the application.
static xtd::string translate(const xtd::string &value) noexcept
Translates a string into the lganguage specified by the xtd::translate::language property.
Definition translator.hpp:98
static xtd::string system_language()
Gets the current system language.
static void language(xtd::null_ptr)
Sets the current application language.
static xtd::string language()
Gets the current application language.
static bool parse_locale(const xtd::string &locale_path, const xtd::string &language)
Parses a specified path that contains translations.
static bool parse_file(const xtd::string &file)
Parses a specified file that contains translations for a specified language.
static void language(const xtd::string &language)
Sets the current application language.
static void add_value(const xtd::string &language, const xtd::string &key, const xtd::string &value)
Manually adds a translation for a specified key and language.
Definition translator.hpp:65
static bool parse_locale(const xtd::string &locale_path)
Parses a specified path that contains translations.
static xtd::string translate(const xtd::string &language, const xtd::string &value) noexcept
Translates a string into the specified lganguage.
Definition translator.hpp:103
static bool exists(const xtd::string &path)
Determines whether the given path refers to an existing directory on disk.
static xtd::string combine(const xtd::string &path1, const xtd::string &path2)
Combines two path strings.
Contains xtd::environment class.
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.hpp:37
xtd::collections::generic::dictionary< xtd::string, xtd::string > string_dictionary
Represents a xtd::collections::generic::dictionary with the key and the value strongly typed to be st...
Definition string_dictionary.hpp:28
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
std::nullptr_t null_ptr
Represents the null_opt alias on std::nullptr_t.
Definition null_ptr.hpp:19
std::optional< type_t > optional
Represents the optional alias on std::optional.
Definition optional.hpp:25
Contains xtd::globalization::translator suffixes.
Contains classes that define culture-related information, including language, country/region,...
Definition culture_info.hpp:18
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains xtd::optional type.
Contains xtd::io::path class.
Contains xtd::static_object class.
Contains xtd::string alias.
Contains xtd::collections::specialized::string_dictionary typedef.