Add translation links to shader errors
This commit is contained in:
parent
8b8e858778
commit
e0304f83e7
3 changed files with 354 additions and 329 deletions
File diff suppressed because it is too large
Load diff
|
@ -945,6 +945,26 @@ private:
|
|||
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];
|
||||
|
||||
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 {
|
||||
switch (code) {
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
return subject;
|
||||
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:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue