mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 07:17:42 -05:00
Merge commit godotengine/godot@8004c7524f
This commit is contained in:
@@ -125,7 +125,7 @@ String TranslationDomain::_double_vowels(const String &p_message) const {
|
||||
}
|
||||
}
|
||||
return res;
|
||||
};
|
||||
}
|
||||
|
||||
String TranslationDomain::_replace_with_accented_string(const String &p_message) const {
|
||||
String res;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "core/crypto/crypto_core.h"
|
||||
#include "core/math/color.h"
|
||||
#include "core/math/math_funcs.h"
|
||||
#include "core/object/object.h"
|
||||
#include "core/os/memory.h"
|
||||
#include "core/string/print_string.h"
|
||||
#include "core/string/string_name.h"
|
||||
@@ -4066,8 +4067,18 @@ String String::format(const Variant &values, const String &placeholder) const {
|
||||
for (const Variant &key : keys) {
|
||||
new_string = new_string.replace(placeholder.replace("_", key), d[key]);
|
||||
}
|
||||
} else if (values.get_type() == Variant::OBJECT) {
|
||||
Object *obj = values.get_validated_object();
|
||||
ERR_FAIL_NULL_V(obj, new_string);
|
||||
|
||||
List<PropertyInfo> props;
|
||||
obj->get_property_list(&props);
|
||||
|
||||
for (const PropertyInfo &E : props) {
|
||||
new_string = new_string.replace(placeholder.replace("_", E.name), obj->get(E.name));
|
||||
}
|
||||
} else {
|
||||
ERR_PRINT(String("Invalid type: use Array or Dictionary.").ascii().get_data());
|
||||
ERR_PRINT(String("Invalid type: use Array, Dictionary or Object.").ascii().get_data());
|
||||
}
|
||||
|
||||
return new_string;
|
||||
|
||||
@@ -120,7 +120,7 @@ public:
|
||||
Char16String &operator+=(char16_t p_char);
|
||||
int length() const { return size() ? size() - 1 : 0; }
|
||||
const char16_t *get_data() const;
|
||||
operator const char16_t *() const { return get_data(); };
|
||||
operator const char16_t *() const { return get_data(); }
|
||||
|
||||
protected:
|
||||
void copy_from(const char16_t *p_cstr);
|
||||
@@ -162,7 +162,7 @@ public:
|
||||
CharString &operator+=(char p_char);
|
||||
int length() const { return size() ? size() - 1 : 0; }
|
||||
const char *get_data() const;
|
||||
operator const char *() const { return get_data(); };
|
||||
operator const char *() const { return get_data(); }
|
||||
|
||||
protected:
|
||||
void copy_from(const char *p_cstr);
|
||||
|
||||
Reference in New Issue
Block a user