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 auto load_language(
const xtd::string&
language) ->
bool {
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:64
@ xtd_locale
The xtd locale folder.
Definition environment.hpp:248
@ application_resources
The application resources folder.
Definition environment.hpp:244
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:614
Represents translator class. This class cannot be inherited.
Definition translator.hpp:28
static auto language(const xtd::string &language) -> void
Sets the current application language.
static auto parse_file(const xtd::string &file) -> bool
Parses a specified file that contains translations for a specified language.
static auto languages() -> xtd::array< xtd::string >
Gets an array of languages supported by the application.
static auto parse_locale(const xtd::string &locale_path, const xtd::string &language) -> bool
Parses a specified path that contains translations.
static auto language(xtd::null_ptr) -> void
Sets the current application language.
static auto language() -> xtd::string
Gets the current application language.
static auto add_value(const xtd::string &language, const xtd::string &key, const xtd::string &value) -> void
Manually adds a translation for a specified key and language.
Definition translator.hpp:65
static auto translate(const xtd::string &value) noexcept -> xtd::string
Translates a string into the lganguage specified by the xtd::translate::language property.
Definition translator.hpp:98
static auto parse_file(const xtd::string &file, const xtd::string &language) -> bool
Parses a specified file that contains translations for a specified language.
static auto parse_locale(const xtd::string &locale_path) -> bool
Parses a specified path that contains translations.
static auto translate(const xtd::string &language, const xtd::string &value) noexcept -> xtd::string
Translates a string into the specified lganguage.
Definition translator.hpp:103
static auto system_language() -> xtd::string
Gets the current system language.
static auto exists(const xtd::string &path) -> bool
Determines whether the given path refers to an existing directory on disk.
static auto combine(const xtd::string &path1, const xtd::string &path2) -> xtd::string
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:26
Contains xtd::globalization::translator suffixes.
Contains classes that define culture-related information, including language, country/region,...
Definition culture_info.hpp:20
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 alias.