mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Merge pull request #112415 from timothyqiu/project-name-localized
Allow localizing the application name with project translations
This commit is contained in:
commit
9ac55bcc7f
12 changed files with 100 additions and 57 deletions
|
|
@ -1633,7 +1633,7 @@ ProjectSettings::ProjectSettings() {
|
|||
#endif
|
||||
|
||||
GLOBAL_DEF_BASIC("application/config/name", "");
|
||||
GLOBAL_DEF_BASIC(PropertyInfo(Variant::DICTIONARY, "application/config/name_localized", PROPERTY_HINT_LOCALIZABLE_STRING), Dictionary());
|
||||
GLOBAL_DEF(PropertyInfo(Variant::DICTIONARY, "application/config/name_localized", PROPERTY_HINT_LOCALIZABLE_STRING), Dictionary());
|
||||
GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "application/config/description", PROPERTY_HINT_MULTILINE_TEXT), "");
|
||||
GLOBAL_DEF_BASIC("application/config/version", "");
|
||||
GLOBAL_DEF_INTERNAL(PropertyInfo(Variant::STRING, "application/config/tags"), PackedStringArray());
|
||||
|
|
|
|||
|
|
@ -611,7 +611,10 @@ void TranslationServer::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::Type::BOOL, "pseudolocalization_enabled"), "set_pseudolocalization_enabled", "is_pseudolocalization_enabled");
|
||||
}
|
||||
|
||||
void TranslationServer::load_translations() {
|
||||
void TranslationServer::load_project_translations(Ref<TranslationDomain> p_domain) {
|
||||
DEV_ASSERT(p_domain.is_valid());
|
||||
|
||||
p_domain->clear();
|
||||
const String prop = "internationalization/locale/translations";
|
||||
if (!ProjectSettings::get_singleton()->has_setting(prop)) {
|
||||
return;
|
||||
|
|
@ -620,7 +623,7 @@ void TranslationServer::load_translations() {
|
|||
for (const String &path : translations) {
|
||||
Ref<Translation> tr = ResourceLoader::load(path);
|
||||
if (tr.is_valid()) {
|
||||
add_translation(tr);
|
||||
p_domain->add_translation(tr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ public:
|
|||
|
||||
void clear();
|
||||
|
||||
void load_translations();
|
||||
void load_project_translations(Ref<TranslationDomain> p_domain);
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
virtual void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const override;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue