Merge pull request #56914 from Chaosus/shader_error_translation
This commit is contained in:
commit
69a9eb3b61
File diff suppressed because it is too large
Load Diff
@ -945,6 +945,26 @@ private:
|
|||||||
error_str = p_str;
|
error_str = p_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _set_expected_error(const String &p_what) {
|
||||||
|
_set_error(vformat(RTR("Expected a '%s'."), p_what));
|
||||||
|
}
|
||||||
|
|
||||||
|
void _set_expected_error(const String &p_first, const String p_second) {
|
||||||
|
_set_error(vformat(RTR("Expected a '%s' or '%s'."), p_first, p_second));
|
||||||
|
}
|
||||||
|
|
||||||
|
void _set_expected_after_error(const String &p_what, const String &p_after) {
|
||||||
|
_set_error(vformat(RTR("Expected a '%s' after '%s'."), p_what, p_after));
|
||||||
|
}
|
||||||
|
|
||||||
|
void _set_redefinition_error(const String &p_what) {
|
||||||
|
_set_error(vformat(RTR("Redefinition of '%s'."), p_what));
|
||||||
|
}
|
||||||
|
|
||||||
|
void _set_parsing_error() {
|
||||||
|
_set_error("Parser bug.");
|
||||||
|
}
|
||||||
|
|
||||||
static const char *token_names[TK_MAX];
|
static const char *token_names[TK_MAX];
|
||||||
|
|
||||||
Token _make_token(TokenType p_type, const StringName &p_text = StringName());
|
Token _make_token(TokenType p_type, const StringName &p_text = StringName());
|
||||||
|
@ -48,23 +48,23 @@ const StringName &ShaderWarning::get_subject() const {
|
|||||||
String ShaderWarning::get_message() const {
|
String ShaderWarning::get_message() const {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case FLOAT_COMPARISON:
|
case FLOAT_COMPARISON:
|
||||||
return vformat("Direct floating-point comparison (this may not evaluate to `true` as you expect). Instead, use `abs(a - b) < 0.0001` for an approximate but predictable comparison.");
|
return vformat(RTR("Direct floating-point comparison (this may not evaluate to `true` as you expect). Instead, use `abs(a - b) < 0.0001` for an approximate but predictable comparison."));
|
||||||
case UNUSED_CONSTANT:
|
case UNUSED_CONSTANT:
|
||||||
return vformat("The const '%s' is declared but never used.", subject);
|
return vformat(RTR("The const '%s' is declared but never used."), subject);
|
||||||
case UNUSED_FUNCTION:
|
case UNUSED_FUNCTION:
|
||||||
return vformat("The function '%s' is declared but never used.", subject);
|
return vformat(RTR("The function '%s' is declared but never used."), subject);
|
||||||
case UNUSED_STRUCT:
|
case UNUSED_STRUCT:
|
||||||
return vformat("The struct '%s' is declared but never used.", subject);
|
return vformat(RTR("The struct '%s' is declared but never used."), subject);
|
||||||
case UNUSED_UNIFORM:
|
case UNUSED_UNIFORM:
|
||||||
return vformat("The uniform '%s' is declared but never used.", subject);
|
return vformat(RTR("The uniform '%s' is declared but never used."), subject);
|
||||||
case UNUSED_VARYING:
|
case UNUSED_VARYING:
|
||||||
return vformat("The varying '%s' is declared but never used.", subject);
|
return vformat(RTR("The varying '%s' is declared but never used."), subject);
|
||||||
case UNUSED_LOCAL_VARIABLE:
|
case UNUSED_LOCAL_VARIABLE:
|
||||||
return vformat("The local variable '%s' is declared but never used.", subject);
|
return vformat(RTR("The local variable '%s' is declared but never used."), subject);
|
||||||
case FORMATTING_ERROR:
|
case FORMATTING_ERROR:
|
||||||
return subject;
|
return subject;
|
||||||
case DEVICE_LIMIT_EXCEEDED:
|
case DEVICE_LIMIT_EXCEEDED:
|
||||||
return vformat("The total size of the %s for this shader on this device has been exceeded (%s/%s). The shader may not work correctly.", subject, (int)extra_args[0], (int)extra_args[1]);
|
return vformat(RTR("The total size of the %s for this shader on this device has been exceeded (%d/%d). The shader may not work correctly."), subject, (int)extra_args[0], (int)extra_args[1]);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user