From: Rico Tzschichholz Date: Fri, 20 Apr 2018 13:17:50 +0000 (+0200) Subject: vala: Mark Report.error/warning strings as translatable X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eaae7d51136a5435987e87f2da583f5f607ffc39;p=thirdparty%2Fvala.git vala: Mark Report.error/warning strings as translatable --- diff --git a/vala/valaaddressofexpression.vala b/vala/valaaddressofexpression.vala index 4948a46c2..9bf8d68fd 100644 --- a/vala/valaaddressofexpression.vala +++ b/vala/valaaddressofexpression.vala @@ -101,7 +101,7 @@ public class Vala.AddressofExpression : Expression { // address of element of regular array or pointer is always possible } else { error = true; - Report.error (source_reference, "Address-of operator not supported for this expression"); + Report.error (source_reference, _("Address-of operator not supported for this expression")); return false; } diff --git a/vala/valaarraycreationexpression.vala b/vala/valaarraycreationexpression.vala index b792c3acb..cd7fea0b3 100644 --- a/vala/valaarraycreationexpression.vala +++ b/vala/valaarraycreationexpression.vala @@ -204,7 +204,7 @@ public class Vala.ArrayCreationExpression : Expression { if (rank == 1) { il.error = true; e.error = true; - Report.error (e.source_reference, "Expected array element, got array initializer list"); + Report.error (e.source_reference, _("Expected array element, got array initializer list")); return -1; } int size = create_sizes_from_initializer_list (context, (InitializerList) e, rank - 1, sl); @@ -213,7 +213,7 @@ public class Vala.ArrayCreationExpression : Expression { } if (subsize >= 0 && subsize != size) { il.error = true; - Report.error (il.source_reference, "Expected initializer list of size %d, got size %d".printf (subsize, size)); + Report.error (il.source_reference, _("Expected initializer list of size %d, got size %d").printf (subsize, size)); return -1; } else { subsize = size; @@ -222,7 +222,7 @@ public class Vala.ArrayCreationExpression : Expression { if (rank != 1) { il.error = true; e.error = true; - Report.error (e.source_reference, "Expected array initializer list, got array element"); + Report.error (e.source_reference, _("Expected array initializer list, got array element")); return -1; } } @@ -277,7 +277,7 @@ public class Vala.ArrayCreationExpression : Expression { error = true; var actual_type = new ArrayType (element_type, calc_sizes.size, source_reference); ((ArrayType) actual_type).length_type = length_type; - Report.error (initlist.source_reference, "Expected initializer for `%s' but got `%s'".printf (target_type.to_string (), actual_type.to_string ())); + Report.error (initlist.source_reference, _("Expected initializer for `%s' but got `%s'").printf (target_type.to_string (), actual_type.to_string ())); } } @@ -289,7 +289,7 @@ public class Vala.ArrayCreationExpression : Expression { return false; } else if (!(e.value_type is IntegerType || e.value_type is EnumValueType)) { error = true; - Report.error (e.source_reference, "Expression of integer type expected"); + Report.error (e.source_reference, _("Expression of integer type expected")); } } } else { @@ -316,7 +316,7 @@ public class Vala.ArrayCreationExpression : Expression { /* try to construct the type of the array */ if (element_type == null) { error = true; - Report.error (source_reference, "Cannot determine the element type of the created array"); + Report.error (source_reference, _("Cannot determine the element type of the created array")); return false; } diff --git a/vala/valaarraytype.vala b/vala/valaarraytype.vala index 84522ca4c..23292ef79 100644 --- a/vala/valaarraytype.vala +++ b/vala/valaarraytype.vala @@ -276,7 +276,7 @@ public class Vala.ArrayType : ReferenceType { public override bool check (CodeContext context) { if (invalid_syntax) { - Report.error (source_reference, "syntax error, no expression allowed between array brackets"); + Report.error (source_reference, _("syntax error, no expression allowed between array brackets")); error = true; return false; } @@ -285,18 +285,18 @@ public class Vala.ArrayType : ReferenceType { length.check (context); if (length.value_type == null || !(length.value_type is IntegerType) || !length.is_constant ()) { - Report.error (length.source_reference, "Expression of constant integer type expected"); + Report.error (length.source_reference, _("Expression of constant integer type expected")); return false; } } if (element_type is ArrayType) { - Report.error (source_reference, "Stacked arrays are not supported"); + Report.error (source_reference, _("Stacked arrays are not supported")); return false; } else if (element_type is DelegateType) { var delegate_type = (DelegateType) element_type; if (delegate_type.delegate_symbol.has_target) { - Report.error (source_reference, "Delegates with target are not supported as array element type"); + Report.error (source_reference, _("Delegates with target are not supported as array element type")); return false; } } diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala index 0b6fbc9ad..7587098c5 100644 --- a/vala/valaassignment.vala +++ b/vala/valaassignment.vala @@ -160,19 +160,19 @@ public class Vala.Assignment : Expression { if (ma.symbol_reference is Constant) { error = true; - Report.error (source_reference, "Assignment to constant after initialization"); + Report.error (source_reference, _("Assignment to constant after initialization")); return false; } if ((!(ma.symbol_reference is DynamicProperty) && ma.value_type == null) || (ma.inner == null && ma.member_name == "this" && context.analyzer.is_in_instance_method ())) { error = true; - Report.error (source_reference, "unsupported lvalue in assignment"); + Report.error (source_reference, _("unsupported lvalue in assignment")); return false; } if (ma.prototype_access) { error = true; - Report.error (source_reference, "Access to instance member `%s' denied".printf (ma.symbol_reference.get_full_name ())); + Report.error (source_reference, _("Access to instance member `%s' denied").printf (ma.symbol_reference.get_full_name ())); return false; } @@ -193,7 +193,7 @@ public class Vala.Assignment : Expression { if (ea.container.value_type.data_type == context.analyzer.string_type.data_type) { error = true; - Report.error (ea.source_reference, "strings are immutable"); + Report.error (ea.source_reference, _("strings are immutable")); return false; } else if (ea.container.value_type.get_member ("set") is Method) { var set_call = new MethodCall (new MemberAccess (ea.container, "set", source_reference), source_reference); @@ -214,7 +214,7 @@ public class Vala.Assignment : Expression { return false; } else { error = true; - Report.error (source_reference, "unsupported lvalue in assignment"); + Report.error (source_reference, _("unsupported lvalue in assignment")); return false; } @@ -275,17 +275,17 @@ public class Vala.Assignment : Expression { if (prop.set_accessor == null || (!prop.set_accessor.writable && !(context.analyzer.find_current_method () is CreationMethod || context.analyzer.is_in_constructor ()))) { ma.error = true; - Report.error (ma.source_reference, "Property `%s' is read-only".printf (prop.get_full_name ())); + Report.error (ma.source_reference, _("Property `%s' is read-only").printf (prop.get_full_name ())); return false; } else if (!context.deprecated && !prop.set_accessor.writable && context.analyzer.find_current_method () is CreationMethod) { if (ma.inner.symbol_reference != context.analyzer.find_current_method ().this_parameter) { // trying to set construct-only property in creation method for foreign instance - Report.error (ma.source_reference, "Property `%s' is read-only".printf (prop.get_full_name ())); + Report.error (ma.source_reference, _("Property `%s' is read-only").printf (prop.get_full_name ())); return false; } else { - Report.error (ma.source_reference, "Cannot assign to construct-only properties, use Object (property: value) constructor chain up"); + Report.error (ma.source_reference, _("Cannot assign to construct-only properties, use Object (property: value) constructor chain up")); return false; } } @@ -301,14 +301,14 @@ public class Vala.Assignment : Expression { /* check whether method matches callback type */ if (!cb.matches_method (m, dt)) { error = true; - Report.error (source_reference, "declaration of method `%s' doesn't match declaration of callback `%s'".printf (m.get_full_name (), cb.get_full_name ())); + Report.error (source_reference, _("declaration of method `%s' doesn't match declaration of callback `%s'").printf (m.get_full_name (), cb.get_full_name ())); return false; } right.value_type = variable.variable_type.copy (); } else { error = true; - Report.error (source_reference, "Assignment: Invalid assignment attempt"); + Report.error (source_reference, _("Assignment: Invalid assignment attempt")); return false; } } else if (ma.symbol_reference is Variable) { @@ -328,7 +328,7 @@ public class Vala.Assignment : Expression { if (!right.value_type.compatible (left.value_type)) { error = true; - Report.error (source_reference, "Assignment: Cannot convert from `%s' to `%s'".printf (right.value_type.to_string (), left.value_type.to_string ())); + Report.error (source_reference, _("Assignment: Cannot convert from `%s' to `%s'").printf (right.value_type.to_string (), left.value_type.to_string ())); return false; } @@ -338,7 +338,7 @@ public class Vala.Assignment : Expression { if (!(left.value_type is PointerType) && !left.value_type.value_owned) { /* lhs doesn't own the value */ error = true; - Report.error (source_reference, "Invalid assignment from owned expression to unowned variable"); + Report.error (source_reference, _("Invalid assignment from owned expression to unowned variable")); } } else if (left.value_type.value_owned) { /* lhs wants to own the value @@ -352,17 +352,17 @@ public class Vala.Assignment : Expression { var right_ma = right as MemberAccess; if (right_ma != null && ma.symbol_reference == right_ma.symbol_reference) { if (ma.symbol_reference is LocalVariable || ma.symbol_reference is Parameter) { - Report.warning (source_reference, "Assignment to same variable"); + Report.warning (source_reference, _("Assignment to same variable")); } else if (ma.symbol_reference is Field) { var f = (Field) ma.symbol_reference; if (f.binding == MemberBinding.STATIC) { - Report.warning (source_reference, "Assignment to same variable"); + Report.warning (source_reference, _("Assignment to same variable")); } else { var ma_inner = ma.inner as MemberAccess; var right_ma_inner = right_ma.inner as MemberAccess; if (ma_inner != null && ma_inner.member_name == "this" && ma_inner.inner == null && right_ma_inner != null && right_ma_inner.member_name == "this" && right_ma_inner.inner == null) { - Report.warning (source_reference, "Assignment to same variable"); + Report.warning (source_reference, _("Assignment to same variable")); } } } @@ -372,7 +372,7 @@ public class Vala.Assignment : Expression { if (!right.value_type.compatible (left.value_type)) { error = true; - Report.error (source_reference, "Assignment: Cannot convert from `%s' to `%s'".printf (right.value_type.to_string (), left.value_type.to_string ())); + Report.error (source_reference, _("Assignment: Cannot convert from `%s' to `%s'").printf (right.value_type.to_string (), left.value_type.to_string ())); return false; } @@ -393,7 +393,7 @@ public class Vala.Assignment : Expression { if (!(element_type is PointerType) && !element_type.value_owned) { /* lhs doesn't own the value */ error = true; - Report.error (source_reference, "Invalid assignment from owned expression to unowned variable"); + Report.error (source_reference, _("Invalid assignment from owned expression to unowned variable")); return false; } } else if (left.value_type.value_owned) { diff --git a/vala/valabaseaccess.vala b/vala/valabaseaccess.vala index 955233bdc..5531524d3 100644 --- a/vala/valabaseaccess.vala +++ b/vala/valabaseaccess.vala @@ -58,33 +58,33 @@ public class Vala.BaseAccess : Expression { if (!context.analyzer.is_in_instance_method ()) { error = true; - Report.error (source_reference, "Base access invalid outside of instance methods"); + Report.error (source_reference, _("Base access invalid outside of instance methods")); return false; } if (context.analyzer.current_class == null) { if (context.analyzer.current_struct == null) { error = true; - Report.error (source_reference, "Base access invalid outside of class and struct"); + Report.error (source_reference, _("Base access invalid outside of class and struct")); return false; } else if (context.analyzer.current_struct.base_type == null) { error = true; - Report.error (source_reference, "Base access invalid without base type"); + Report.error (source_reference, _("Base access invalid without base type")); return false; } value_type = context.analyzer.current_struct.base_type; } else if (context.analyzer.current_class.base_class == null) { error = true; - Report.error (source_reference, "Base access invalid without base class"); + Report.error (source_reference, _("Base access invalid without base class")); return false; } else if (context.analyzer.current_class.is_compact && context.analyzer.current_method != null && !(context.analyzer.current_method is CreationMethod)) { error = true; - Report.error (source_reference, "Base access invalid in virtual overridden method of compact class"); + Report.error (source_reference, _("Base access invalid in virtual overridden method of compact class")); return false; } else if (context.analyzer.current_class.is_compact && context.analyzer.current_property_accessor != null) { error = true; - Report.error (source_reference, "Base access invalid in virtual overridden property of compact class"); + Report.error (source_reference, _("Base access invalid in virtual overridden property of compact class")); return false; } else { foreach (var base_type in context.analyzer.current_class.get_base_types ()) { diff --git a/vala/valabinaryexpression.vala b/vala/valabinaryexpression.vala index 0dd61b6c1..3dd69b2e8 100644 --- a/vala/valabinaryexpression.vala +++ b/vala/valabinaryexpression.vala @@ -202,7 +202,7 @@ public class Vala.BinaryExpression : Expression { DataType local_type = null; bool cast_non_null = false; if (left.value_type is NullType && right.value_type != null) { - Report.warning (left.source_reference, "left operand is always null"); + Report.warning (left.source_reference, _("left operand is always null")); local_type = right.value_type.copy (); local_type.nullable = true; if (!right.value_type.nullable) { @@ -216,7 +216,7 @@ public class Vala.BinaryExpression : Expression { } if (context.experimental_non_null) { if (!local_type.nullable) { - Report.warning (left.source_reference, "left operand is never null"); + Report.warning (left.source_reference, _("left operand is never null")); if (right.value_type != null && right.value_type.nullable) { local_type.nullable = true; cast_non_null = true; @@ -295,25 +295,25 @@ public class Vala.BinaryExpression : Expression { } if (left.value_type == null) { - Report.error (left.source_reference, "invalid left operand"); + Report.error (left.source_reference, _("invalid left operand")); error = true; return false; } if (operator != BinaryOperator.IN && right.value_type == null) { - Report.error (right.source_reference, "invalid right operand"); + Report.error (right.source_reference, _("invalid right operand")); error = true; return false; } if (left.value_type is FieldPrototype || left.value_type is PropertyPrototype) { error = true; - Report.error (left.source_reference, "Access to instance member `%s' denied".printf (left.symbol_reference.get_full_name ())); + Report.error (left.source_reference, _("Access to instance member `%s' denied").printf (left.symbol_reference.get_full_name ())); return false; } if (right.value_type is FieldPrototype || right.value_type is PropertyPrototype) { error = true; - Report.error (right.source_reference, "Access to instance member `%s' denied".printf (right.symbol_reference.get_full_name ())); + Report.error (right.source_reference, _("Access to instance member `%s' denied").printf (right.symbol_reference.get_full_name ())); return false; } @@ -328,7 +328,7 @@ public class Vala.BinaryExpression : Expression { if (right.value_type == null || right.value_type.data_type != context.analyzer.string_type.data_type) { error = true; - Report.error (source_reference, "Operands must be strings"); + Report.error (source_reference, _("Operands must be strings")); return false; } @@ -345,7 +345,7 @@ public class Vala.BinaryExpression : Expression { if (right.value_type == null || !right.value_type.compatible (array_type.element_type)) { error = true; - Report.error (source_reference, "Incompatible operand"); + Report.error (source_reference, _("Incompatible operand")); return false; } @@ -362,7 +362,7 @@ public class Vala.BinaryExpression : Expression { var pointer_type = (PointerType) left.value_type; if (pointer_type.base_type is VoidType) { error = true; - Report.error (source_reference, "Pointer arithmetic not supported for `void*'"); + Report.error (source_reference, _("Pointer arithmetic not supported for `void*'")); return false; } @@ -388,7 +388,7 @@ public class Vala.BinaryExpression : Expression { if (value_type == null) { error = true; - Report.error (source_reference, "Arithmetic operation not supported for types `%s' and `%s'".printf (left.value_type.to_string (), right.value_type.to_string ())); + Report.error (source_reference, _("Arithmetic operation not supported for types `%s' and `%s'").printf (left.value_type.to_string (), right.value_type.to_string ())); return false; } } else if (operator == BinaryOperator.MOD @@ -401,7 +401,7 @@ public class Vala.BinaryExpression : Expression { if (value_type == null) { error = true; - Report.error (source_reference, "Arithmetic operation not supported for types `%s' and `%s'".printf (left.value_type.to_string (), right.value_type.to_string ())); + Report.error (source_reference, _("Arithmetic operation not supported for types `%s' and `%s'").printf (left.value_type.to_string (), right.value_type.to_string ())); return false; } } else if (operator == BinaryOperator.LESS_THAN @@ -425,7 +425,7 @@ public class Vala.BinaryExpression : Expression { if (resulting_type == null) { error = true; - Report.error (source_reference, "Relational operation not supported for types `%s' and `%s'".printf (left.value_type.to_string (), right.value_type.to_string ())); + Report.error (source_reference, _("Relational operation not supported for types `%s' and `%s'").printf (left.value_type.to_string (), right.value_type.to_string ())); return false; } @@ -444,7 +444,7 @@ public class Vala.BinaryExpression : Expression { if (!right.value_type.compatible (left.value_type) && !left.value_type.compatible (right.value_type)) { - Report.error (source_reference, "Equality operation: `%s' and `%s' are incompatible".printf (right.value_type.to_string (), left.value_type.to_string ())); + Report.error (source_reference, _("Equality operation: `%s' and `%s' are incompatible").printf (right.value_type.to_string (), left.value_type.to_string ())); error = true; return false; } @@ -481,7 +481,7 @@ public class Vala.BinaryExpression : Expression { || operator == BinaryOperator.OR) { if (!left.value_type.compatible (context.analyzer.bool_type) || !right.value_type.compatible (context.analyzer.bool_type)) { error = true; - Report.error (source_reference, "Operands must be boolean"); + Report.error (source_reference, _("Operands must be boolean")); } left.target_type.nullable = false; right.target_type.nullable = false; @@ -495,23 +495,23 @@ public class Vala.BinaryExpression : Expression { right.target_type.nullable = false; } else if (right.value_type is ArrayType) { if (!left.value_type.compatible (((ArrayType) right.value_type).element_type)) { - Report.error (source_reference, "Cannot look for `%s' in `%s'".printf (left.value_type.to_string (), right.value_type.to_string ())); + Report.error (source_reference, _("Cannot look for `%s' in `%s'").printf (left.value_type.to_string (), right.value_type.to_string ())); } } else { // otherwise require a bool contains () method var contains_method = right.value_type.get_member ("contains") as Method; if (contains_method == null) { - Report.error (source_reference, "`%s' does not have a `contains' method".printf (right.value_type.to_string ())); + Report.error (source_reference, _("`%s' does not have a `contains' method").printf (right.value_type.to_string ())); error = true; return false; } if (contains_method.get_parameters ().size != 1) { - Report.error (source_reference, "`%s' must have one parameter".printf (contains_method.get_full_name ())); + Report.error (source_reference, _("`%s' must have one parameter").printf (contains_method.get_full_name ())); error = true; return false; } if (!contains_method.return_type.compatible (context.analyzer.bool_type)) { - Report.error (source_reference, "`%s' must return a boolean value".printf (contains_method.get_full_name ())); + Report.error (source_reference, _("`%s' must return a boolean value").printf (contains_method.get_full_name ())); error = true; return false; } diff --git a/vala/valablock.vala b/vala/valablock.vala index 7419b5b9d..40778b976 100644 --- a/vala/valablock.vala +++ b/vala/valablock.vala @@ -91,7 +91,7 @@ public class Vala.Block : Symbol, Statement { var parent_block = parent_symbol; while (parent_block is Block || parent_block is Method || parent_block is PropertyAccessor) { if (parent_block.scope.lookup (local.name) != null) { - Report.error (local.source_reference, "Local variable `%s' conflicts with a local variable or constant declared in a parent scope".printf (local.name)); + Report.error (local.source_reference, _("Local variable `%s' conflicts with a local variable or constant declared in a parent scope").printf (local.name)); break; } parent_block = parent_block.parent_symbol; @@ -116,7 +116,7 @@ public class Vala.Block : Symbol, Statement { var parent_block = parent_symbol; while (parent_block is Block || parent_block is Method || parent_block is PropertyAccessor) { if (parent_block.scope.lookup (constant.name) != null) { - Report.error (constant.source_reference, "Local constant `%s' conflicts with a local variable or constant declared in a parent scope".printf (constant.name)); + Report.error (constant.source_reference, _("Local constant `%s' conflicts with a local variable or constant declared in a parent scope").printf (constant.name)); break; } parent_block = parent_block.parent_symbol; diff --git a/vala/valacastexpression.vala b/vala/valacastexpression.vala index 1dc357764..d680546ee 100644 --- a/vala/valacastexpression.vala +++ b/vala/valacastexpression.vala @@ -149,7 +149,7 @@ public class Vala.CastExpression : Expression { } if (inner.value_type == null) { - Report.error (source_reference, "Invalid cast expression"); + Report.error (source_reference, _("Invalid cast expression")); error = true; return false; } diff --git a/vala/valacatchclause.vala b/vala/valacatchclause.vala index 1ff942116..ad93257c9 100644 --- a/vala/valacatchclause.vala +++ b/vala/valacatchclause.vala @@ -117,14 +117,14 @@ public class Vala.CatchClause : CodeNode { checked = true; if (context.profile == Profile.POSIX) { - Report.error (source_reference, "`catch' is not supported in POSIX profile"); + Report.error (source_reference, _("`catch' is not supported in POSIX profile")); error = true; return false; } if (error_type != null) { if (!(error_type is ErrorType)) { - Report.error (source_reference, "clause must catch a valid error type, found `%s' instead".printf (error_type.to_string ())); + Report.error (source_reference, _("clause must catch a valid error type, found `%s' instead").printf (error_type.to_string ())); error = true; } diff --git a/vala/valaclass.vala b/vala/valaclass.vala index 51e8fbade..0a81b29e9 100644 --- a/vala/valaclass.vala +++ b/vala/valaclass.vala @@ -292,7 +292,7 @@ public class Vala.Class : ObjectTypeSymbol { var cm = (CreationMethod) m; if (cm.class_name != null && cm.class_name != name) { // class_name is null for constructors generated by GIdlParser - Report.error (m.source_reference, "missing return type in method `%s.%s´".printf (get_full_name (), cm.class_name)); + Report.error (m.source_reference, _("missing return type in method `%s.%s´").printf (get_full_name (), cm.class_name)); m.error = true; return; } @@ -325,19 +325,19 @@ public class Vala.Class : ObjectTypeSymbol { switch (c.binding) { case MemberBinding.INSTANCE: if (constructor != null) { - Report.error (c.source_reference, "class already contains a constructor"); + Report.error (c.source_reference, _("class already contains a constructor")); } constructor = c; break; case MemberBinding.CLASS: if (class_constructor != null) { - Report.error (c.source_reference, "class already contains a class constructor"); + Report.error (c.source_reference, _("class already contains a class constructor")); } class_constructor = c; break; case MemberBinding.STATIC: if (static_constructor != null) { - Report.error (c.source_reference, "class already contains a static constructor"); + Report.error (c.source_reference, _("class already contains a static constructor")); } static_constructor = c; break; @@ -350,19 +350,19 @@ public class Vala.Class : ObjectTypeSymbol { switch (d.binding) { case MemberBinding.INSTANCE: if (destructor != null) { - Report.error (d.source_reference, "class already contains a destructor"); + Report.error (d.source_reference, _("class already contains a destructor")); } destructor = d; break; case MemberBinding.CLASS: if (class_destructor != null) { - Report.error (d.source_reference, "class already contains a class destructor"); + Report.error (d.source_reference, _("class already contains a class destructor")); } class_destructor = d; break; case MemberBinding.STATIC: if (static_destructor != null) { - Report.error (d.source_reference, "class already contains a static destructor"); + Report.error (d.source_reference, _("class already contains a static destructor")); } static_destructor = d; break; @@ -538,14 +538,14 @@ public class Vala.Class : ObjectTypeSymbol { if (!(base_type_reference is ObjectType)) { error = true; - Report.error (source_reference, "base type `%s' of class `%s' is not an object type".printf (base_type_reference.to_string (), get_full_name ())); + Report.error (source_reference, _("base type `%s' of class `%s' is not an object type").printf (base_type_reference.to_string (), get_full_name ())); return false; } // check whether base type is at least as accessible as the class if (!context.analyzer.is_type_accessible (this, base_type_reference)) { error = true; - Report.error (source_reference, "base type `%s' is less accessible than class `%s'".printf (base_type_reference.to_string (), get_full_name ())); + Report.error (source_reference, _("base type `%s' is less accessible than class `%s'").printf (base_type_reference.to_string (), get_full_name ())); return false; } @@ -553,11 +553,11 @@ public class Vala.Class : ObjectTypeSymbol { int n_type_params = ((ObjectTypeSymbol) base_type_reference.data_type).get_type_parameters ().size; if (n_type_args < n_type_params) { error = true; - Report.error (base_type_reference.source_reference, "too few type arguments"); + Report.error (base_type_reference.source_reference, _("too few type arguments")); return false; } else if (n_type_args > n_type_params) { error = true; - Report.error (base_type_reference.source_reference, "too many type arguments"); + Report.error (base_type_reference.source_reference, _("too many type arguments")); return false; } } @@ -572,12 +572,12 @@ public class Vala.Class : ObjectTypeSymbol { if (base_class != null && base_class.is_singleton) { error = true; - Report.error (source_reference, "`%s' cannot inherit from SingleInstance class `%s'".printf (get_full_name (), base_class.get_full_name ())); + Report.error (source_reference, _("`%s' cannot inherit from SingleInstance class `%s'").printf (get_full_name (), base_class.get_full_name ())); } if (is_singleton && !is_subtype_of (context.analyzer.object_type)) { error = true; - Report.error (source_reference, "SingleInstance class `%s' requires inheritance from `GLib.Object'".printf (get_full_name ())); + Report.error (source_reference, _("SingleInstance class `%s' requires inheritance from `GLib.Object'").printf (get_full_name ())); } /* singleton classes require an instance construtor */ @@ -596,11 +596,11 @@ public class Vala.Class : ObjectTypeSymbol { if (is_compact && f.binding != MemberBinding.STATIC) { //FIXME Should external bindings follow this too? if (!external_package && f.access == SymbolAccessibility.PRIVATE) { - Report.error (source_reference, "private fields are not supported in compact classes"); + Report.error (source_reference, _("private fields are not supported in compact classes")); error = true; } if (f.binding == MemberBinding.CLASS) { - Report.error (f.source_reference, "class fields are not supported in compact classes"); + Report.error (f.source_reference, _("class fields are not supported in compact classes")); error = true; } } @@ -619,7 +619,7 @@ public class Vala.Class : ObjectTypeSymbol { foreach (Property prop in get_properties ()) { if (prop.get_attribute ("NoAccessorMethod") != null && !is_subtype_of (context.analyzer.object_type)) { error = true; - Report.error (prop.source_reference, "NoAccessorMethod is only allowed for properties in classes derived from GLib.Object"); + Report.error (prop.source_reference, _("NoAccessorMethod is only allowed for properties in classes derived from GLib.Object")); return false; } prop.check (context); @@ -670,7 +670,7 @@ public class Vala.Class : ObjectTypeSymbol { foreach (DataType base_type in get_base_types ()) { if (base_type.data_type is Interface) { error = true; - Report.error (source_reference, "compact classes `%s' may not implement interfaces".printf (get_full_name ())); + Report.error (source_reference, _("compact classes `%s' may not implement interfaces").printf (get_full_name ())); } } @@ -678,7 +678,7 @@ public class Vala.Class : ObjectTypeSymbol { foreach (Field f in get_fields ()) { if (f.binding == MemberBinding.INSTANCE) { error = true; - Report.error (source_reference, "derived compact classes may not have instance fields"); + Report.error (source_reference, _("derived compact classes may not have instance fields")); break; } } @@ -758,7 +758,7 @@ public class Vala.Class : ObjectTypeSymbol { } if (!implemented) { error = true; - Report.error (source_reference, "`%s' does not implement interface method `%s'".printf (get_full_name (), m.get_full_name ())); + Report.error (source_reference, _("`%s' does not implement interface method `%s'").printf (get_full_name (), m.get_full_name ())); } } } @@ -778,14 +778,14 @@ public class Vala.Class : ObjectTypeSymbol { // No check at all for "new" classified properties, really? if (!base_prop.hides && !base_prop.compatible (prop, out invalid_match)) { error = true; - Report.error (source_reference, "Type and/or accessors of inherited properties `%s' and `%s' do not match: %s.".printf (prop.get_full_name (), base_prop.get_full_name (), invalid_match)); + Report.error (source_reference, _("Type and/or accessors of inherited properties `%s' and `%s' do not match: %s.").printf (prop.get_full_name (), base_prop.get_full_name (), invalid_match)); } // property is used as interface implementation, so it is not unused sym.version.check (source_reference); sym.used = true; } else { error = true; - Report.error (source_reference, "`%s' does not implement interface property `%s'".printf (get_full_name (), prop.get_full_name ())); + Report.error (source_reference, _("`%s' does not implement interface property `%s'").printf (get_full_name (), prop.get_full_name ())); } } } @@ -801,7 +801,7 @@ public class Vala.Class : ObjectTypeSymbol { var override_method = SemanticAnalyzer.symbol_lookup_inherited (this, base_method.name) as Method; if (override_method == null || !override_method.overrides) { error = true; - Report.error (source_reference, "`%s' does not implement abstract method `%s'".printf (get_full_name (), base_method.get_full_name ())); + Report.error (source_reference, _("`%s' does not implement abstract method `%s'").printf (get_full_name (), base_method.get_full_name ())); } } } @@ -810,7 +810,7 @@ public class Vala.Class : ObjectTypeSymbol { var override_property = SemanticAnalyzer.symbol_lookup_inherited (this, base_property.name) as Property; if (override_property == null || !override_property.overrides) { error = true; - Report.error (source_reference, "`%s' does not implement abstract property `%s'".printf (get_full_name (), base_property.get_full_name ())); + Report.error (source_reference, _("`%s' does not implement abstract property `%s'").printf (get_full_name (), base_property.get_full_name ())); } } } diff --git a/vala/valacodecontext.vala b/vala/valacodecontext.vala index 34543a8d9..692bddff5 100644 --- a/vala/valacodecontext.vala +++ b/vala/valacodecontext.vala @@ -363,7 +363,7 @@ public class Vala.CodeContext { path = get_gir_path (pkg); } if (path == null) { - Report.error (null, "Package `%s' not found in specified Vala API directories or GObject-Introspection GIR directories".printf (pkg)); + Report.error (null, _("Package `%s' not found in specified Vala API directories or GObject-Introspection GIR directories").printf (pkg)); return false; } @@ -405,7 +405,7 @@ public class Vala.CodeContext { } } } catch (FileError e) { - Report.error (null, "Unable to read dependency file: %s".printf (e.message)); + Report.error (null, _("Unable to read dependency file: %s").printf (e.message)); return false; } @@ -423,7 +423,7 @@ public class Vala.CodeContext { */ public bool add_source_filename (string filename, bool is_source = false, bool cmdline = false) { if (!FileUtils.test (filename, FileTest.EXISTS)) { - Report.error (null, "%s not found".printf (filename)); + Report.error (null, _("%s not found").printf (filename)); return false; } @@ -455,7 +455,7 @@ public class Vala.CodeContext { } else if (filename.has_suffix (".h")) { /* Ignore */ } else { - Report.error (null, "%s is not a supported source file type. Only .vala, .vapi, .gs, and .c files are supported.".printf (filename)); + Report.error (null, _("%s is not a supported source file type. Only .vala, .vapi, .gs, and .c files are supported.").printf (filename)); return false; } @@ -662,7 +662,7 @@ public class Vala.CodeContext { var stream = FileStream.open (filename, "w"); if (stream == null) { - Report.error (null, "unable to open `%s' for writing".printf (filename)); + Report.error (null, _("unable to open `%s' for writing").printf (filename)); return; } @@ -802,7 +802,7 @@ public class Vala.CodeContext { try { Process.spawn_command_line_sync (pc, out output, null, out exit_status); if (exit_status != 0) { - Report.error (null, "%s exited with status %d".printf (pkg_config_command, exit_status)); + Report.error (null, _("%s exited with status %d").printf (pkg_config_command, exit_status)); return null; } } catch (SpawnError e) { diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala index f3967a15c..1ba7c6379 100644 --- a/vala/valacodewriter.vala +++ b/vala/valacodewriter.vala @@ -79,7 +79,7 @@ public class Vala.CodeWriter : CodeVisitor { } if (stream == null) { - Report.error (null, "unable to open `%s' for writing".printf (filename)); + Report.error (null, _("unable to open `%s' for writing").printf (filename)); return; } @@ -169,7 +169,7 @@ public class Vala.CodeWriter : CodeVisitor { first = false; first_reference = comment.source_reference; } else { - Report.warning (comment.source_reference, "Comment describes namespace, that was already described by another comment."); + Report.warning (comment.source_reference, _("Comment describes namespace, that was already described by another comment.")); Report.notice (first_reference, "Previous comment was here."); } } diff --git a/vala/valaconditionalexpression.vala b/vala/valaconditionalexpression.vala index 3395dd56f..8f43ad005 100644 --- a/vala/valaconditionalexpression.vala +++ b/vala/valaconditionalexpression.vala @@ -146,7 +146,7 @@ public class Vala.ConditionalExpression : Expression { checked = true; if (!(context.analyzer.current_symbol is Block)) { - Report.error (source_reference, "Conditional expressions may only be used in blocks"); + Report.error (source_reference, _("Conditional expressions may only be used in blocks")); error = true; return false; } @@ -194,7 +194,7 @@ public class Vala.ConditionalExpression : Expression { value_type = false_expression.value_type.copy (); } else { error = true; - Report.error (condition.source_reference, "Incompatible expressions"); + Report.error (condition.source_reference, _("Incompatible expressions")); return false; } diff --git a/vala/valaconstant.vala b/vala/valaconstant.vala index 0a9266cf1..c53f5852f 100644 --- a/vala/valaconstant.vala +++ b/vala/valaconstant.vala @@ -117,14 +117,14 @@ public class Vala.Constant : Symbol { if (!check_const_type (type_reference, context)) { error = true; - Report.error (source_reference, "`%s' not supported as type for constants".printf (type_reference.to_string ())); + Report.error (source_reference, _("`%s' not supported as type for constants").printf (type_reference.to_string ())); return false; } if (!external) { if (value == null) { error = true; - Report.error (source_reference, "A const field requires a value to be provided"); + Report.error (source_reference, _("A const field requires a value to be provided")); } else { value.target_type = type_reference; @@ -135,7 +135,7 @@ public class Vala.Constant : Symbol { if (!value.value_type.compatible (type_reference)) { error = true; - Report.error (source_reference, "Cannot convert from `%s' to `%s'".printf (value.value_type.to_string (), type_reference.to_string ())); + Report.error (source_reference, _("Cannot convert from `%s' to `%s'").printf (value.value_type.to_string (), type_reference.to_string ())); return false; } @@ -156,19 +156,19 @@ public class Vala.Constant : Symbol { if (!value.is_constant ()) { error = true; - Report.error (value.source_reference, "Value must be constant"); + Report.error (value.source_reference, _("Value must be constant")); return false; } } } else { if (value != null) { error = true; - Report.error (source_reference, "External constants cannot use values"); + Report.error (source_reference, _("External constants cannot use values")); } } if (!external_package && !hides && get_hidden_member () != null) { - Report.warning (source_reference, "%s hides inherited constant `%s'. Use the `new' keyword if hiding was intentional".printf (get_full_name (), get_hidden_member ().get_full_name ())); + Report.warning (source_reference, _("%s hides inherited constant `%s'. Use the `new' keyword if hiding was intentional").printf (get_full_name (), get_hidden_member ().get_full_name ())); } context.analyzer.current_source_file = old_source_file; diff --git a/vala/valaconstructor.vala b/vala/valaconstructor.vala index ae8f19e8d..ad55fe348 100644 --- a/vala/valaconstructor.vala +++ b/vala/valaconstructor.vala @@ -81,7 +81,7 @@ public class Vala.Constructor : Subroutine { body.get_error_types (body_errors); foreach (DataType body_error_type in body_errors) { if (!((ErrorType) body_error_type).dynamic_error) { - Report.warning (body_error_type.source_reference, "unhandled error `%s'".printf (body_error_type.to_string())); + Report.warning (body_error_type.source_reference, _("unhandled error `%s'").printf (body_error_type.to_string())); } } diff --git a/vala/valacreationmethod.vala b/vala/valacreationmethod.vala index ae8daab38..287e7b5a6 100644 --- a/vala/valacreationmethod.vala +++ b/vala/valacreationmethod.vala @@ -88,7 +88,7 @@ public class Vala.CreationMethod : Method { if (class_name != null && class_name != parent_symbol.name) { // class_name is null for constructors generated by GIdlParser - Report.error (source_reference, "missing return type in method `%s.%s´".printf (context.analyzer.current_symbol.get_full_name (), class_name)); + Report.error (source_reference, _("missing return type in method `%s.%s´").printf (context.analyzer.current_symbol.get_full_name (), class_name)); error = true; return false; } @@ -106,7 +106,7 @@ public class Vala.CreationMethod : Method { param.check (context); if (i == 0 && param.ellipsis && body != null) { error = true; - Report.error (param.source_reference, "Named parameter required before `...'"); + Report.error (param.source_reference, _("Named parameter required before `...'")); } i++; } @@ -148,9 +148,9 @@ public class Vala.CreationMethod : Method { context.analyzer.insert_block = old_insert_block; } else if (cl.base_class.default_construction_method == null || cl.base_class.default_construction_method.access == SymbolAccessibility.PRIVATE) { - Report.error (source_reference, "unable to chain up to private base constructor"); + Report.error (source_reference, _("unable to chain up to private base constructor")); } else if (cl.base_class.default_construction_method.get_required_arguments () > 0) { - Report.error (source_reference, "unable to chain up to base constructor requiring arguments"); + Report.error (source_reference, _("unable to chain up to base constructor requiring arguments")); } else { var old_insert_block = context.analyzer.insert_block; context.analyzer.current_symbol = body; @@ -170,7 +170,7 @@ public class Vala.CreationMethod : Method { context.analyzer.current_symbol = old_symbol; if (is_abstract || is_virtual || overrides) { - Report.error (source_reference, "The creation method `%s' cannot be marked as override, virtual, or abstract".printf (get_full_name ())); + Report.error (source_reference, _("The creation method `%s' cannot be marked as override, virtual, or abstract").printf (get_full_name ())); return false; } @@ -188,7 +188,7 @@ public class Vala.CreationMethod : Method { } } if (!can_propagate_error && !((ErrorType) body_error_type).dynamic_error) { - Report.warning (body_error_type.source_reference, "unhandled error `%s'".printf (body_error_type.to_string())); + Report.warning (body_error_type.source_reference, _("unhandled error `%s'").printf (body_error_type.to_string())); } } } diff --git a/vala/valadelegatetype.vala b/vala/valadelegatetype.vala index 73155359d..41be4bf8b 100644 --- a/vala/valadelegatetype.vala +++ b/vala/valadelegatetype.vala @@ -114,7 +114,7 @@ public class Vala.DelegateType : CallableType { public override bool check (CodeContext context) { if (is_called_once && !value_owned) { - Report.warning (source_reference, "delegates with scope=\"async\" must be owned"); + Report.warning (source_reference, _("delegates with scope=\"async\" must be owned")); } if (!delegate_symbol.check (context)) { @@ -124,10 +124,10 @@ public class Vala.DelegateType : CallableType { var n_type_params = delegate_symbol.get_type_parameters ().size; var n_type_args = get_type_arguments ().size; if (n_type_args > 0 && n_type_args < n_type_params) { - Report.error (source_reference, "too few type arguments"); + Report.error (source_reference, _("too few type arguments")); return false; } else if (n_type_args > 0 && n_type_args > n_type_params) { - Report.error (source_reference, "too many type arguments"); + Report.error (source_reference, _("too many type arguments")); return false; } diff --git a/vala/valadeletestatement.vala b/vala/valadeletestatement.vala index ff3ff6891..cbc3d989b 100644 --- a/vala/valadeletestatement.vala +++ b/vala/valadeletestatement.vala @@ -70,7 +70,7 @@ public class Vala.DeleteStatement : CodeNode, Statement { if (!(expression.value_type is PointerType) && !(expression.value_type is ArrayType)) { error = true; - Report.error (source_reference, "delete operator not supported for `%s'".printf (expression.value_type.to_string ())); + Report.error (source_reference, _("delete operator not supported for `%s'").printf (expression.value_type.to_string ())); } return !error; diff --git a/vala/valaelementaccess.vala b/vala/valaelementaccess.vala index b847e9515..4e8a2679b 100644 --- a/vala/valaelementaccess.vala +++ b/vala/valaelementaccess.vala @@ -142,7 +142,7 @@ public class Vala.ElementAccess : Expression { if (container.value_type == null) { error = true; - Report.error (container.source_reference, "Invalid container expression"); + Report.error (container.source_reference, _("Invalid container expression")); return false; } @@ -150,7 +150,7 @@ public class Vala.ElementAccess : Expression { // signal detail access if (get_indices ().size != 1) { error = true; - Report.error (source_reference, "Element access with more than one dimension is not supported for signals"); + Report.error (source_reference, _("Element access with more than one dimension is not supported for signals")); return false; } @@ -195,9 +195,9 @@ public class Vala.ElementAccess : Expression { } if (array_type.rank < get_indices ().size) { - Report.error (source_reference, "%d extra indices for element access".printf (get_indices ().size - array_type.rank)); + Report.error (source_reference, _("%d extra indices for element access").printf (get_indices ().size - array_type.rank)); } else if (array_type.rank > get_indices ().size) { - Report.error (source_reference, "%d missing indices for element access".printf (array_type.rank - get_indices ().size)); + Report.error (source_reference, _("%d missing indices for element access").printf (array_type.rank - get_indices ().size)); } } else if (pointer_type != null && !pointer_type.base_type.is_reference_type_or_type_parameter ()) { value_type = pointer_type.base_type.copy (); @@ -228,7 +228,7 @@ public class Vala.ElementAccess : Expression { } error = true; - Report.error (source_reference, "The expression `%s' does not denote an array".printf (container.value_type.to_string ())); + Report.error (source_reference, _("The expression `%s' does not denote an array").printf (container.value_type.to_string ())); } if (index_int_type_check) { @@ -242,7 +242,7 @@ public class Vala.ElementAccess : Expression { /* check if the index is of type integer */ if (!(e.value_type is IntegerType || e.value_type is EnumValueType)) { error = true; - Report.error (e.source_reference, "Expression of integer type expected"); + Report.error (e.source_reference, _("Expression of integer type expected")); } } } diff --git a/vala/valaenum.vala b/vala/valaenum.vala index 508ef12ef..fb56667b6 100644 --- a/vala/valaenum.vala +++ b/vala/valaenum.vala @@ -74,7 +74,7 @@ public class Vala.Enum : TypeSymbol { */ public override void add_method (Method m) { if (m is CreationMethod) { - Report.error (m.source_reference, "construction methods may only be declared within classes and structs"); + Report.error (m.source_reference, _("construction methods may only be declared within classes and structs")); m.error = true; return; @@ -167,7 +167,7 @@ public class Vala.Enum : TypeSymbol { context.analyzer.current_symbol = this; if (values.size <= 0) { - Report.error (source_reference, "Enum `%s' requires at least one value".printf (get_full_name ())); + Report.error (source_reference, _("Enum `%s' requires at least one value").printf (get_full_name ())); error = true; return false; } diff --git a/vala/valaerrordomain.vala b/vala/valaerrordomain.vala index c0e92e70e..f7e97b82b 100644 --- a/vala/valaerrordomain.vala +++ b/vala/valaerrordomain.vala @@ -57,7 +57,7 @@ public class Vala.ErrorDomain : TypeSymbol { */ public override void add_method (Method m) { if (m is CreationMethod) { - Report.error (m.source_reference, "construction methods may only be declared within classes and structs"); + Report.error (m.source_reference, _("construction methods may only be declared within classes and structs")); m.error = true; return; @@ -115,7 +115,7 @@ public class Vala.ErrorDomain : TypeSymbol { checked = true; if (codes.size <= 0) { - Report.error (source_reference, "Error domain `%s' requires at least one code".printf (get_full_name ())); + Report.error (source_reference, _("Error domain `%s' requires at least one code").printf (get_full_name ())); error = true; return false; } diff --git a/vala/valafield.vala b/vala/valafield.vala index 6bd54ff95..a1aee1d6e 100644 --- a/vala/valafield.vala +++ b/vala/valafield.vala @@ -94,7 +94,7 @@ public class Vala.Field : Variable, Lockable { if (variable_type is VoidType) { error = true; - Report.error (source_reference, "'void' not supported as field type"); + Report.error (source_reference, _("'void' not supported as field type")); return false; } @@ -103,7 +103,7 @@ public class Vala.Field : Variable, Lockable { // check whether field type is at least as accessible as the field if (!context.analyzer.is_type_accessible (this, variable_type)) { error = true; - Report.error (source_reference, "field type `%s' is less accessible than field `%s'".printf (variable_type.to_string (), get_full_name ())); + Report.error (source_reference, _("field type `%s' is less accessible than field `%s'").printf (variable_type.to_string (), get_full_name ())); return false; } @@ -124,13 +124,13 @@ public class Vala.Field : Variable, Lockable { if (initializer.value_type == null) { error = true; - Report.error (source_reference, "expression type not allowed as initializer"); + Report.error (source_reference, _("expression type not allowed as initializer")); return false; } if (!initializer.value_type.compatible (variable_type)) { error = true; - Report.error (source_reference, "Cannot convert from `%s' to `%s'".printf (initializer.value_type.to_string (), variable_type.to_string ())); + Report.error (source_reference, _("Cannot convert from `%s' to `%s'").printf (initializer.value_type.to_string (), variable_type.to_string ())); return false; } @@ -139,40 +139,40 @@ public class Vala.Field : Variable, Lockable { if (!(variable_type is PointerType) && !variable_type.value_owned) { /* lhs doesn't own the value */ error = true; - Report.error (source_reference, "Invalid assignment from owned expression to unowned variable"); + Report.error (source_reference, _("Invalid assignment from owned expression to unowned variable")); return false; } } if (parent_symbol is Namespace && !initializer.is_constant ()) { error = true; - Report.error (source_reference, "Non-constant field initializers not supported in this context"); + Report.error (source_reference, _("Non-constant field initializers not supported in this context")); return false; } if (parent_symbol is Namespace && initializer.is_constant () && initializer.is_non_null ()) { if (variable_type.is_disposable () && variable_type.value_owned) { error = true; - Report.error (source_reference, "Owned namespace fields can only be initialized in a function or method"); + Report.error (source_reference, _("Owned namespace fields can only be initialized in a function or method")); return false; } } if (binding == MemberBinding.STATIC && parent_symbol is Class && ((Class)parent_symbol).is_compact && !initializer.is_constant ()) { error = true; - Report.error (source_reference, "Static fields in compact classes cannot have non-constant initializers"); + Report.error (source_reference, _("Static fields in compact classes cannot have non-constant initializers")); return false; } if (external) { error = true; - Report.error (source_reference, "External fields cannot use initializers"); + Report.error (source_reference, _("External fields cannot use initializers")); } } if (binding == MemberBinding.INSTANCE && parent_symbol is Interface) { error = true; - Report.error (source_reference, "Interfaces may not have instance fields"); + Report.error (source_reference, _("Interfaces may not have instance fields")); return false; } @@ -186,7 +186,7 @@ public class Vala.Field : Variable, Lockable { } if (!external_package && !hides && get_hidden_member () != null) { - Report.warning (source_reference, "%s hides inherited field `%s'. Use the `new' keyword if hiding was intentional".printf (get_full_name (), get_hidden_member ().get_full_name ())); + Report.warning (source_reference, _("%s hides inherited field `%s'. Use the `new' keyword if hiding was intentional").printf (get_full_name (), get_hidden_member ().get_full_name ())); } context.analyzer.current_source_file = old_source_file; diff --git a/vala/valaflowanalyzer.vala b/vala/valaflowanalyzer.vala index dc7e471a3..9ba21edc2 100644 --- a/vala/valaflowanalyzer.vala +++ b/vala/valaflowanalyzer.vala @@ -149,7 +149,7 @@ public class Vala.FlowAnalyzer : CodeVisitor { if (!f.is_private_symbol () && (context.internal_header_filename != null || context.use_fast_vapi)) { // do not warn if internal member may be used outside this compilation unit } else { - Report.warning (f.source_reference, "field `%s' never used".printf (f.get_full_name ())); + Report.warning (f.source_reference, _("field `%s' never used").printf (f.get_full_name ())); } } } @@ -178,7 +178,7 @@ public class Vala.FlowAnalyzer : CodeVisitor { && m.get_attribute_bool ("DBus", "visible", true)) { // do not warn if internal member is a visible DBus method } else { - Report.warning (m.source_reference, "method `%s' never used".printf (m.get_full_name ())); + Report.warning (m.source_reference, _("method `%s' never used").printf (m.get_full_name ())); } } @@ -233,7 +233,7 @@ public class Vala.FlowAnalyzer : CodeVisitor { // end of method body reachable if (m.has_result) { - Report.error (m.source_reference, "missing return statement at end of subroutine body"); + Report.error (m.source_reference, _("missing return statement at end of subroutine body")); m.error = true; } @@ -425,10 +425,10 @@ public class Vala.FlowAnalyzer : CodeVisitor { foreach (Variable variable in phi.operands) { if (variable == null) { if (used_var is LocalVariable) { - Report.error (used_var.source_reference, "use of possibly unassigned local variable `%s'".printf (used_var.name)); + Report.error (used_var.source_reference, _("use of possibly unassigned local variable `%s'").printf (used_var.name)); } else { // parameter - Report.warning (used_var.source_reference, "use of possibly unassigned parameter `%s'".printf (used_var.name)); + Report.warning (used_var.source_reference, _("use of possibly unassigned parameter `%s'").printf (used_var.name)); } continue; } @@ -461,10 +461,10 @@ public class Vala.FlowAnalyzer : CodeVisitor { var variable_stack = var_map.get (var_symbol); if (variable_stack == null || variable_stack.size == 0) { if (var_symbol is LocalVariable) { - Report.error (node.source_reference, "use of possibly unassigned local variable `%s'".printf (var_symbol.name)); + Report.error (node.source_reference, _("use of possibly unassigned local variable `%s'").printf (var_symbol.name)); } else { // parameter - Report.warning (node.source_reference, "use of possibly unassigned parameter `%s'".printf (var_symbol.name)); + Report.warning (node.source_reference, _("use of possibly unassigned parameter `%s'").printf (var_symbol.name)); } continue; } @@ -564,7 +564,7 @@ public class Vala.FlowAnalyzer : CodeVisitor { } if (!stmt.declaration.used) { - Report.warning (stmt.declaration.source_reference, "local variable `%s' declared but never used".printf (stmt.declaration.name)); + Report.warning (stmt.declaration.source_reference, _("local variable `%s' declared but never used").printf (stmt.declaration.name)); } current_block.add_node (stmt); @@ -694,7 +694,7 @@ public class Vala.FlowAnalyzer : CodeVisitor { // end of switch section reachable // we don't allow fall-through - Report.error (section.source_reference, "missing break statement at end of switch section"); + Report.error (section.source_reference, _("missing break statement at end of switch section")); section.error = true; current_block.connect (after_switch_block); @@ -809,7 +809,7 @@ public class Vala.FlowAnalyzer : CodeVisitor { } } - Report.error (stmt.source_reference, "no enclosing loop or switch statement found"); + Report.error (stmt.source_reference, _("no enclosing loop or switch statement found")); stmt.error = true; } @@ -832,7 +832,7 @@ public class Vala.FlowAnalyzer : CodeVisitor { } } - Report.error (stmt.source_reference, "no enclosing loop found"); + Report.error (stmt.source_reference, _("no enclosing loop found")); stmt.error = true; } @@ -861,7 +861,7 @@ public class Vala.FlowAnalyzer : CodeVisitor { } } - Report.error (stmt.source_reference, "no enclosing loop found"); + Report.error (stmt.source_reference, _("no enclosing loop found")); stmt.error = true; } @@ -973,7 +973,7 @@ public class Vala.FlowAnalyzer : CodeVisitor { if (invalid_block.get_predecessors ().size > 0) { // don't allow finally blocks with e.g. return statements - Report.error (stmt.source_reference, "jump out of finally block not permitted"); + Report.error (stmt.source_reference, _("jump out of finally block not permitted")); stmt.error = true; return; } @@ -1032,12 +1032,12 @@ public class Vala.FlowAnalyzer : CodeVisitor { if (context.profile == Profile.GOBJECT) { if (prev_target.error_domain == jump_target.error_domain && prev_target.error_code == jump_target.error_code) { - Report.error (stmt.source_reference, "double catch clause of same error detected"); + Report.error (stmt.source_reference, _("double catch clause of same error detected")); stmt.error = true; return; } } else if (prev_target.error_class == jump_target.error_class) { - Report.error (stmt.source_reference, "double catch clause of same error detected"); + Report.error (stmt.source_reference, _("double catch clause of same error detected")); stmt.error = true; return; } @@ -1045,7 +1045,7 @@ public class Vala.FlowAnalyzer : CodeVisitor { if (jump_target.basic_block.get_predecessors ().size == 0) { // unreachable - Report.warning (jump_target.catch_clause.source_reference, "unreachable catch clause detected"); + Report.warning (jump_target.catch_clause.source_reference, _("unreachable catch clause detected")); } else { current_block = jump_target.basic_block; current_block.add_node (jump_target.catch_clause); @@ -1097,7 +1097,7 @@ public class Vala.FlowAnalyzer : CodeVisitor { if (current_block == null) { node.unreachable = true; if (!unreachable_reported) { - Report.warning (node.source_reference, "unreachable code detected"); + Report.warning (node.source_reference, _("unreachable code detected")); unreachable_reported = true; } return true; diff --git a/vala/valaforeachstatement.vala b/vala/valaforeachstatement.vala index 67063bbe1..ed3617dae 100644 --- a/vala/valaforeachstatement.vala +++ b/vala/valaforeachstatement.vala @@ -160,7 +160,7 @@ public class Vala.ForeachStatement : Block { error = true; return false; } else if (collection.value_type == null) { - Report.error (collection.source_reference, "invalid collection expression"); + Report.error (collection.source_reference, _("invalid collection expression")); error = true; return false; } @@ -178,7 +178,7 @@ public class Vala.ForeachStatement : Block { } else if (context.profile == Profile.GOBJECT && (collection_type.compatible (context.analyzer.glist_type) || collection_type.compatible (context.analyzer.gslist_type))) { if (collection_type.get_type_arguments ().size != 1) { error = true; - Report.error (collection.source_reference, "missing type argument for collection"); + Report.error (collection.source_reference, _("missing type argument for collection")); return false; } @@ -228,18 +228,18 @@ public class Vala.ForeachStatement : Block { var iterator_method = collection_type.get_member ("iterator") as Method; if (iterator_method == null) { - Report.error (collection.source_reference, "`%s' does not have an `iterator' method".printf (collection_type.to_string ())); + Report.error (collection.source_reference, _("`%s' does not have an `iterator' method").printf (collection_type.to_string ())); error = true; return false; } if (iterator_method.get_parameters ().size != 0) { - Report.error (collection.source_reference, "`%s' must not have any parameters".printf (iterator_method.get_full_name ())); + Report.error (collection.source_reference, _("`%s' must not have any parameters").printf (iterator_method.get_full_name ())); error = true; return false; } var iterator_type = iterator_method.return_type.get_actual_type (collection_type, null, this); if (iterator_type is VoidType) { - Report.error (collection.source_reference, "`%s' must return an iterator".printf (iterator_method.get_full_name ())); + Report.error (collection.source_reference, _("`%s' must return an iterator").printf (iterator_method.get_full_name ())); error = true; return false; } @@ -251,13 +251,13 @@ public class Vala.ForeachStatement : Block { var next_method = iterator_type.get_member ("next") as Method; if (next_value_method != null) { if (next_value_method.get_parameters ().size != 0) { - Report.error (collection.source_reference, "`%s' must not have any parameters".printf (next_value_method.get_full_name ())); + Report.error (collection.source_reference, _("`%s' must not have any parameters").printf (next_value_method.get_full_name ())); error = true; return false; } var element_type = next_value_method.return_type.get_actual_type (iterator_type, null, this); if (!element_type.nullable) { - Report.error (collection.source_reference, "return type of `%s' must be nullable".printf (next_value_method.get_full_name ())); + Report.error (collection.source_reference, _("return type of `%s' must be nullable").printf (next_value_method.get_full_name ())); error = true; return false; } @@ -275,29 +275,29 @@ public class Vala.ForeachStatement : Block { add_statement (loop); } else if (next_method != null) { if (next_method.get_parameters ().size != 0) { - Report.error (collection.source_reference, "`%s' must not have any parameters".printf (next_method.get_full_name ())); + Report.error (collection.source_reference, _("`%s' must not have any parameters").printf (next_method.get_full_name ())); error = true; return false; } if (!next_method.return_type.compatible (context.analyzer.bool_type)) { - Report.error (collection.source_reference, "`%s' must return a boolean value".printf (next_method.get_full_name ())); + Report.error (collection.source_reference, _("`%s' must return a boolean value").printf (next_method.get_full_name ())); error = true; return false; } var get_method = iterator_type.get_member ("get") as Method; if (get_method == null) { - Report.error (collection.source_reference, "`%s' does not have a `get' method".printf (iterator_type.to_string ())); + Report.error (collection.source_reference, _("`%s' does not have a `get' method").printf (iterator_type.to_string ())); error = true; return false; } if (get_method.get_parameters ().size != 0) { - Report.error (collection.source_reference, "`%s' must not have any parameters".printf (get_method.get_full_name ())); + Report.error (collection.source_reference, _("`%s' must not have any parameters").printf (get_method.get_full_name ())); error = true; return false; } var element_type = get_method.return_type.get_actual_type (iterator_type, null, this); if (element_type is VoidType) { - Report.error (collection.source_reference, "`%s' must return an element".printf (get_method.get_full_name ())); + Report.error (collection.source_reference, _("`%s' must return an element").printf (get_method.get_full_name ())); error = true; return false; } @@ -313,7 +313,7 @@ public class Vala.ForeachStatement : Block { var get_call = new MethodCall (new MemberAccess (new MemberAccess.simple ("_%s_it".printf (variable_name), source_reference), "get", source_reference), source_reference); body.insert_statement (0, new DeclarationStatement (new LocalVariable (type_reference, variable_name, get_call, source_reference), source_reference)); } else { - Report.error (collection.source_reference, "`%s' does not have a `next_value' or `next' method".printf (iterator_type.to_string ())); + Report.error (collection.source_reference, _("`%s' does not have a `next_value' or `next' method").printf (iterator_type.to_string ())); error = true; return false; } @@ -329,11 +329,11 @@ public class Vala.ForeachStatement : Block { type_reference = element_type.copy (); } else if (!element_type.compatible (type_reference)) { error = true; - Report.error (source_reference, "Foreach: Cannot convert from `%s' to `%s'".printf (element_type.to_string (), type_reference.to_string ())); + Report.error (source_reference, _("Foreach: Cannot convert from `%s' to `%s'").printf (element_type.to_string (), type_reference.to_string ())); return false; } else if (element_type.is_disposable () && element_type.value_owned && !type_reference.value_owned) { error = true; - Report.error (source_reference, "Foreach: Invalid assignment from owned expression to unowned variable"); + Report.error (source_reference, _("Foreach: Invalid assignment from owned expression to unowned variable")); return false; } @@ -347,7 +347,7 @@ public class Vala.ForeachStatement : Block { type_reference = element_type.copy (); } else if (!element_type.compatible (type_reference)) { error = true; - Report.error (source_reference, "Foreach: Cannot convert from `%s' to `%s'".printf (element_type.to_string (), type_reference.to_string ())); + Report.error (source_reference, _("Foreach: Cannot convert from `%s' to `%s'").printf (element_type.to_string (), type_reference.to_string ())); return false; } diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala index e1bd9025b..1b7e65c1e 100644 --- a/vala/valagenieparser.vala +++ b/vala/valagenieparser.vala @@ -162,7 +162,7 @@ public class Vala.Genie.Parser : CodeVisitor { void report_parse_error (ParseError e) { var begin = get_location (); next (); - Report.error (get_src (begin), "syntax error, " + e.message); + Report.error (get_src (begin), _("syntax error, ") + e.message); } inline bool expect (TokenType type) throws ParseError { @@ -372,7 +372,7 @@ public class Vala.Genie.Parser : CodeVisitor { // FIXME validate and unescape here and just pass unichar to CharacterLiteral var lit = new CharacterLiteral (get_last_string (), get_src (begin)); if (lit.error) { - Report.error (lit.source_reference, "invalid character literal"); + Report.error (lit.source_reference, _("invalid character literal")); } return lit; case TokenType.REGEX_LITERAL: @@ -512,7 +512,7 @@ public class Vala.Genie.Parser : CodeVisitor { value_owned = false; } else if (accept (TokenType.WEAK)) { if (!can_weak_ref && !context.deprecated) { - Report.warning (get_src (begin), "deprecated syntax, use `unowned` modifier"); + Report.warning (get_src (begin), _("deprecated syntax, use `unowned` modifier")); } value_owned = false; } @@ -1179,7 +1179,7 @@ public class Vala.Genie.Parser : CodeVisitor { var call = expr as MethodCall; var object_creation = expr as ObjectCreationExpression; if (call == null && object_creation == null) { - Report.error (expr.source_reference, "syntax error, expected method call"); + Report.error (expr.source_reference, _("syntax error, expected method call")); throw new ParseError.SYNTAX ("expected method call"); } @@ -1916,7 +1916,7 @@ public class Vala.Genie.Parser : CodeVisitor { if (!accept (TokenType.DEDENT)) { // only report error if it's not a secondary error if (context.report.get_errors () == 0) { - Report.error (get_current_src (), "tab indentation is incorrect"); + Report.error (get_current_src (), _("tab indentation is incorrect")); } } @@ -2389,7 +2389,7 @@ public class Vala.Genie.Parser : CodeVisitor { if (attributes != null) { foreach (Attribute attr in (List) attributes) { if (node.get_attribute (attr.name) != null) { - Report.error (attr.source_reference, "duplicate attribute `%s'".printf (attr.name)); + Report.error (attr.source_reference, _("duplicate attribute `%s'").printf (attr.name)); } node.attributes.append (attr); } @@ -2493,7 +2493,7 @@ public class Vala.Genie.Parser : CodeVisitor { if (!accept (TokenType.DEDENT)) { // only report error if it's not a secondary error if (context.report.get_errors () == 0) { - Report.error (get_current_src (), "expected dedent"); + Report.error (get_current_src (), _("expected dedent")); } } } @@ -2601,7 +2601,7 @@ public class Vala.Genie.Parser : CodeVisitor { } else if (sym is Constant) { ns.add_constant ((Constant) sym); } else { - Report.error (sym.source_reference, "unexpected declaration in namespace"); + Report.error (sym.source_reference, _("unexpected declaration in namespace")); } } @@ -2733,7 +2733,7 @@ public class Vala.Genie.Parser : CodeVisitor { } else if (sym is Destructor) { cl.add_destructor ((Destructor) sym); } else { - Report.error (sym.source_reference, "unexpected declaration in class"); + Report.error (sym.source_reference, _("unexpected declaration in class")); } } @@ -2775,7 +2775,7 @@ public class Vala.Genie.Parser : CodeVisitor { set_attributes (c, attrs); if (ModifierFlags.STATIC in flags) { - Report.warning (c.source_reference, "the modifier `static' is not applicable to constants"); + Report.warning (c.source_reference, _("the modifier `static' is not applicable to constants")); } return c; @@ -2795,7 +2795,7 @@ public class Vala.Genie.Parser : CodeVisitor { var f = new Field (id, type, null, get_src (begin), comment); if (ModifierFlags.ABSTRACT in flags || ModifierFlags.VIRTUAL in flags || ModifierFlags.OVERRIDE in flags) { - Report.error (f.source_reference, "abstract, virtual, and override modifiers are not applicable to fields"); + Report.error (f.source_reference, _("abstract, virtual, and override modifiers are not applicable to fields")); } if (ModifierFlags.PRIVATE in flags) { @@ -3094,7 +3094,7 @@ public class Vala.Genie.Parser : CodeVisitor { } if (ModifierFlags.ASYNC in flags) { - Report.error (prop.source_reference, "async properties are not supported yet"); + Report.error (prop.source_reference, _("async properties are not supported yet")); } if (accept (TokenType.ASSIGN)) { @@ -3318,7 +3318,7 @@ public class Vala.Genie.Parser : CodeVisitor { } else if (sym is Property) { st.add_property ((Property) sym); } else { - Report.error (sym.source_reference, "unexpected declaration in struct"); + Report.error (sym.source_reference, _("unexpected declaration in struct")); } } @@ -3397,7 +3397,7 @@ public class Vala.Genie.Parser : CodeVisitor { } else if (sym is Property) { iface.add_property ((Property) sym); } else { - Report.error (sym.source_reference, "unexpected declaration in interface"); + Report.error (sym.source_reference, _("unexpected declaration in interface")); } } diff --git a/vala/valageniescanner.vala b/vala/valageniescanner.vala index c24490108..a031e1666 100644 --- a/vala/valageniescanner.vala +++ b/vala/valageniescanner.vala @@ -136,25 +136,25 @@ public class Vala.Genie.Scanner { switch (current[0]) { case 'i': if (fl_i) { - Report.error (get_source_reference (token_length_in_chars), "modifier 'i' used more than once"); + Report.error (get_source_reference (token_length_in_chars), _("modifier 'i' used more than once")); } fl_i = true; break; case 's': if (fl_s) { - Report.error (get_source_reference (token_length_in_chars), "modifier 's' used more than once"); + Report.error (get_source_reference (token_length_in_chars), _("modifier 's' used more than once")); } fl_s = true; break; case 'm': if (fl_m) { - Report.error (get_source_reference (token_length_in_chars), "modifier 'm' used more than once"); + Report.error (get_source_reference (token_length_in_chars), _("modifier 'm' used more than once")); } fl_m = true; break; case 'x': if (fl_x) { - Report.error (get_source_reference (token_length_in_chars), "modifier 'x' used more than once"); + Report.error (get_source_reference (token_length_in_chars), _("modifier 'x' used more than once")); } fl_x = true; break; @@ -240,7 +240,7 @@ public class Vala.Genie.Scanner { token_length_in_chars++; } if (digit_length != 4) { - Report.error (get_source_reference (token_length_in_chars), "\\u requires four hex digits"); + Report.error (get_source_reference (token_length_in_chars), _("\\u requires four hex digits")); } break; case 'x': @@ -253,7 +253,7 @@ public class Vala.Genie.Scanner { token_length_in_chars++; } if (digit_length != 2) { - Report.error (get_source_reference (token_length_in_chars), "\\x requires two hex digits"); + Report.error (get_source_reference (token_length_in_chars), _("\\x requires two hex digits")); } break; default: @@ -266,7 +266,7 @@ public class Vala.Genie.Scanner { token_length_in_chars++; } } else { - Report.error (get_source_reference (token_length_in_chars), "invalid escape sequence"); + Report.error (get_source_reference (token_length_in_chars), _("invalid escape sequence")); } break; } @@ -279,12 +279,12 @@ public class Vala.Genie.Scanner { token_length_in_chars++; } else { current++; - Report.error (get_source_reference (token_length_in_chars), "invalid UTF-8 character"); + Report.error (get_source_reference (token_length_in_chars), _("invalid UTF-8 character")); } } } if (current >= end || current[0] == '\n') { - Report.error (get_source_reference (token_length_in_chars), "syntax error, expected \""); + Report.error (get_source_reference (token_length_in_chars), _("syntax error, expected \"")); state_stack.length--; return read_token (out token_begin, out token_end); } @@ -727,7 +727,7 @@ public class Vala.Genie.Scanner { current++; state_stack += State.TEMPLATE_PART; } else { - Report.error (get_source_reference (1), "unexpected character"); + Report.error (get_source_reference (1), _("unexpected character")); return read_template_token (out token_begin, out token_end); } break; @@ -766,7 +766,7 @@ public class Vala.Genie.Scanner { token_length_in_chars++; } if (digit_length != 4) { - Report.error (get_source_reference (token_length_in_chars), "\\u requires four hex digits"); + Report.error (get_source_reference (token_length_in_chars), _("\\u requires four hex digits")); } break; case 'x': @@ -779,11 +779,11 @@ public class Vala.Genie.Scanner { token_length_in_chars++; } if (digit_length != 2) { - Report.error (get_source_reference (token_length_in_chars), "\\x requires two hex digits"); + Report.error (get_source_reference (token_length_in_chars), _("\\x requires two hex digits")); } break; default: - Report.error (get_source_reference (token_length_in_chars), "invalid escape sequence"); + Report.error (get_source_reference (token_length_in_chars), _("invalid escape sequence")); break; } } else if (current[0] == '\n') { @@ -798,12 +798,12 @@ public class Vala.Genie.Scanner { token_length_in_chars++; } else { current++; - Report.error (get_source_reference (token_length_in_chars), "invalid UTF-8 character"); + Report.error (get_source_reference (token_length_in_chars), _("invalid UTF-8 character")); } } } if (current >= end) { - Report.error (get_source_reference (token_length_in_chars), "syntax error, expected \""); + Report.error (get_source_reference (token_length_in_chars), _("syntax error, expected \"")); state_stack.length--; return read_token (out token_begin, out token_end); } @@ -1292,14 +1292,14 @@ public class Vala.Genie.Scanner { current += u.to_utf8 (null); token_length_in_chars++; } else { - Report.error (get_source_reference (token_length_in_chars), "invalid UTF-8 character"); + Report.error (get_source_reference (token_length_in_chars), _("invalid UTF-8 character")); } } } if (current[0] == '"' && current[1] == '"' && current[2] == '"') { current += 3; } else { - Report.error (get_source_reference (token_length_in_chars), "syntax error, expected \"\"\""); + Report.error (get_source_reference (token_length_in_chars), _("syntax error, expected \"\"\"")); } break; } else { @@ -1339,7 +1339,7 @@ public class Vala.Genie.Scanner { token_length_in_chars++; } if (digit_length != 4) { - Report.error (get_source_reference (token_length_in_chars), "\\u requires four hex digits"); + Report.error (get_source_reference (token_length_in_chars), _("\\u requires four hex digits")); } break; case 'x': @@ -1352,11 +1352,11 @@ public class Vala.Genie.Scanner { token_length_in_chars++; } if (digit_length != 2) { - Report.error (get_source_reference (token_length_in_chars), "\\x requires two hex digits"); + Report.error (get_source_reference (token_length_in_chars), _("\\x requires two hex digits")); } break; default: - Report.error (get_source_reference (token_length_in_chars), "invalid escape sequence"); + Report.error (get_source_reference (token_length_in_chars), _("invalid escape sequence")); break; } } else if (current[0] == '\n') { @@ -1371,28 +1371,28 @@ public class Vala.Genie.Scanner { token_length_in_chars++; } else { current++; - Report.error (get_source_reference (token_length_in_chars), "invalid UTF-8 character"); + Report.error (get_source_reference (token_length_in_chars), _("invalid UTF-8 character")); } } if (current < end && begin[0] == '\'' && current[0] != '\'') { // multiple characters in single character literal - Report.error (get_source_reference (token_length_in_chars), "invalid character literal"); + Report.error (get_source_reference (token_length_in_chars), _("invalid character literal")); } } if (current < end) { current++; } else { - Report.error (get_source_reference (token_length_in_chars), "syntax error, expected %c".printf (begin[0])); + Report.error (get_source_reference (token_length_in_chars), _("syntax error, expected %c").printf (begin[0])); } break; default: unichar u = ((string) current).get_char_validated ((long) (end - current)); if (u != (unichar) (-1)) { current += u.to_utf8 (null); - Report.error (get_source_reference (0), "syntax error, unexpected character"); + Report.error (get_source_reference (0), _("syntax error, unexpected character")); } else { current++; - Report.error (get_source_reference (0), "invalid UTF-8 character"); + Report.error (get_source_reference (0), _("invalid UTF-8 character")); } column++; return read_token (out token_begin, out token_end); @@ -1556,7 +1556,7 @@ public class Vala.Genie.Scanner { column++; } if (current == end - 1) { - Report.error (get_source_reference (0), "syntax error, expected */"); + Report.error (get_source_reference (0), _("syntax error, expected */")); return true; } @@ -1669,7 +1669,7 @@ public class Vala.Genie.Scanner { } else if (len == 5 && matches (begin, "endif")) { parse_pp_endif (); } else { - Report.error (get_source_reference (-len, len), "syntax error, invalid preprocessing directive"); + Report.error (get_source_reference (-len, len), _("syntax error, invalid preprocessing directive")); } if (conditional_stack.length > 0 @@ -1699,7 +1699,7 @@ public class Vala.Genie.Scanner { void pp_eol () { pp_space (); if (current >= end || current[0] != '\n') { - Report.error (get_source_reference (0), "syntax error, expected newline"); + Report.error (get_source_reference (0), _("syntax error, expected newline")); } } @@ -1729,7 +1729,7 @@ public class Vala.Genie.Scanner { pp_eol (); if (conditional_stack.length == 0 || conditional_stack[conditional_stack.length - 1].else_found) { - Report.error (get_source_reference (0), "syntax error, unexpected #elif"); + Report.error (get_source_reference (0), _("syntax error, unexpected #elif")); return; } @@ -1748,7 +1748,7 @@ public class Vala.Genie.Scanner { pp_eol (); if (conditional_stack.length == 0 || conditional_stack[conditional_stack.length - 1].else_found) { - Report.error (get_source_reference (0), "syntax error, unexpected #else"); + Report.error (get_source_reference (0), _("syntax error, unexpected #else")); return; } @@ -1767,7 +1767,7 @@ public class Vala.Genie.Scanner { pp_eol (); if (conditional_stack.length == 0) { - Report.error (get_source_reference (0), "syntax error, unexpected #endif"); + Report.error (get_source_reference (0), _("syntax error, unexpected #endif")); return; } @@ -1783,7 +1783,7 @@ public class Vala.Genie.Scanner { } if (len == 0) { - Report.error (get_source_reference (0), "syntax error, expected identifier"); + Report.error (get_source_reference (0), _("syntax error, expected identifier")); return false; } @@ -1802,7 +1802,7 @@ public class Vala.Genie.Scanner { bool parse_pp_primary_expression () { if (current >= end) { - Report.error (get_source_reference (0), "syntax error, expected identifier"); + Report.error (get_source_reference (0), _("syntax error, expected identifier")); } else if (is_ident_char (current[0])) { return parse_pp_symbol (); } else if (current[0] == '(') { @@ -1815,11 +1815,11 @@ public class Vala.Genie.Scanner { current++; column++; } else { - Report.error (get_source_reference (0), "syntax error, expected `)'"); + Report.error (get_source_reference (0), _("syntax error, expected `)'")); } return result; } else { - Report.error (get_source_reference (0), "syntax error, expected identifier"); + Report.error (get_source_reference (0), _("syntax error, expected identifier")); } return false; } diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala index 0210f6fde..f0ca43f7d 100644 --- a/vala/valagirparser.vala +++ b/vala/valagirparser.vala @@ -315,9 +315,9 @@ public class Vala.GirParser : CodeVisitor { if (current == TokenType.DOT || current == TokenType.HASH) { if (is_glob) { - Report.error (get_src (begin), "expected glob-style pattern"); + Report.error (get_src (begin), _("expected glob-style pattern")); } else { - Report.error (get_src (begin), "expected identifier"); + Report.error (get_src (begin), _("expected identifier")); } return null; } @@ -354,7 +354,7 @@ public class Vala.GirParser : CodeVisitor { } else { // relative pattern if (current != TokenType.DOT) { - Report.error (get_current_src (), "expected pattern or `.', got %s".printf (current.to_string ())); + Report.error (get_current_src (), _("expected pattern or `.', got %s").printf (current.to_string ())); return null; } next (); @@ -362,7 +362,7 @@ public class Vala.GirParser : CodeVisitor { } if (parent_metadata == null) { - Report.error (get_current_src (), "cannot determinate parent metadata"); + Report.error (get_current_src (), _("cannot determinate parent metadata")); return null; } @@ -376,7 +376,7 @@ public class Vala.GirParser : CodeVisitor { while (current != TokenType.EOF && !has_space ()) { if (current != TokenType.DOT) { - Report.error (get_current_src (), "expected `.' got %s".printf (current.to_string ())); + Report.error (get_current_src (), _("expected `.' got %s").printf (current.to_string ())); break; } next (); @@ -415,7 +415,7 @@ public class Vala.GirParser : CodeVisitor { next (); var inner = parse_expression (); if (inner == null) { - Report.error (src, "expected expression after `-', got %s".printf (current.to_string ())); + Report.error (src, _("expected expression after `-', got %s").printf (current.to_string ())); } else { expr = new UnaryExpression (UnaryOperator.MINUS, inner, get_src (begin)); } @@ -433,7 +433,7 @@ public class Vala.GirParser : CodeVisitor { expr = new MemberAccess (null, get_string (), src); while (next () == TokenType.DOT) { if (next () != TokenType.IDENTIFIER) { - Report.error (get_current_src (), "expected identifier got %s".printf (current.to_string ())); + Report.error (get_current_src (), _("expected identifier got %s").printf (current.to_string ())); break; } expr = new MemberAccess (expr, get_string (), get_current_src ()); @@ -442,13 +442,13 @@ public class Vala.GirParser : CodeVisitor { case TokenType.OPEN_PARENS: // empty tuple => no expression if (next () != TokenType.CLOSE_PARENS) { - Report.error (get_current_src (), "expected `)', got %s".printf (current.to_string ())); + Report.error (get_current_src (), _("expected `)', got %s").printf (current.to_string ())); break; } expr = new Tuple (src); break; default: - Report.error (src, "expected literal or symbol got %s".printf (current.to_string ())); + Report.error (src, _("expected literal or symbol got %s").printf (current.to_string ())); break; } next (); @@ -464,7 +464,7 @@ public class Vala.GirParser : CodeVisitor { } var arg_type = ArgumentType.from_string (id); if (arg_type == null) { - Report.warning (get_src (begin, old_end), "unknown argument `%s'".printf (id)); + Report.warning (get_src (begin, old_end), _("unknown argument `%s'").printf (id)); continue; } @@ -904,7 +904,7 @@ public class Vala.GirParser : CodeVisitor { } parser.assume_parameter_names (sig, m, false); if (m.get_parameters().size != sig.get_parameters().size) { - Report.warning (symbol.source_reference, "Signal `%s' conflicts with method of the same name".printf (get_full_name ())); + Report.warning (symbol.source_reference, _("Signal `%s' conflicts with method of the same name").printf (get_full_name ())); } merged = true; } else if (sym is Method && !(sym is CreationMethod) && node != this) { @@ -926,7 +926,7 @@ public class Vala.GirParser : CodeVisitor { } if (!different_invoker) { if (attr != null) { - Report.warning (symbol.source_reference, "Virtual method `%s' conflicts with method of the same name".printf (get_full_name ())); + Report.warning (symbol.source_reference, _("Virtual method `%s' conflicts with method of the same name").printf (get_full_name ())); } node.merged = true; } @@ -1417,13 +1417,13 @@ public class Vala.GirParser : CodeVisitor { void start_element (string name) { if (current_token != MarkupTokenType.START_ELEMENT || reader.name != name) { // error - Report.error (get_current_src (), "expected start element of `%s'".printf (name)); + Report.error (get_current_src (), _("expected start element of `%s'").printf (name)); } } void end_element (string name) { while (current_token != MarkupTokenType.END_ELEMENT || reader.name != name) { - Report.warning (get_current_src (), "expected end element of `%s'".printf (name)); + Report.warning (get_current_src (), _("expected end element of `%s'").printf (name)); skip_element (); } next (); @@ -1531,7 +1531,7 @@ public class Vala.GirParser : CodeVisitor { ed.add_method ((Method) sym); } } else { - Report.error (sym.source_reference, "impossible to add `%s' to container `%s'".printf (sym.name, container.name)); + Report.error (sym.source_reference, _("impossible to add `%s' to container `%s'").printf (sym.name, container.name)); } } @@ -1545,7 +1545,7 @@ public class Vala.GirParser : CodeVisitor { sym = new UnresolvedSymbol (sym, s, source_reference); } if (sym == null) { - Report.error (source_reference, "a symbol must be specified"); + Report.error (source_reference, _("a symbol must be specified")); } return sym; } @@ -1697,7 +1697,7 @@ public class Vala.GirParser : CodeVisitor { GLib.MatchInfo match; if (!type_from_string_regex.match (type_string, 0, out match)) { - Report.error (source_reference, "unable to parse type"); + Report.error (source_reference, _("unable to parse type")); return null; } @@ -1722,7 +1722,7 @@ public class Vala.GirParser : CodeVisitor { } return type; } else { - Report.error (source_reference, "invalid void type"); + Report.error (source_reference, _("invalid void type")); return null; } } @@ -1731,7 +1731,7 @@ public class Vala.GirParser : CodeVisitor { if (ownership_data == "owned") { if (owned_by_default) { - Report.error (source_reference, "unexpected `owned' keyword"); + Report.error (source_reference, _("unexpected `owned' keyword")); } else { value_owned = true; } @@ -1739,7 +1739,7 @@ public class Vala.GirParser : CodeVisitor { if (owned_by_default) { value_owned = false; } else { - Report.error (source_reference, "unexpected `unowned' keyword"); + Report.error (source_reference, _("unexpected `unowned' keyword")); return null; } } @@ -1898,7 +1898,7 @@ public class Vala.GirParser : CodeVisitor { void parse_repository () { start_element ("repository"); if (reader.get_attribute ("version") != GIR_VERSION) { - Report.error (get_current_src (), "unsupported GIR version %s (supported: %s)".printf (reader.get_attribute ("version"), GIR_VERSION)); + Report.error (get_current_src (), _("unsupported GIR version %s (supported: %s)").printf (reader.get_attribute ("version"), GIR_VERSION)); return; } next (); @@ -1923,7 +1923,7 @@ public class Vala.GirParser : CodeVisitor { parse_c_include (); } else { // error - Report.error (get_current_src (), "unknown child element `%s' in `repository'".printf (reader.name)); + Report.error (get_current_src (), _("unknown child element `%s' in `repository'").printf (reader.name)); skip_element (); } } @@ -1968,7 +1968,7 @@ public class Vala.GirParser : CodeVisitor { } else if (current_token == MarkupTokenType.END_ELEMENT) { level--; } else if (current_token == MarkupTokenType.EOF) { - Report.error (get_current_src (), "unexpected end of file"); + Report.error (get_current_src (), _("unexpected end of file")); break; } next (); @@ -2189,7 +2189,7 @@ public class Vala.GirParser : CodeVisitor { parse_constant (); } else { // error - Report.error (get_current_src (), "unknown child element `%s' in `namespace'".printf (reader.name)); + Report.error (get_current_src (), _("unknown child element `%s' in `namespace'").printf (reader.name)); skip_element (); } @@ -2353,7 +2353,7 @@ public class Vala.GirParser : CodeVisitor { skip_element (); } else { // error - Report.error (get_current_src (), "unknown child element `%s' in `%s'".printf (reader.name, element_name)); + Report.error (get_current_src (), _("unknown child element `%s' in `%s'").printf (reader.name, element_name)); skip_element (); } @@ -2361,7 +2361,7 @@ public class Vala.GirParser : CodeVisitor { } if (!has_member) { - Report.error (get_current_src (), "%s `%s' has no members".printf (element_name, current.name)); + Report.error (get_current_src (), _("%s `%s' has no members").printf (element_name, current.name)); } if (common_prefix != null) { @@ -2447,7 +2447,7 @@ public class Vala.GirParser : CodeVisitor { string element_type = reader.name; if (current_token != MarkupTokenType.START_ELEMENT || (element_type != "parameter" && element_type != "instance-parameter")) { - Report.error (get_current_src (), "expected start element of `parameter' or `instance-parameter'"); + Report.error (get_current_src (), _("expected start element of `parameter' or `instance-parameter'")); } start_element (element_type); var name = metadata.get_string (ArgumentType.NAME); @@ -2801,7 +2801,7 @@ public class Vala.GirParser : CodeVisitor { parse_union (); } else { // error - Report.error (get_current_src (), "unknown child element `%s' in `record'".printf (reader.name)); + Report.error (get_current_src (), _("unknown child element `%s' in `record'").printf (reader.name)); skip_element (); } @@ -2884,7 +2884,7 @@ public class Vala.GirParser : CodeVisitor { parse_signal (); } else { // error - Report.error (get_current_src (), "unknown child element `%s' in `class'".printf (reader.name)); + Report.error (get_current_src (), _("unknown child element `%s' in `class'").printf (reader.name)); skip_element (); } @@ -2942,7 +2942,7 @@ public class Vala.GirParser : CodeVisitor { parse_signal (); } else { // error - Report.error (get_current_src (), "unknown child element `%s' in `interface'".printf (reader.name)); + Report.error (get_current_src (), _("unknown child element `%s' in `interface'").printf (reader.name)); skip_element (); } @@ -3245,7 +3245,7 @@ public class Vala.GirParser : CodeVisitor { s.set_attribute_double ("CCode", "instance_pos", instance_idx + 0.5); } } else { - Report.error (get_current_src (), "instance_idx required when converting function to method"); + Report.error (get_current_src (), _("instance_idx required when converting function to method")); } } @@ -3423,7 +3423,7 @@ public class Vala.GirParser : CodeVisitor { parse_union (); } else { // error - Report.error (get_current_src (), "unknown child element `%s' in `class'".printf (reader.name)); + Report.error (get_current_src (), _("unknown child element `%s' in `class'").printf (reader.name)); skip_element (); } @@ -3466,7 +3466,7 @@ public class Vala.GirParser : CodeVisitor { parse_field (); } else { // error - Report.error (get_current_src (), "unknown child element `%s' in `transparent union'".printf (reader.name)); + Report.error (get_current_src (), _("unknown child element `%s' in `transparent union'").printf (reader.name)); skip_element (); } @@ -3511,7 +3511,7 @@ public class Vala.GirParser : CodeVisitor { parse_record (); } else { // error - Report.error (get_current_src (), "unknown child element `%s' in `union'".printf (reader.name)); + Report.error (get_current_src (), _("unknown child element `%s' in `union'").printf (reader.name)); skip_element (); } @@ -3558,7 +3558,7 @@ public class Vala.GirParser : CodeVisitor { } if (metadata.args.size == 0 && metadata.children.size == 0) { - Report.warning (metadata.source_reference, "empty metadata"); + Report.warning (metadata.source_reference, _("empty metadata")); return; } @@ -3566,13 +3566,13 @@ public class Vala.GirParser : CodeVisitor { var arg = metadata.args[arg_type]; if (!arg.used) { // if metadata is used and argument is not, then it's a unexpected argument - Report.warning (arg.source_reference, "argument never used"); + Report.warning (arg.source_reference, _("argument never used")); } } foreach (var child in metadata.children) { if (!child.used) { - Report.warning (child.source_reference, "metadata never used"); + Report.warning (child.source_reference, _("metadata never used")); } else { report_unused_metadata (child); } @@ -3745,7 +3745,7 @@ public class Vala.GirParser : CodeVisitor { alias.symbol = deleg; } else if (type_sym != null) { - Report.warning (alias.source_reference, "alias `%s' for `%s' is not supported".printf (alias.get_full_name (), type_sym.get_full_name ())); + Report.warning (alias.source_reference, _("alias `%s' for `%s' is not supported").printf (alias.get_full_name (), type_sym.get_full_name ())); alias.symbol = type_sym; alias.merged = true; } @@ -3776,7 +3776,7 @@ public class Vala.GirParser : CodeVisitor { if (return_type is ArrayType && node.return_array_length_idx >= 0) { if (node.return_array_length_idx >= parameters.size) { - Report.error (return_type.source_reference, "invalid array length index"); + Report.error (return_type.source_reference, _("invalid array length index")); } else { parameters[node.return_array_length_idx].keep = false; node.array_length_parameters.add (node.return_array_length_idx); @@ -3923,7 +3923,7 @@ public class Vala.GirParser : CodeVisitor { if (info.array_length_idx != -1) { if ((info.array_length_idx) >= parameters.size) { - Report.error (info.param.source_reference, "invalid array_length index"); + Report.error (info.param.source_reference, _("invalid array_length index")); continue; } set_array_ccode (info.param, parameters[info.array_length_idx]); @@ -3931,7 +3931,7 @@ public class Vala.GirParser : CodeVisitor { if (info.closure_idx != -1) { if ((info.closure_idx) >= parameters.size) { - Report.error (info.param.source_reference, "invalid closure index"); + Report.error (info.param.source_reference, _("invalid closure index")); continue; } if ("%g".printf (parameters[info.closure_idx].vala_idx) != "%g".printf (info.vala_idx + 0.1)) { @@ -3940,7 +3940,7 @@ public class Vala.GirParser : CodeVisitor { } if (info.destroy_idx != -1) { if (info.destroy_idx >= parameters.size) { - Report.error (info.param.source_reference, "invalid destroy index"); + Report.error (info.param.source_reference, _("invalid destroy index")); continue; } if ("%g".printf (parameters[info.destroy_idx].vala_idx) != "%g".printf (info.vala_idx + 0.2)) { @@ -4055,7 +4055,7 @@ public class Vala.GirParser : CodeVisitor { void process_virtual_method_field (Node node, Delegate d, UnresolvedSymbol gtype_struct_for) { var gtype_node = resolve_node (node.parent, gtype_struct_for); if (gtype_node == null || !(gtype_node.symbol is ObjectTypeSymbol)) { - Report.error (gtype_struct_for.source_reference, "Unknown symbol `%s' for virtual method field `%s'".printf (gtype_struct_for.to_string (), node.to_string ())); + Report.error (gtype_struct_for.source_reference, _("Unknown symbol `%s' for virtual method field `%s'").printf (gtype_struct_for.to_string (), node.to_string ())); } var nodes = gtype_node.lookup_all (d.name); if (nodes == null) { diff --git a/vala/valaifstatement.vala b/vala/valaifstatement.vala index 61c87ba3f..7fa1cbd71 100644 --- a/vala/valaifstatement.vala +++ b/vala/valaifstatement.vala @@ -134,7 +134,7 @@ public class Vala.IfStatement : CodeNode, Statement { if (condition.value_type == null || !condition.value_type.compatible (context.analyzer.bool_type)) { error = true; - Report.error (condition.source_reference, "Condition must be boolean"); + Report.error (condition.source_reference, _("Condition must be boolean")); return false; } diff --git a/vala/valainitializerlist.vala b/vala/valainitializerlist.vala index f7d806cfe..c57a6324b 100644 --- a/vala/valainitializerlist.vala +++ b/vala/valainitializerlist.vala @@ -138,7 +138,7 @@ public class Vala.InitializerList : Expression { if (target_type == null) { error = true; - Report.error (source_reference, "initializer list used for unknown type"); + Report.error (source_reference, _("initializer list used for unknown type")); return false; } else if (target_type is ArrayType) { /* initializer is used as array initializer */ @@ -198,7 +198,7 @@ public class Vala.InitializerList : Expression { while (field == null) { if (!field_it.next ()) { error = true; - Report.error (e.source_reference, "too many expressions in initializer list for `%s'".printf (target_type.to_string ())); + Report.error (e.source_reference, _("too many expressions in initializer list for `%s'").printf (target_type.to_string ())); return false; } field = field_it.get (); @@ -215,7 +215,7 @@ public class Vala.InitializerList : Expression { } } else { error = true; - Report.error (source_reference, "initializer list used for `%s', which is neither array nor struct".printf (target_type.to_string ())); + Report.error (source_reference, _("initializer list used for `%s', which is neither array nor struct").printf (target_type.to_string ())); return false; } @@ -227,7 +227,7 @@ public class Vala.InitializerList : Expression { foreach (Expression e in get_initializers ()) { if (e.value_type == null) { error = true; - Report.error (e.source_reference, "expression type not allowed as initializer"); + Report.error (e.source_reference, _("expression type not allowed as initializer")); continue; } @@ -237,7 +237,7 @@ public class Vala.InitializerList : Expression { } else if (!e.value_type.compatible (e.target_type)) { error = true; e.error = true; - Report.error (e.source_reference, "Expected initializer of type `%s' but got `%s'".printf (e.target_type.to_string (), e.value_type.to_string ())); + Report.error (e.source_reference, _("Expected initializer of type `%s' but got `%s'").printf (e.target_type.to_string (), e.value_type.to_string ())); } } diff --git a/vala/valainterface.vala b/vala/valainterface.vala index f6c503641..4d2e95aee 100644 --- a/vala/valainterface.vala +++ b/vala/valainterface.vala @@ -68,7 +68,7 @@ public class Vala.Interface : ObjectTypeSymbol { */ public override void add_method (Method m) { if (m is CreationMethod) { - Report.error (m.source_reference, "construction methods may only be declared within classes and structs"); + Report.error (m.source_reference, _("construction methods may only be declared within classes and structs")); m.error = true; return; @@ -92,7 +92,7 @@ public class Vala.Interface : ObjectTypeSymbol { */ public override void add_property (Property prop) { if (prop.field != null) { - Report.error (prop.source_reference, "interface properties should be `abstract' or have `get' accessor and/or `set' mutator"); + Report.error (prop.source_reference, _("interface properties should be `abstract' or have `get' accessor and/or `set' mutator")); prop.error = true; return; @@ -206,7 +206,7 @@ public class Vala.Interface : ObjectTypeSymbol { // check whether prerequisite is at least as accessible as the interface if (!context.analyzer.is_type_accessible (this, prerequisite_reference)) { error = true; - Report.error (source_reference, "prerequisite `%s' is less accessible than interface `%s'".printf (prerequisite_reference.to_string (), get_full_name ())); + Report.error (source_reference, _("prerequisite `%s' is less accessible than interface `%s'").printf (prerequisite_reference.to_string (), get_full_name ())); return false; } } @@ -223,7 +223,7 @@ public class Vala.Interface : ObjectTypeSymbol { if (!(class_or_interface is ObjectTypeSymbol)) { error = true; - Report.error (source_reference, "Prerequisite `%s' of interface `%s' is not a class or interface".printf (get_full_name (), class_or_interface.to_string ())); + Report.error (source_reference, _("Prerequisite `%s' of interface `%s' is not a class or interface").printf (get_full_name (), class_or_interface.to_string ())); return false; } @@ -231,7 +231,7 @@ public class Vala.Interface : ObjectTypeSymbol { if (class_or_interface is Class) { if (prereq_class != null) { error = true; - Report.error (source_reference, "%s: Interfaces cannot have multiple instantiable prerequisites (`%s' and `%s')".printf (get_full_name (), class_or_interface.get_full_name (), prereq_class.get_full_name ())); + Report.error (source_reference, _("%s: Interfaces cannot have multiple instantiable prerequisites (`%s' and `%s')").printf (get_full_name (), class_or_interface.get_full_name (), prereq_class.get_full_name ())); return false; } @@ -322,7 +322,7 @@ public class Vala.Interface : ObjectTypeSymbol { foreach (Symbol sym in virtuals) { int ordering = sym.get_attribute_integer ("CCode", "ordering", -1); if (ordering < -1) { - Report.error (sym.source_reference, "%s: Invalid ordering".printf (sym.get_full_name ())); + Report.error (sym.source_reference, _("%s: Invalid ordering").printf (sym.get_full_name ())); // Mark state as invalid error = true; ordered_seen = true; @@ -331,12 +331,12 @@ public class Vala.Interface : ObjectTypeSymbol { } bool ordered = ordering != -1; if (ordered && unordered_seen && !ordered_seen) { - Report.error (sym.source_reference, "%s: Cannot mix ordered and unordered virtuals".printf (sym.get_full_name ())); + Report.error (sym.source_reference, _("%s: Cannot mix ordered and unordered virtuals").printf (sym.get_full_name ())); error = true; } ordered_seen = ordered_seen || ordered; if (!ordered && !unordered_seen && ordered_seen) { - Report.error (sym.source_reference, "%s: Cannot mix ordered and unordered virtuals".printf (sym.get_full_name ())); + Report.error (sym.source_reference, _("%s: Cannot mix ordered and unordered virtuals").printf (sym.get_full_name ())); error = true; } unordered_seen = unordered_seen || !ordered; @@ -344,7 +344,7 @@ public class Vala.Interface : ObjectTypeSymbol { if (ordered) { Symbol? prev = positions[ordering]; if (prev != null) { - Report.error (sym.source_reference, "%s: Duplicate ordering (previous virtual with the same position is %s)".printf (sym.get_full_name (), prev.name)); + Report.error (sym.source_reference, _("%s: Duplicate ordering (previous virtual with the same position is %s)").printf (sym.get_full_name (), prev.name)); error = true; } positions[ordering] = sym; @@ -355,7 +355,7 @@ public class Vala.Interface : ObjectTypeSymbol { for (int i = 0; i < virtuals.size; i++) { Symbol? sym = positions[i]; if (sym == null) { - Report.error (source_reference, "%s: Gap in ordering in position %d".printf (get_full_name (), i)); + Report.error (source_reference, _("%s: Gap in ordering in position %d").printf (get_full_name (), i)); error = true; } if (!error) { diff --git a/vala/valalambdaexpression.vala b/vala/valalambdaexpression.vala index a22497e70..7867c44b5 100644 --- a/vala/valalambdaexpression.vala +++ b/vala/valalambdaexpression.vala @@ -123,9 +123,9 @@ public class Vala.LambdaExpression : Expression { if (!(target_type is DelegateType)) { error = true; if (target_type != null) { - Report.error (source_reference, "Cannot convert lambda expression to `%s'".printf (target_type.to_string ())); + Report.error (source_reference, _("Cannot convert lambda expression to `%s'").printf (target_type.to_string ())); } else { - Report.error (source_reference, "lambda expression not allowed in this context"); + Report.error (source_reference, _("lambda expression not allowed in this context")); } return false; } @@ -183,7 +183,7 @@ public class Vala.LambdaExpression : Expression { if (lambda_param.direction != cb_param.direction) { error = true; - Report.error (lambda_param.source_reference, "direction of parameter `%s' is incompatible with the target delegate".printf (lambda_param.name)); + Report.error (lambda_param.source_reference, _("direction of parameter `%s' is incompatible with the target delegate").printf (lambda_param.name)); } lambda_param.variable_type = cb_param.variable_type.get_actual_type (target_type, null, this); @@ -193,7 +193,7 @@ public class Vala.LambdaExpression : Expression { if (lambda_param_it.next ()) { /* lambda expressions may not expect more parameters */ error = true; - Report.error (source_reference, "lambda expression: too many parameters"); + Report.error (source_reference, _("lambda expression: too many parameters")); return false; } diff --git a/vala/valalocalvariable.vala b/vala/valalocalvariable.vala index 3a2ecae01..7568822f3 100644 --- a/vala/valalocalvariable.vala +++ b/vala/valalocalvariable.vala @@ -95,7 +95,7 @@ public class Vala.LocalVariable : Variable { if (variable_type != null) { if (variable_type is VoidType) { error = true; - Report.error (source_reference, "'void' not supported as variable type"); + Report.error (source_reference, _("'void' not supported as variable type")); return false; } variable_type.check (context); @@ -124,17 +124,17 @@ public class Vala.LocalVariable : Variable { if (initializer == null) { error = true; - Report.error (source_reference, "var declaration not allowed without initializer"); + Report.error (source_reference, _("var declaration not allowed without initializer")); return false; } if (initializer.value_type == null) { error = true; - Report.error (source_reference, "var declaration not allowed with non-typed initializer"); + Report.error (source_reference, _("var declaration not allowed with non-typed initializer")); return false; } if (initializer.value_type is FieldPrototype || initializer.value_type is PropertyPrototype) { error = true; - Report.error (initializer.source_reference, "Access to instance member `%s' denied".printf (initializer.symbol_reference.get_full_name ())); + Report.error (initializer.source_reference, _("Access to instance member `%s' denied").printf (initializer.symbol_reference.get_full_name ())); return false; } @@ -157,7 +157,7 @@ public class Vala.LocalVariable : Variable { if (initializer.value_type == null) { if (!(initializer is MemberAccess) && !(initializer is LambdaExpression)) { error = true; - Report.error (source_reference, "expression type not allowed as initializer"); + Report.error (source_reference, _("expression type not allowed as initializer")); return false; } @@ -170,21 +170,21 @@ public class Vala.LocalVariable : Variable { /* check whether method matches callback type */ if (!cb.matches_method (m, dt)) { error = true; - Report.error (source_reference, "declaration of method `%s' doesn't match declaration of callback `%s'".printf (m.get_full_name (), cb.get_full_name ())); + Report.error (source_reference, _("declaration of method `%s' doesn't match declaration of callback `%s'").printf (m.get_full_name (), cb.get_full_name ())); return false; } initializer.value_type = variable_type; } else { error = true; - Report.error (source_reference, "expression type not allowed as initializer"); + Report.error (source_reference, _("expression type not allowed as initializer")); return false; } } if (!initializer.value_type.compatible (variable_type)) { error = true; - Report.error (source_reference, "Assignment: Cannot convert from `%s' to `%s'".printf (initializer.value_type.to_string (), variable_type.to_string ())); + Report.error (source_reference, _("Assignment: Cannot convert from `%s' to `%s'").printf (initializer.value_type.to_string (), variable_type.to_string ())); return false; } @@ -196,7 +196,7 @@ public class Vala.LocalVariable : Variable { if (variable_array_type != null && variable_array_type.inline_allocated && initializer.value_type is ArrayType == false) { error = true; - Report.error (source_reference, "only arrays are allowed as initializer for arrays with fixed length"); + Report.error (source_reference, _("only arrays are allowed as initializer for arrays with fixed length")); return false; } @@ -205,7 +205,7 @@ public class Vala.LocalVariable : Variable { if (!(variable_type is PointerType) && !variable_type.value_owned) { /* lhs doesn't own the value */ error = true; - Report.error (source_reference, "Invalid assignment from owned expression to unowned variable"); + Report.error (source_reference, _("Invalid assignment from owned expression to unowned variable")); return false; } } diff --git a/vala/valalockstatement.vala b/vala/valalockstatement.vala index e64d4a206..29c936ba6 100644 --- a/vala/valalockstatement.vala +++ b/vala/valalockstatement.vala @@ -109,7 +109,7 @@ public class Vala.LockStatement : CodeNode, Statement { if (!(resource is MemberAccess && resource.symbol_reference is Lockable)) { error = true; resource.error = true; - Report.error (resource.source_reference, "Expression is either not a member access or does not denote a lockable member"); + Report.error (resource.source_reference, _("Expression is either not a member access or does not denote a lockable member")); return false; } @@ -117,7 +117,7 @@ public class Vala.LockStatement : CodeNode, Statement { if (resource.symbol_reference.parent_symbol != context.analyzer.current_class) { error = true; resource.error = true; - Report.error (resource.source_reference, "Only members of the current class are lockable"); + Report.error (resource.source_reference, _("Only members of the current class are lockable")); return false; } @@ -125,7 +125,7 @@ public class Vala.LockStatement : CodeNode, Statement { if (context.analyzer.current_class.is_compact) { error = true; resource.error = true; - Report.error (resource.source_reference, "Only members of the non-compact classes are lockable"); + Report.error (resource.source_reference, _("Only members of the non-compact classes are lockable")); return false; } diff --git a/vala/valamarkupreader.vala b/vala/valamarkupreader.vala index 0197320dc..1abce8596 100644 --- a/vala/valamarkupreader.vala +++ b/vala/valamarkupreader.vala @@ -57,7 +57,7 @@ public class Vala.MarkupReader { line = 1; column = 1; } catch (FileError e) { - Report.error (null, "Unable to map file `%s': %s".printf (filename, e.message)); + Report.error (null, _("Unable to map file `%s': %s").printf (filename, e.message)); } } @@ -101,7 +101,7 @@ public class Vala.MarkupReader { if (u != (unichar) (-1)) { current += u.to_utf8 (null); } else { - Report.error (null, "invalid UTF-8 character"); + Report.error (null, _("invalid UTF-8 character")); } } if (current == begin) { @@ -230,7 +230,7 @@ public class Vala.MarkupReader { while (current < end && current[0] != end_char) { unichar u = ((string) current).get_char_validated ((long) (end - current)); if (u == (unichar) (-1)) { - Report.error (null, "invalid UTF-8 character"); + Report.error (null, _("invalid UTF-8 character")); } else if (u == '&') { char* next_pos = current + u.to_utf8 (null); if (((string) next_pos).has_prefix ("amp;")) { diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala index dfd68a4aa..9e0a4908b 100644 --- a/vala/valamemberaccess.vala +++ b/vala/valamemberaccess.vala @@ -228,7 +228,7 @@ public class Vala.MemberAccess : Expression { if (member_name == "this") { if (!context.analyzer.is_in_instance_method ()) { error = true; - Report.error (source_reference, "This access invalid outside of instance methods"); + Report.error (source_reference, _("This access invalid outside of instance methods")); return false; } } @@ -310,7 +310,7 @@ public class Vala.MemberAccess : Expression { if (local_sym != null) { if (symbol_reference != null && symbol_reference != local_sym) { error = true; - Report.error (source_reference, "`%s' is an ambiguous reference between `%s' and `%s'".printf (member_name, symbol_reference.get_full_name (), local_sym.get_full_name ())); + Report.error (source_reference, _("`%s' is an ambiguous reference between `%s' and `%s'").printf (member_name, symbol_reference.get_full_name (), local_sym.get_full_name ())); return false; } symbol_reference = local_sym; @@ -338,7 +338,7 @@ public class Vala.MemberAccess : Expression { var ma = (MemberAccess) inner; if (ma.prototype_access) { error = true; - Report.error (source_reference, "Access to instance member `%s' denied".printf (inner.symbol_reference.get_full_name ())); + Report.error (source_reference, _("Access to instance member `%s' denied").printf (inner.symbol_reference.get_full_name ())); return false; } } @@ -470,7 +470,7 @@ public class Vala.MemberAccess : Expression { base_type_name = base_symbol.get_full_name (); } - Report.error (source_reference, "The name `%s' does not exist in the context of `%s'".printf (member_name, base_type_name)); + Report.error (source_reference, _("The name `%s' does not exist in the context of `%s'").printf (member_name, base_type_name)); return false; } @@ -525,7 +525,7 @@ public class Vala.MemberAccess : Expression { if (param.direction != ParameterDirection.IN) { error = true; - Report.error (source_reference, "Cannot capture reference or output parameter `%s'".printf (param.get_full_name ())); + Report.error (source_reference, _("Cannot capture reference or output parameter `%s'").printf (param.get_full_name ())); } } else { var acc = param.parent_symbol.parent_symbol as PropertyAccessor; @@ -585,7 +585,7 @@ public class Vala.MemberAccess : Expression { } if (!is_valid_access) { error = true; - Report.error (source_reference, "Access to async callback `%s' not allowed in this context".printf (m.get_full_name ())); + Report.error (source_reference, _("Access to async callback `%s' not allowed in this context").printf (m.get_full_name ())); return false; } @@ -671,7 +671,7 @@ public class Vala.MemberAccess : Expression { if (lvalue) { if (prop.set_accessor == null) { error = true; - Report.error (source_reference, "Property `%s' is read-only".printf (prop.get_full_name ())); + Report.error (source_reference, _("Property `%s' is read-only").printf (prop.get_full_name ())); return false; } if (prop.access == SymbolAccessibility.PUBLIC) { @@ -683,7 +683,7 @@ public class Vala.MemberAccess : Expression { } else { if (prop.get_accessor == null) { error = true; - Report.error (source_reference, "Property `%s' is write-only".printf (prop.get_full_name ())); + Report.error (source_reference, _("Property `%s' is write-only").printf (prop.get_full_name ())); return false; } if (prop.access == SymbolAccessibility.PUBLIC) { @@ -732,7 +732,7 @@ public class Vala.MemberAccess : Expression { if (!in_subtype) { error = true; - Report.error (source_reference, "Access to protected member `%s' denied".printf (member.get_full_name ())); + Report.error (source_reference, _("Access to protected member `%s' denied").printf (member.get_full_name ())); return false; } } else if (access == SymbolAccessibility.PRIVATE) { @@ -748,7 +748,7 @@ public class Vala.MemberAccess : Expression { if (!in_target_type) { error = true; - Report.error (source_reference, "Access to private member `%s' denied".printf (member.get_full_name ())); + Report.error (source_reference, _("Access to private member `%s' denied").printf (member.get_full_name ())); return false; } } @@ -766,7 +766,7 @@ public class Vala.MemberAccess : Expression { if (object_type != null && object_type.type_symbol.has_type_parameters () && !instance_type.has_type_arguments ()) { error = true; - Report.error (inner.source_reference, "missing generic type arguments"); + Report.error (inner.source_reference, _("missing generic type arguments")); return false; } } @@ -806,14 +806,14 @@ public class Vala.MemberAccess : Expression { if (inner.symbol_reference is Method) { // do not warn when calling .begin or .end on static async method } else { - Report.warning (source_reference, "Access to static member `%s' with an instance reference".printf (symbol_reference.get_full_name ())); + Report.warning (source_reference, _("Access to static member `%s' with an instance reference").printf (symbol_reference.get_full_name ())); } } if (context.experimental_non_null && instance && inner.value_type.nullable && !(inner.value_type is PointerType) && !(inner.value_type is GenericType) && !(inner.value_type is ArrayType)) { - Report.error (source_reference, "Access to instance member `%s' from nullable reference denied".printf (symbol_reference.get_full_name ())); + Report.error (source_reference, _("Access to instance member `%s' from nullable reference denied").printf (symbol_reference.get_full_name ())); } var m = symbol_reference as Method; diff --git a/vala/valamethod.vala b/vala/valamethod.vala index 22980085f..b674463a0 100644 --- a/vala/valamethod.vala +++ b/vala/valamethod.vala @@ -615,7 +615,7 @@ public class Vala.Method : Subroutine, Callable { if (!compatible (base_method, out invalid_match)) { error = true; var base_method_type = new MethodType (base_method); - Report.error (source_reference, "overriding method `%s' is incompatible with base method `%s': %s.".printf (get_full_name (), base_method_type.to_prototype_string (), invalid_match)); + Report.error (source_reference, _("overriding method `%s' is incompatible with base method `%s': %s.").printf (get_full_name (), base_method_type.to_prototype_string (), invalid_match)); return; } @@ -684,12 +684,12 @@ public class Vala.Method : Subroutine, Callable { } else if (invalid_base_match != null) { error = true; var base_method_type = new MethodType (invalid_base_match); - Report.error (source_reference, "overriding method `%s' is incompatible with base method `%s': %s.".printf (get_full_name (), base_method_type.to_prototype_string (), invalid_error)); + Report.error (source_reference, _("overriding method `%s' is incompatible with base method `%s': %s.").printf (get_full_name (), base_method_type.to_prototype_string (), invalid_error)); return; } if (base_interface_type != null) { - Report.error (source_reference, "`%s': no suitable interface method found to implement".printf (get_full_name ())); + Report.error (source_reference, _("`%s': no suitable interface method found to implement").printf (get_full_name ())); } } @@ -711,14 +711,14 @@ public class Vala.Method : Subroutine, Callable { var cl = (Class) parent_symbol; if (cl.is_compact && cl.base_class != null) { error = true; - Report.error (source_reference, "Abstract and virtual methods may not be declared in derived compact classes"); + Report.error (source_reference, _("Abstract and virtual methods may not be declared in derived compact classes")); return false; } } if (is_variadic () && (is_abstract || is_virtual)) { error = true; - Report.error (source_reference, "Abstract and virtual methods may not be variadic. Use a `va_list' parameter instead of `...'."); + Report.error (source_reference, _("Abstract and virtual methods may not be variadic. Use a `va_list' parameter instead of `...'.")); return false; } @@ -727,47 +727,47 @@ public class Vala.Method : Subroutine, Callable { var cl = (Class) parent_symbol; if (!cl.is_abstract) { error = true; - Report.error (source_reference, "Abstract methods may not be declared in non-abstract classes"); + Report.error (source_reference, _("Abstract methods may not be declared in non-abstract classes")); return false; } } else if (!(parent_symbol is Interface)) { error = true; - Report.error (source_reference, "Abstract methods may not be declared outside of classes and interfaces"); + Report.error (source_reference, _("Abstract methods may not be declared outside of classes and interfaces")); return false; } } else if (is_virtual) { if (!(parent_symbol is Class) && !(parent_symbol is Interface)) { error = true; - Report.error (source_reference, "Virtual methods may not be declared outside of classes and interfaces"); + Report.error (source_reference, _("Virtual methods may not be declared outside of classes and interfaces")); return false; } } else if (overrides) { if (!(parent_symbol is Class)) { error = true; - Report.error (source_reference, "Methods may not be overridden outside of classes"); + Report.error (source_reference, _("Methods may not be overridden outside of classes")); return false; } } else if (access == SymbolAccessibility.PROTECTED) { if (!(parent_symbol is Class) && !(parent_symbol is Interface)) { error = true; - Report.error (source_reference, "Protected methods may not be declared outside of classes and interfaces"); + Report.error (source_reference, _("Protected methods may not be declared outside of classes and interfaces")); return false; } } if (is_abstract && body != null) { - Report.error (source_reference, "Abstract methods cannot have bodies"); + Report.error (source_reference, _("Abstract methods cannot have bodies")); } else if ((is_abstract || is_virtual) && external && !external_package && !parent_symbol.external) { - Report.error (source_reference, "Extern methods cannot be abstract or virtual"); + Report.error (source_reference, _("Extern methods cannot be abstract or virtual")); } else if (external && body != null) { - Report.error (source_reference, "Extern methods cannot have bodies"); + Report.error (source_reference, _("Extern methods cannot have bodies")); } else if (!is_abstract && !external && source_type == SourceFileType.SOURCE && body == null) { - Report.error (source_reference, "Non-abstract, non-extern methods must have bodies"); + Report.error (source_reference, _("Non-abstract, non-extern methods must have bodies")); } if (coroutine && !external_package && !context.has_package ("gio-2.0")) { error = true; - Report.error (source_reference, "gio-2.0 package required for async methods"); + Report.error (source_reference, _("gio-2.0 package required for async methods")); return false; } @@ -794,7 +794,7 @@ public class Vala.Method : Subroutine, Callable { if (parameters.size == 1 && parameters[0].ellipsis && body != null && binding != MemberBinding.INSTANCE) { // accept just `...' for external methods and instance methods error = true; - Report.error (parameters[0].source_reference, "Named parameter required before `...'"); + Report.error (parameters[0].source_reference, _("Named parameter required before `...'")); } var optional_param = false; @@ -802,14 +802,14 @@ public class Vala.Method : Subroutine, Callable { param.check (context); if (coroutine && param.direction == ParameterDirection.REF) { error = true; - Report.error (param.source_reference, "Reference parameters are not supported for async methods"); + Report.error (param.source_reference, _("Reference parameters are not supported for async methods")); } // TODO: begin and end parameters must be checked separately for coroutines if (coroutine) { continue; } if (optional_param && param.initializer == null && !param.ellipsis) { - Report.warning (param.source_reference, "parameter without default follows parameter with default"); + Report.warning (param.source_reference, _("parameter without default follows parameter with default")); } else if (param.initializer != null) { optional_param = true; } @@ -836,7 +836,7 @@ public class Vala.Method : Subroutine, Callable { // check whether error type is at least as accessible as the method if (!context.analyzer.is_type_accessible (this, error_type)) { error = true; - Report.error (source_reference, "error type `%s' is less accessible than method `%s'".printf (error_type.to_string (), get_full_name ())); + Report.error (source_reference, _("error type `%s' is less accessible than method `%s'").printf (error_type.to_string (), get_full_name ())); return false; } } @@ -865,14 +865,14 @@ public class Vala.Method : Subroutine, Callable { if (context.analyzer.current_struct != null) { if (is_abstract || is_virtual || overrides) { error = true; - Report.error (source_reference, "A struct member `%s' cannot be marked as override, virtual, or abstract".printf (get_full_name ())); + Report.error (source_reference, _("A struct member `%s' cannot be marked as override, virtual, or abstract").printf (get_full_name ())); return false; } } else if (overrides && base_method == null) { - Report.error (source_reference, "`%s': no suitable method found to override".printf (get_full_name ())); + Report.error (source_reference, _("`%s': no suitable method found to override").printf (get_full_name ())); } else if ((is_abstract || is_virtual || overrides) && access == SymbolAccessibility.PRIVATE) { error = true; - Report.error (source_reference, "Private member `%s' cannot be marked as override, virtual, or abstract".printf (get_full_name ())); + Report.error (source_reference, _("Private member `%s' cannot be marked as override, virtual, or abstract").printf (get_full_name ())); return false; } @@ -883,7 +883,7 @@ public class Vala.Method : Subroutine, Callable { m.checked = true; m.error = true; error = true; - Report.error (source_reference, "`%s' already contains an implementation for `%s'".printf (cl.get_full_name (), base_interface_method.get_full_name ())); + Report.error (source_reference, _("`%s' already contains an implementation for `%s'").printf (cl.get_full_name (), base_interface_method.get_full_name ())); Report.notice (m.source_reference, "previous implementation of `%s' was here".printf (base_interface_method.get_full_name ())); return false; } @@ -894,13 +894,13 @@ public class Vala.Method : Subroutine, Callable { context.analyzer.current_symbol = old_symbol; if (!external_package && !overrides && !hides && get_hidden_member () != null) { - Report.warning (source_reference, "%s hides inherited method `%s'. Use the `new' keyword if hiding was intentional".printf (get_full_name (), get_hidden_member ().get_full_name ())); + Report.warning (source_reference, _("%s hides inherited method `%s'. Use the `new' keyword if hiding was intentional").printf (get_full_name (), get_hidden_member ().get_full_name ())); } // check whether return type is at least as accessible as the method if (!context.analyzer.is_type_accessible (this, return_type)) { error = true; - Report.error (source_reference, "return type `%s' is less accessible than method `%s'".printf (return_type.to_string (), get_full_name ())); + Report.error (source_reference, _("return type `%s' is less accessible than method `%s'").printf (return_type.to_string (), get_full_name ())); return false; } @@ -913,7 +913,7 @@ public class Vala.Method : Subroutine, Callable { if (!precondition.value_type.compatible (context.analyzer.bool_type)) { error = true; - Report.error (precondition.source_reference, "Precondition must be boolean"); + Report.error (precondition.source_reference, _("Precondition must be boolean")); return false; } } @@ -927,7 +927,7 @@ public class Vala.Method : Subroutine, Callable { if (!postcondition.value_type.compatible (context.analyzer.bool_type)) { error = true; - Report.error (postcondition.source_reference, "Postcondition must be boolean"); + Report.error (postcondition.source_reference, _("Postcondition must be boolean")); return false; } } @@ -947,7 +947,7 @@ public class Vala.Method : Subroutine, Callable { } bool is_dynamic_error = body_error_type is ErrorType && ((ErrorType) body_error_type).dynamic_error; if (!can_propagate_error && !is_dynamic_error) { - Report.warning (body_error_type.source_reference, "unhandled error `%s'".printf (body_error_type.to_string())); + Report.warning (body_error_type.source_reference, _("unhandled error `%s'").printf (body_error_type.to_string())); } } } @@ -980,7 +980,7 @@ public class Vala.Method : Subroutine, Callable { } } if (!throws_gerror && !(throws_gioerror && throws_gdbuserror)) { - Report.warning (source_reference, "DBus methods are recommended to throw at least `GLib.Error' or `GLib.DBusError, GLib.IOError'"); + Report.warning (source_reference, _("DBus methods are recommended to throw at least `GLib.Error' or `GLib.DBusError, GLib.IOError'")); } } } @@ -988,22 +988,22 @@ public class Vala.Method : Subroutine, Callable { if (is_possible_entry_point (context)) { if (context.entry_point != null) { error = true; - Report.error (source_reference, "program already has an entry point `%s'".printf (context.entry_point.get_full_name ())); + Report.error (source_reference, _("program already has an entry point `%s'").printf (context.entry_point.get_full_name ())); return false; } entry_point = true; context.entry_point = this; if (tree_can_fail) { - Report.error (source_reference, "\"main\" method cannot throw errors"); + Report.error (source_reference, _("`main' method cannot throw errors")); } if (is_inline) { - Report.error (source_reference, "\"main\" method cannot be inline"); + Report.error (source_reference, _("`main' method cannot be inline")); } if (coroutine) { - Report.error (source_reference, "\"main\" method cannot be async"); + Report.error (source_reference, _("`main' method cannot be async")); } } diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala index 80d0d772f..418c4055e 100644 --- a/vala/valamethodcall.vala +++ b/vala/valamethodcall.vala @@ -192,7 +192,7 @@ public class Vala.MethodCall : Expression { var ma = (MemberAccess) call; if (ma.prototype_access) { error = true; - Report.error (source_reference, "Access to instance member `%s' denied".printf (call.symbol_reference.get_full_name ())); + Report.error (source_reference, _("Access to instance member `%s' denied").printf (call.symbol_reference.get_full_name ())); return false; } @@ -261,11 +261,11 @@ public class Vala.MethodCall : Expression { var cm = context.analyzer.find_current_method () as CreationMethod; if (cm == null) { error = true; - Report.error (source_reference, "invocation not supported in this context"); + Report.error (source_reference, _("invocation not supported in this context")); return false; } else if (cm.chain_up) { error = true; - Report.error (source_reference, "Multiple constructor calls in the same constructor are not permitted"); + Report.error (source_reference, _("Multiple constructor calls in the same constructor are not permitted")); return false; } cm.chain_up = true; @@ -276,25 +276,25 @@ public class Vala.MethodCall : Expression { base_cm = cl.default_construction_method; if (base_cm == null) { error = true; - Report.error (source_reference, "chain up to `%s' not supported".printf (cl.get_full_name ())); + Report.error (source_reference, _("chain up to `%s' not supported").printf (cl.get_full_name ())); return false; } else if (!base_cm.has_construct_function) { error = true; - Report.error (source_reference, "chain up to `%s' not supported".printf (base_cm.get_full_name ())); + Report.error (source_reference, _("chain up to `%s' not supported").printf (base_cm.get_full_name ())); return false; } } else if (call.symbol_reference is CreationMethod && call.symbol_reference.parent_symbol is Class) { base_cm = (CreationMethod) call.symbol_reference; if (!base_cm.has_construct_function) { error = true; - Report.error (source_reference, "chain up to `%s' not supported".printf (base_cm.get_full_name ())); + Report.error (source_reference, _("chain up to `%s' not supported").printf (base_cm.get_full_name ())); return false; } } else if (gobject_chainup) { var cl = cm.parent_symbol as Class; if (cl == null || !cl.is_subtype_of (context.analyzer.object_type)) { error = true; - Report.error (source_reference, "chain up to `GLib.Object' not supported"); + Report.error (source_reference, _("chain up to `GLib.Object' not supported")); return false; } call.value_type = new ObjectType (context.analyzer.object_type); @@ -310,7 +310,7 @@ public class Vala.MethodCall : Expression { var st = call.symbol_reference as Struct; if (st != null && st.default_construction_method == null && (st.is_boolean_type () || st.is_integer_type () || st.is_floating_type ())) { error = true; - Report.error (source_reference, "invocation not supported in this context"); + Report.error (source_reference, _("invocation not supported in this context")); return false; } @@ -326,24 +326,24 @@ public class Vala.MethodCall : Expression { return true; } else if (!is_chainup && call is MemberAccess && call.symbol_reference is CreationMethod) { error = true; - Report.error (source_reference, "use `new' operator to create new objects"); + Report.error (source_reference, _("use `new' operator to create new objects")); return false; } if (!is_chainup && mtype is ObjectType) { // prevent funny stuff like (new Object ()) () error = true; - Report.error (source_reference, "invocation not supported in this context"); + Report.error (source_reference, _("invocation not supported in this context")); return false; } else if (mtype != null && mtype.is_invokable ()) { // call ok, expression is invokable } else if (call.symbol_reference is Class) { error = true; - Report.error (source_reference, "use `new' operator to create new objects"); + Report.error (source_reference, _("use `new' operator to create new objects")); return false; } else { error = true; - Report.error (source_reference, "invocation not supported in this context"); + Report.error (source_reference, _("invocation not supported in this context")); return false; } @@ -369,7 +369,7 @@ public class Vala.MethodCall : Expression { } } else if (ma.member_name == "begin" || ma.member_name == "end") { error = true; - Report.error (ma.source_reference, "use of `%s' not allowed in yield statement".printf (ma.member_name)); + Report.error (ma.source_reference, _("use of `%s' not allowed in yield statement").printf (ma.member_name)); } } @@ -379,11 +379,11 @@ public class Vala.MethodCall : Expression { int n_type_args = ma.get_type_arguments ().size; if (n_type_args > 0 && n_type_args < n_type_params) { error = true; - Report.error (ma.source_reference, "too few type arguments"); + Report.error (ma.source_reference, _("too few type arguments")); return false; } else if (n_type_args > 0 && n_type_args > n_type_params) { error = true; - Report.error (ma.source_reference, "too many type arguments"); + Report.error (ma.source_reference, _("too many type arguments")); return false; } } @@ -503,7 +503,7 @@ public class Vala.MethodCall : Expression { // A void method invocation can be in the initializer or // iterator of a for statement error = true; - Report.error (source_reference, "invocation of void method not allowed as expression"); + Report.error (source_reference, _("invocation of void method not allowed as expression")); return false; } } @@ -516,11 +516,11 @@ public class Vala.MethodCall : Expression { if (is_yield_expression) { if (!m.coroutine) { error = true; - Report.error (source_reference, "yield expression requires async method"); + Report.error (source_reference, _("yield expression requires async method")); } if (context.analyzer.current_method == null || !context.analyzer.current_method.coroutine) { error = true; - Report.error (source_reference, "yield expression not available outside async method"); + Report.error (source_reference, _("yield expression not available outside async method")); } } @@ -540,7 +540,7 @@ public class Vala.MethodCall : Expression { var param = get_argument_list ()[0]; if (param is LambdaExpression) { error = true; - Report.error (source_reference, "Cannot disconnect lambda expression from signal"); + Report.error (source_reference, _("Cannot disconnect lambda expression from signal")); return false; } } @@ -593,7 +593,7 @@ public class Vala.MethodCall : Expression { if (type_arg == null) { error = true; - Report.error (ma.source_reference, "cannot infer generic type argument for type parameter `%s'".printf (type_param.get_full_name ())); + Report.error (ma.source_reference, _("cannot infer generic type argument for type parameter `%s'").printf (type_param.get_full_name ())); return false; } @@ -647,7 +647,7 @@ public class Vala.MethodCall : Expression { // simple statements, no side effects after method call } else if (!(context.analyzer.current_symbol is Block)) { // can't handle errors in field initializers - Report.error (source_reference, "Field initializers must not throw errors"); + Report.error (source_reference, _("Field initializers must not throw errors")); } else { // store parent_node as we need to replace the expression in the old parent node later on var old_parent_node = parent_node; diff --git a/vala/valanamespace.vala b/vala/valanamespace.vala index c53fda830..fd649f4dd 100644 --- a/vala/valanamespace.vala +++ b/vala/valanamespace.vala @@ -391,11 +391,11 @@ public class Vala.Namespace : Symbol { } if (f.binding == MemberBinding.INSTANCE) { - Report.error (f.source_reference, "instance members are not allowed outside of data types"); + Report.error (f.source_reference, _("instance members are not allowed outside of data types")); f.error = true; return; } else if (f.binding == MemberBinding.CLASS) { - Report.error (f.source_reference, "class members are not allowed outside of classes"); + Report.error (f.source_reference, _("class members are not allowed outside of classes")); f.error = true; return; } @@ -425,16 +425,16 @@ public class Vala.Namespace : Symbol { } if (m is CreationMethod) { - Report.error (m.source_reference, "construction methods may only be declared within classes and structs"); + Report.error (m.source_reference, _("construction methods may only be declared within classes and structs")); m.error = true; return; } if (m.binding == MemberBinding.INSTANCE) { - Report.error (m.source_reference, "instance members are not allowed outside of data types"); + Report.error (m.source_reference, _("instance members are not allowed outside of data types")); m.error = true; return; } else if (m.binding == MemberBinding.CLASS) { - Report.error (m.source_reference, "class members are not allowed outside of classes"); + Report.error (m.source_reference, _("class members are not allowed outside of classes")); m.error = true; return; } diff --git a/vala/valaobjectcreationexpression.vala b/vala/valaobjectcreationexpression.vala index 0b6a29391..f5af92783 100644 --- a/vala/valaobjectcreationexpression.vala +++ b/vala/valaobjectcreationexpression.vala @@ -193,7 +193,7 @@ public class Vala.ObjectCreationExpression : Expression { if (type_reference == null) { if (member_name == null) { error = true; - Report.error (source_reference, "Incomplete object creation expression"); + Report.error (source_reference, _("Incomplete object creation expression")); return false; } @@ -213,7 +213,7 @@ public class Vala.ObjectCreationExpression : Expression { var constructor = (Method) constructor_sym; if (!(constructor_sym is CreationMethod)) { error = true; - Report.error (source_reference, "`%s' is not a creation method".printf (constructor.get_full_name ())); + Report.error (source_reference, _("`%s' is not a creation method").printf (constructor.get_full_name ())); return false; } @@ -241,7 +241,7 @@ public class Vala.ObjectCreationExpression : Expression { symbol_reference = type_sym; } else { error = true; - Report.error (source_reference, "`%s' is not a class, struct, or error code".printf (type_sym.get_full_name ())); + Report.error (source_reference, _("`%s' is not a class, struct, or error code").printf (type_sym.get_full_name ())); return false; } @@ -265,14 +265,14 @@ public class Vala.ObjectCreationExpression : Expression { if (struct_creation) { error = true; - Report.error (source_reference, "syntax error, use `new' to create new objects"); + Report.error (source_reference, _("syntax error, use `new' to create new objects")); return false; } if (cl.is_abstract) { value_type = null; error = true; - Report.error (source_reference, "Can't create instance of abstract class `%s'".printf (cl.get_full_name ())); + Report.error (source_reference, _("Can't create instance of abstract class `%s'").printf (cl.get_full_name ())); return false; } @@ -281,7 +281,7 @@ public class Vala.ObjectCreationExpression : Expression { if (symbol_reference == null) { error = true; - Report.error (source_reference, "`%s' does not have a default constructor".printf (cl.get_full_name ())); + Report.error (source_reference, _("`%s' does not have a default constructor").printf (cl.get_full_name ())); return false; } @@ -302,7 +302,7 @@ public class Vala.ObjectCreationExpression : Expression { if (!in_target_type) { error = true; - Report.error (source_reference, "Access to non-public constructor `%s' denied".printf (symbol_reference.get_full_name ())); + Report.error (source_reference, _("Access to non-public constructor `%s' denied").printf (symbol_reference.get_full_name ())); return false; } } @@ -322,7 +322,7 @@ public class Vala.ObjectCreationExpression : Expression { expected_num_type_args = st.get_type_parameters ().size; if (!struct_creation && !context.deprecated) { - Report.warning (source_reference, "deprecated syntax, don't use `new' to initialize structs"); + Report.warning (source_reference, _("deprecated syntax, don't use `new' to initialize structs")); } if (symbol_reference == null) { @@ -331,25 +331,25 @@ public class Vala.ObjectCreationExpression : Expression { if (context.profile == Profile.GOBJECT && st.is_simple_type () && symbol_reference == null && object_initializer.size == 0) { error = true; - Report.error (source_reference, "`%s' does not have a default constructor".printf (st.get_full_name ())); + Report.error (source_reference, _("`%s' does not have a default constructor").printf (st.get_full_name ())); return false; } } if (expected_num_type_args > given_num_type_args) { error = true; - Report.error (source_reference, "too few type arguments"); + Report.error (source_reference, _("too few type arguments")); return false; } else if (expected_num_type_args < given_num_type_args) { error = true; - Report.error (source_reference, "too many type arguments"); + Report.error (source_reference, _("too many type arguments")); return false; } if (symbol_reference == null && get_argument_list ().size != 0) { value_type = null; error = true; - Report.error (source_reference, "No arguments allowed when constructing type `%s'".printf (type.get_full_name ())); + Report.error (source_reference, _("No arguments allowed when constructing type `%s'").printf (type.get_full_name ())); return false; } @@ -359,11 +359,11 @@ public class Vala.ObjectCreationExpression : Expression { if (is_yield_expression) { if (!m.coroutine) { error = true; - Report.error (source_reference, "yield expression requires async method"); + Report.error (source_reference, _("yield expression requires async method")); } if (context.analyzer.current_method == null || !context.analyzer.current_method.coroutine) { error = true; - Report.error (source_reference, "yield expression not available outside async method"); + Report.error (source_reference, _("yield expression not available outside async method")); } } @@ -449,14 +449,14 @@ public class Vala.ObjectCreationExpression : Expression { if (get_argument_list ().size == 0) { error = true; - Report.error (source_reference, "Too few arguments, errors need at least 1 argument"); + Report.error (source_reference, _("Too few arguments, errors need at least 1 argument")); } else { Iterator arg_it = get_argument_list ().iterator (); arg_it.next (); var ex = arg_it.get (); if (ex.value_type == null || !ex.value_type.compatible (context.analyzer.string_type)) { error = true; - Report.error (source_reference, "Invalid type for argument 1"); + Report.error (source_reference, _("Invalid type for argument 1")); } var format_literal = StringLiteral.get_format_literal (ex); @@ -486,7 +486,7 @@ public class Vala.ObjectCreationExpression : Expression { // simple statements, no side effects after method call } else if (!(context.analyzer.current_symbol is Block)) { // can't handle errors in field initializers - Report.error (source_reference, "Field initializers must not throw errors"); + Report.error (source_reference, _("Field initializers must not throw errors")); } else { // store parent_node as we need to replace the expression in the old parent node later on var old_parent_node = parent_node; diff --git a/vala/valaobjecttype.vala b/vala/valaobjecttype.vala index 4683f2081..ba83103bf 100644 --- a/vala/valaobjecttype.vala +++ b/vala/valaobjecttype.vala @@ -102,10 +102,10 @@ public class Vala.ObjectType : ReferenceType { int n_type_args = get_type_arguments ().size; if (n_type_args > 0 && n_type_args < type_symbol.get_type_parameters ().size) { - Report.error (source_reference, "too few type arguments"); + Report.error (source_reference, _("too few type arguments")); return false; } else if (n_type_args > 0 && n_type_args > type_symbol.get_type_parameters ().size) { - Report.error (source_reference, "too many type arguments"); + Report.error (source_reference, _("too many type arguments")); return false; } diff --git a/vala/valaparameter.vala b/vala/valaparameter.vala index 7c13a7c19..c0b238c5f 100644 --- a/vala/valaparameter.vala +++ b/vala/valaparameter.vala @@ -143,7 +143,7 @@ public class Vala.Parameter : Variable { if (variable_type != null) { if (variable_type is VoidType) { error = true; - Report.error (source_reference, "'void' not supported as parameter type"); + Report.error (source_reference, _("'void' not supported as parameter type")); return false; } variable_type.check (context); @@ -154,7 +154,7 @@ public class Vala.Parameter : Variable { if (params_array && !(variable_type is ArrayType)) { error = true; - Report.error (source_reference, "parameter array expected"); + Report.error (source_reference, _("parameter array expected")); return false; } @@ -173,15 +173,15 @@ public class Vala.Parameter : Variable { if (initializer is NullLiteral && !variable_type.nullable && direction != ParameterDirection.OUT) { - Report.warning (source_reference, "`null' incompatible with parameter type `%s'".printf (variable_type.to_string ())); + Report.warning (source_reference, _("`null' incompatible with parameter type `%s'").printf (variable_type.to_string ())); } else if (!(initializer is NullLiteral) && direction == ParameterDirection.OUT) { - Report.error (source_reference, "only `null' is allowed as default value for out parameters"); + Report.error (source_reference, _("only `null' is allowed as default value for out parameters")); } else if (direction == ParameterDirection.IN && !initializer.value_type.compatible (variable_type)) { - Report.error (initializer.source_reference, "Cannot convert from `%s' to `%s'".printf (initializer.value_type.to_string (), variable_type.to_string ())); + Report.error (initializer.source_reference, _("Cannot convert from `%s' to `%s'").printf (initializer.value_type.to_string (), variable_type.to_string ())); } else if (direction == ParameterDirection.REF) { - Report.error (source_reference, "default value not allowed for ref parameter"); + Report.error (source_reference, _("default value not allowed for ref parameter")); } else if (!initializer.is_accessible (this)) { - Report.error (initializer.source_reference, "default value is less accessible than method `%s'".printf (parent_symbol.get_full_name ())); + Report.error (initializer.source_reference, _("default value is less accessible than method `%s'").printf (parent_symbol.get_full_name ())); } } @@ -189,7 +189,7 @@ public class Vala.Parameter : Variable { // check whether parameter type is at least as accessible as the method if (!context.analyzer.is_type_accessible (this, variable_type)) { error = true; - Report.error (source_reference, "parameter type `%s' is less accessible than method `%s'".printf (variable_type.to_string (), parent_symbol.get_full_name ())); + Report.error (source_reference, _("parameter type `%s' is less accessible than method `%s'").printf (variable_type.to_string (), parent_symbol.get_full_name ())); } } diff --git a/vala/valaparser.vala b/vala/valaparser.vala index dbc3b778e..45c2a5f6c 100644 --- a/vala/valaparser.vala +++ b/vala/valaparser.vala @@ -118,7 +118,7 @@ public class Vala.Parser : CodeVisitor { void report_parse_error (ParseError e) { var begin = get_location (); next (); - Report.error (get_src (begin), "syntax error, " + e.message); + Report.error (get_src (begin), _("syntax error, ") + e.message); } inline bool expect (TokenType type) throws ParseError { @@ -293,7 +293,7 @@ public class Vala.Parser : CodeVisitor { // FIXME validate and unescape here and just pass unichar to CharacterLiteral var lit = new CharacterLiteral (get_last_string (), get_src (begin)); if (lit.error) { - Report.error (lit.source_reference, "invalid character literal"); + Report.error (lit.source_reference, _("invalid character literal")); } return lit; case TokenType.REGEX_LITERAL: @@ -343,7 +343,7 @@ public class Vala.Parser : CodeVisitor { if (accept (TokenType.CLOSE_BRACE)) { // only report error if it's not a secondary error if (context.report.get_errors () == 0) { - Report.error (get_last_src (), "unexpected `}'"); + Report.error (get_last_src (), _("unexpected `}'")); } } } catch (ParseError e) { @@ -444,11 +444,11 @@ public class Vala.Parser : CodeVisitor { value_owned = false; } else if (accept (TokenType.WEAK)) { if (!can_weak_ref && !context.deprecated) { - Report.warning (get_last_src (), "deprecated syntax, use `unowned` modifier"); + Report.warning (get_last_src (), _("deprecated syntax, use `unowned` modifier")); } value_owned = false; } else if (accept (TokenType.OWNED)) { - Report.warning (get_last_src (), "`owned' is default in this context"); + Report.warning (get_last_src (), _("`owned' is default in this context")); } } else { if (accept (TokenType.OWNED)) { @@ -456,7 +456,7 @@ public class Vala.Parser : CodeVisitor { } else { value_owned = false; if (accept (TokenType.UNOWNED)) { - Report.warning (get_last_src (), "`unowned' is default in this context"); + Report.warning (get_last_src (), _("`unowned' is default in this context")); } } } @@ -524,7 +524,7 @@ public class Vala.Parser : CodeVisitor { } if (accept (TokenType.OP_NEG)) { - Report.warning (get_last_src (), "obsolete syntax, types are non-null by default"); + Report.warning (get_last_src (), _("obsolete syntax, types are non-null by default")); } if (type is PointerType) { @@ -1003,7 +1003,7 @@ public class Vala.Parser : CodeVisitor { var call = expr as MethodCall; var object_creation = expr as ObjectCreationExpression; if (call == null && object_creation == null) { - Report.error (expr.source_reference, "syntax error, expected method call"); + Report.error (expr.source_reference, _("syntax error, expected method call")); throw new ParseError.SYNTAX ("expected method call"); } @@ -1717,7 +1717,7 @@ public class Vala.Parser : CodeVisitor { switch (current ()) { case TokenType.SEMICOLON: if (!accept_empty_body) { - Report.warning (get_current_src (), "%s-statement without body".printf (statement_name)); + Report.warning (get_current_src (), _("%s-statement without body").printf (statement_name)); } return parse_empty_statement (); case TokenType.IF: return parse_if_statement (); @@ -1763,7 +1763,7 @@ public class Vala.Parser : CodeVisitor { if (!accept (TokenType.CLOSE_BRACE)) { // only report error if it's not a secondary error if (context.report.get_errors () == 0) { - Report.error (get_current_src (), "expected `}'"); + Report.error (get_current_src (), _("expected `}'")); } } @@ -2018,7 +2018,7 @@ public class Vala.Parser : CodeVisitor { if (!accept (TokenType.VAR)) { type = parse_type (true, true); if (accept (TokenType.IN)) { - Report.error (type.source_reference, "syntax error, expected var or type"); + Report.error (type.source_reference, _("syntax error, expected var or type")); throw new ParseError.SYNTAX ("expected var or type"); } } @@ -2219,7 +2219,7 @@ public class Vala.Parser : CodeVisitor { if (attributes != null) { foreach (Attribute attr in (List) attributes) { if (node.get_attribute (attr.name) != null) { - Report.error (attr.source_reference, "duplicate attribute `%s'".printf (attr.name)); + Report.error (attr.source_reference, _("duplicate attribute `%s'").printf (attr.name)); } node.attributes.append (attr); } @@ -2233,13 +2233,13 @@ public class Vala.Parser : CodeVisitor { method.body = new Block (get_src (begin)); parse_statements (method.body); if (current () != TokenType.EOF) { - Report.error (get_current_src (), "expected end of file"); + Report.error (get_current_src (), _("expected end of file")); } method.body.source_reference.end = get_current_src ().end; if (!context.experimental) { - Report.warning (method.source_reference, "main blocks are experimental"); + Report.warning (method.source_reference, _("main blocks are experimental")); } parent.add_method (method); @@ -2420,7 +2420,7 @@ public class Vala.Parser : CodeVisitor { if (!accept (TokenType.CLOSE_BRACE)) { // only report error if it's not a secondary error if (context.report.get_errors () == 0) { - Report.error (get_current_src (), "expected `}'"); + Report.error (get_current_src (), _("expected `}'")); } } } @@ -2508,7 +2508,7 @@ public class Vala.Parser : CodeVisitor { if (!accept (TokenType.CLOSE_BRACE)) { // only report error if it's not a secondary error if (context.report.get_errors () == 0) { - Report.error (get_current_src (), "expected `}'"); + Report.error (get_current_src (), _("expected `}'")); } } @@ -2617,7 +2617,7 @@ public class Vala.Parser : CodeVisitor { set_attributes (c, attrs); if (ModifierFlags.STATIC in flags) { - Report.warning (c.source_reference, "the modifier `static' is not applicable to constants"); + Report.warning (c.source_reference, _("the modifier `static' is not applicable to constants")); } if (accept (TokenType.ASSIGN)) { @@ -2641,7 +2641,7 @@ public class Vala.Parser : CodeVisitor { set_attributes (f, attrs); if (ModifierFlags.STATIC in flags && ModifierFlags.CLASS in flags) { - Report.error (f.source_reference, "only one of `static' or `class' may be specified"); + Report.error (f.source_reference, _("only one of `static' or `class' may be specified")); } else if (ModifierFlags.STATIC in flags) { f.binding = MemberBinding.STATIC; } else if (ModifierFlags.CLASS in flags) { @@ -2649,13 +2649,13 @@ public class Vala.Parser : CodeVisitor { } if (parent is Struct && f.access != SymbolAccessibility.PUBLIC && f.binding == MemberBinding.INSTANCE) { - Report.warning (f.source_reference, "accessibility of struct fields can only be `public`"); + Report.warning (f.source_reference, _("accessibility of struct fields can only be `public`")); } if (ModifierFlags.ABSTRACT in flags || ModifierFlags.VIRTUAL in flags || ModifierFlags.OVERRIDE in flags) { - Report.error (f.source_reference, "abstract, virtual, and override modifiers are not applicable to fields"); + Report.error (f.source_reference, _("abstract, virtual, and override modifiers are not applicable to fields")); } if (ModifierFlags.EXTERN in flags || scanner.source_file.file_type == SourceFileType.PACKAGE) { f.external = true; @@ -2705,7 +2705,7 @@ public class Vala.Parser : CodeVisitor { method.add_type_parameter (type_param); } if (ModifierFlags.STATIC in flags && ModifierFlags.CLASS in flags) { - Report.error (method.source_reference, "only one of `static' or `class' may be specified"); + Report.error (method.source_reference, _("only one of `static' or `class' may be specified")); } else if (ModifierFlags.STATIC in flags) { method.binding = MemberBinding.STATIC; } else if (ModifierFlags.CLASS in flags) { @@ -2789,7 +2789,7 @@ public class Vala.Parser : CodeVisitor { prop.access = access; set_attributes (prop, attrs); if (ModifierFlags.STATIC in flags && ModifierFlags.CLASS in flags) { - Report.error (prop.source_reference, "only one of `static' or `class' may be specified"); + Report.error (prop.source_reference, _("only one of `static' or `class' may be specified")); } else if (ModifierFlags.STATIC in flags) { prop.binding = MemberBinding.STATIC; } else if (ModifierFlags.CLASS in flags) { @@ -2808,7 +2808,7 @@ public class Vala.Parser : CodeVisitor { prop.hides = true; } if (ModifierFlags.ASYNC in flags) { - Report.error (prop.source_reference, "async properties are not supported yet"); + Report.error (prop.source_reference, _("async properties are not supported yet")); } if (ModifierFlags.EXTERN in flags || scanner.source_file.file_type == SourceFileType.PACKAGE) { prop.external = true; @@ -2823,7 +2823,7 @@ public class Vala.Parser : CodeVisitor { do { parse_type (true, false); } while (accept (TokenType.COMMA)); - Report.error (prop.source_reference, "properties throwing errors are not supported yet"); + Report.error (prop.source_reference, _("properties throwing errors are not supported yet")); } expect (TokenType.OPEN_BRACE); while (current () != TokenType.CLOSE_BRACE) { @@ -2847,7 +2847,7 @@ public class Vala.Parser : CodeVisitor { } else { value_type.value_owned = false; if (accept (TokenType.UNOWNED)) { - Report.warning (get_last_src (), "property getters are `unowned' by default"); + Report.warning (get_last_src (), _("property getters are `unowned' by default")); } } @@ -2939,7 +2939,7 @@ public class Vala.Parser : CodeVisitor { } var c = new Constructor (get_src (begin)); if (ModifierFlags.STATIC in flags && ModifierFlags.CLASS in flags) { - Report.error (c.source_reference, "only one of `static' or `class' may be specified"); + Report.error (c.source_reference, _("only one of `static' or `class' may be specified")); } else if (ModifierFlags.STATIC in flags) { c.binding = MemberBinding.STATIC; } else if (ModifierFlags.CLASS in flags) { @@ -2962,10 +2962,10 @@ public class Vala.Parser : CodeVisitor { } var d = new Destructor (get_src (begin)); if (identifier != parent.name) { - Report.error (d.source_reference, "destructor and parent symbol name do not match"); + Report.error (d.source_reference, _("destructor and parent symbol name do not match")); } if (ModifierFlags.STATIC in flags && ModifierFlags.CLASS in flags) { - Report.error (d.source_reference, "only one of `static' or `class' may be specified"); + Report.error (d.source_reference, _("only one of `static' or `class' may be specified")); } else if (ModifierFlags.STATIC in flags) { d.binding = MemberBinding.STATIC; } else if (ModifierFlags.CLASS in flags) { @@ -3346,7 +3346,7 @@ public class Vala.Parser : CodeVisitor { if (ModifierFlags.ABSTRACT in flags || ModifierFlags.VIRTUAL in flags || ModifierFlags.OVERRIDE in flags) { - Report.error (method.source_reference, "abstract, virtual, and override modifiers are not applicable to creation methods"); + Report.error (method.source_reference, _("abstract, virtual, and override modifiers are not applicable to creation methods")); } if (ModifierFlags.ASYNC in flags) { method.coroutine = true; @@ -3402,7 +3402,7 @@ public class Vala.Parser : CodeVisitor { if (ModifierFlags.STATIC in flags) { if (!context.deprecated) { // TODO enable warning in future releases - Report.warning (get_last_src (), "deprecated syntax, use [CCode (has_target = false)]"); + Report.warning (get_last_src (), _("deprecated syntax, use [CCode (has_target = false)]")); } d.has_target = false; } @@ -3411,7 +3411,7 @@ public class Vala.Parser : CodeVisitor { } if (!d.get_attribute_bool ("CCode", "has_typedef", true)) { if (!d.external) { - Report.error (get_last_src (), "Delegates without definition must be external"); + Report.error (get_last_src (), _("Delegates without definition must be external")); } d.anonymous = true; } diff --git a/vala/valapointerindirection.vala b/vala/valapointerindirection.vala index 5e99b9dc0..695557c58 100644 --- a/vala/valapointerindirection.vala +++ b/vala/valapointerindirection.vala @@ -96,13 +96,13 @@ public class Vala.PointerIndirection : Expression { var pointer_type = (PointerType) inner.value_type; if (pointer_type.base_type is ReferenceType || pointer_type.base_type is VoidType) { error = true; - Report.error (source_reference, "Pointer indirection not supported for this expression"); + Report.error (source_reference, _("Pointer indirection not supported for this expression")); return false; } value_type = pointer_type.base_type; } else { error = true; - Report.error (source_reference, "Pointer indirection not supported for this expression"); + Report.error (source_reference, _("Pointer indirection not supported for this expression")); return false; } diff --git a/vala/valapostfixexpression.vala b/vala/valapostfixexpression.vala index 1dd646625..a2cdf51d7 100644 --- a/vala/valapostfixexpression.vala +++ b/vala/valapostfixexpression.vala @@ -112,7 +112,7 @@ public class Vala.PostfixExpression : Expression { if (!(inner.value_type is IntegerType) && !(inner.value_type is FloatingType) && !(inner.value_type is PointerType)) { error = true; - Report.error (source_reference, "unsupported lvalue in postfix expression"); + Report.error (source_reference, _("unsupported lvalue in postfix expression")); return false; } @@ -121,7 +121,7 @@ public class Vala.PostfixExpression : Expression { if (ma.prototype_access) { error = true; - Report.error (source_reference, "Access to instance member `%s' denied".printf (ma.symbol_reference.get_full_name ())); + Report.error (source_reference, _("Access to instance member `%s' denied").printf (ma.symbol_reference.get_full_name ())); return false; } @@ -134,12 +134,12 @@ public class Vala.PostfixExpression : Expression { var ea = (ElementAccess) inner; if (!(ea.container.value_type is ArrayType)) { error = true; - Report.error (source_reference, "unsupported lvalue in postfix expression"); + Report.error (source_reference, _("unsupported lvalue in postfix expression")); return false; } } else { error = true; - Report.error (source_reference, "unsupported lvalue in postfix expression"); + Report.error (source_reference, _("unsupported lvalue in postfix expression")); return false; } @@ -151,7 +151,7 @@ public class Vala.PostfixExpression : Expression { if (prop.set_accessor == null || !prop.set_accessor.writable) { ma.error = true; - Report.error (ma.source_reference, "Property `%s' is read-only".printf (prop.get_full_name ())); + Report.error (ma.source_reference, _("Property `%s' is read-only").printf (prop.get_full_name ())); return false; } } diff --git a/vala/valaproperty.vala b/vala/valaproperty.vala index cd1bcaff5..a36ac8cfb 100644 --- a/vala/valaproperty.vala +++ b/vala/valaproperty.vala @@ -109,11 +109,11 @@ public class Vala.Property : Symbol, Lockable { bool set_has_body = (has_set && set_accessor.body != null); if (set_has_body && (has_get && !get_has_body)) { error = true; - Report.error (source_reference, "Property getter must have a body"); + Report.error (source_reference, _("Property getter must have a body")); } if (get_has_body && (has_set && !set_has_body)) { error = true; - Report.error (source_reference, "Property setter must have a body"); + Report.error (source_reference, _("Property setter must have a body")); } if (!get_has_body && !set_has_body) { /* automatic property accessor body generation */ @@ -364,7 +364,7 @@ public class Vala.Property : Symbol, Lockable { string invalid_match; if (!compatible (base_property, out invalid_match)) { error = true; - Report.error (source_reference, "Type and/or accessors of overriding property `%s' do not match overridden property `%s': %s.".printf (get_full_name (), base_property.get_full_name (), invalid_match)); + Report.error (source_reference, _("Type and/or accessors of overriding property `%s' do not match overridden property `%s': %s.").printf (get_full_name (), base_property.get_full_name (), invalid_match)); return; } @@ -389,7 +389,7 @@ public class Vala.Property : Symbol, Lockable { string invalid_match; if (!compatible (base_property, out invalid_match)) { error = true; - Report.error (source_reference, "Type and/or accessors of overriding property `%s' do not match overridden property `%s': %s.".printf (get_full_name (), base_property.get_full_name (), invalid_match)); + Report.error (source_reference, _("Type and/or accessors of overriding property `%s' do not match overridden property `%s': %s.").printf (get_full_name (), base_property.get_full_name (), invalid_match)); return; } @@ -412,7 +412,7 @@ public class Vala.Property : Symbol, Lockable { var cl = (Class) parent_symbol; if (cl.is_compact && cl.base_class != null) { error = true; - Report.error (source_reference, "Abstract and virtual properties may not be declared in derived compact classes"); + Report.error (source_reference, _("Abstract and virtual properties may not be declared in derived compact classes")); return false; } } @@ -422,30 +422,30 @@ public class Vala.Property : Symbol, Lockable { var cl = (Class) parent_symbol; if (!cl.is_abstract) { error = true; - Report.error (source_reference, "Abstract properties may not be declared in non-abstract classes"); + Report.error (source_reference, _("Abstract properties may not be declared in non-abstract classes")); return false; } } else if (!(parent_symbol is Interface)) { error = true; - Report.error (source_reference, "Abstract properties may not be declared outside of classes and interfaces"); + Report.error (source_reference, _("Abstract properties may not be declared outside of classes and interfaces")); return false; } } else if (is_virtual) { if (!(parent_symbol is Class) && !(parent_symbol is Interface)) { error = true; - Report.error (source_reference, "Virtual properties may not be declared outside of classes and interfaces"); + Report.error (source_reference, _("Virtual properties may not be declared outside of classes and interfaces")); return false; } } else if (overrides) { if (!(parent_symbol is Class)) { error = true; - Report.error (source_reference, "Properties may not be overridden outside of classes"); + Report.error (source_reference, _("Properties may not be overridden outside of classes")); return false; } } else if (access == SymbolAccessibility.PROTECTED) { if (!(parent_symbol is Class) && !(parent_symbol is Interface)) { error = true; - Report.error (source_reference, "Protected properties may not be declared outside of classes and interfaces"); + Report.error (source_reference, _("Protected properties may not be declared outside of classes and interfaces")); return false; } } @@ -460,7 +460,7 @@ public class Vala.Property : Symbol, Lockable { if (property_type is VoidType) { error = true; - Report.error (source_reference, "'void' not supported as property type"); + Report.error (source_reference, _("'void' not supported as property type")); return false; } @@ -468,7 +468,7 @@ public class Vala.Property : Symbol, Lockable { if (get_accessor == null && set_accessor == null) { error = true; - Report.error (source_reference, "Property `%s' must have a `get' accessor and/or a `set' mutator".printf (get_full_name ())); + Report.error (source_reference, _("Property `%s' must have a `get' accessor and/or a `set' mutator").printf (get_full_name ())); return false; } @@ -480,7 +480,7 @@ public class Vala.Property : Symbol, Lockable { } if (initializer != null && field == null && !is_abstract) { - Report.error (source_reference, "Property `%s' with custom `get' accessor and/or `set' mutator cannot have `default' value".printf (get_full_name ())); + Report.error (source_reference, _("Property `%s' with custom `get' accessor and/or `set' mutator cannot have `default' value").printf (get_full_name ())); } if (initializer != null) { @@ -490,28 +490,28 @@ public class Vala.Property : Symbol, Lockable { // check whether property type is at least as accessible as the property if (!context.analyzer.is_type_accessible (this, property_type)) { error = true; - Report.error (source_reference, "property type `%s' is less accessible than property `%s'".printf (property_type.to_string (), get_full_name ())); + Report.error (source_reference, _("property type `%s' is less accessible than property `%s'").printf (property_type.to_string (), get_full_name ())); } if (overrides && base_property == null) { - Report.error (source_reference, "%s: no suitable property found to override".printf (get_full_name ())); + Report.error (source_reference, _("%s: no suitable property found to override").printf (get_full_name ())); } if (!external_package && !overrides && !hides && get_hidden_member () != null) { - Report.warning (source_reference, "%s hides inherited property `%s'. Use the `new' keyword if hiding was intentional".printf (get_full_name (), get_hidden_member ().get_full_name ())); + Report.warning (source_reference, _("%s hides inherited property `%s'. Use the `new' keyword if hiding was intentional").printf (get_full_name (), get_hidden_member ().get_full_name ())); } /* construct properties must be public */ if (set_accessor != null && set_accessor.construction) { if (access != SymbolAccessibility.PUBLIC) { error = true; - Report.error (source_reference, "%s: construct properties must be public".printf (get_full_name ())); + Report.error (source_reference, _("%s: construct properties must be public").printf (get_full_name ())); } } if (initializer != null && !initializer.error && initializer.value_type != null && !(initializer.value_type.compatible (property_type))) { error = true; - Report.error (initializer.source_reference, "Expected initializer of type `%s' but got `%s'".printf (property_type.to_string (), initializer.value_type.to_string ())); + Report.error (initializer.source_reference, _("Expected initializer of type `%s' but got `%s'").printf (property_type.to_string (), initializer.value_type.to_string ())); } context.analyzer.current_source_file = old_source_file; diff --git a/vala/valapropertyaccessor.vala b/vala/valapropertyaccessor.vala index e348c2510..421b6582c 100644 --- a/vala/valapropertyaccessor.vala +++ b/vala/valapropertyaccessor.vala @@ -180,13 +180,13 @@ public class Vala.PropertyAccessor : Subroutine { if ((prop.is_abstract || prop.is_virtual || prop.overrides) && access == SymbolAccessibility.PRIVATE) { error = true; - Report.error (source_reference, "Property `%s' with private accessor cannot be marked as abstract, virtual or override".printf (prop.get_full_name ())); + Report.error (source_reference, _("Property `%s' with private accessor cannot be marked as abstract, virtual or override").printf (prop.get_full_name ())); return false; } if (body != null && prop.is_abstract) { error = true; - Report.error (source_reference, "Accessor of abstract property `%s' cannot have body".printf (prop.get_full_name ())); + Report.error (source_reference, _("Accessor of abstract property `%s' cannot have body").printf (prop.get_full_name ())); return false; } @@ -201,7 +201,7 @@ public class Vala.PropertyAccessor : Subroutine { body.get_error_types (error_types); foreach (DataType body_error_type in error_types) { if (!((ErrorType) body_error_type).dynamic_error) { - Report.warning (body_error_type.source_reference, "unhandled error `%s'".printf (body_error_type.to_string())); + Report.warning (body_error_type.source_reference, _("unhandled error `%s'").printf (body_error_type.to_string())); } } } diff --git a/vala/valareferencetransferexpression.vala b/vala/valareferencetransferexpression.vala index f9b428997..28c7f777f 100644 --- a/vala/valareferencetransferexpression.vala +++ b/vala/valareferencetransferexpression.vala @@ -94,7 +94,7 @@ public class Vala.ReferenceTransferExpression : Expression { if (!(inner is MemberAccess || inner is ElementAccess)) { error = true; - Report.error (source_reference, "Reference transfer not supported for this expression"); + Report.error (source_reference, _("Reference transfer not supported for this expression")); return false; } @@ -103,7 +103,7 @@ public class Vala.ReferenceTransferExpression : Expression { && !(inner.value_type is PointerType) && !is_owned_delegate) { error = true; - Report.error (source_reference, "No reference to be transferred"); + Report.error (source_reference, _("No reference to be transferred")); return false; } diff --git a/vala/valaregexliteral.vala b/vala/valaregexliteral.vala index 79270fa60..b3d6ff88f 100644 --- a/vala/valaregexliteral.vala +++ b/vala/valaregexliteral.vala @@ -74,7 +74,7 @@ public class Vala.RegexLiteral : Literal { if (regex != null) { /* Regex is valid. */ } } catch (RegexError err) { error = true; - Report.error (source_reference, "Invalid regular expression `%s'.".printf (value)); + Report.error (source_reference, _("Invalid regular expression `%s'.").printf (value)); return false; } diff --git a/vala/valareturnstatement.vala b/vala/valareturnstatement.vala index f51164968..45523671a 100644 --- a/vala/valareturnstatement.vala +++ b/vala/valareturnstatement.vala @@ -95,39 +95,39 @@ public class Vala.ReturnStatement : CodeNode, Statement { if (context.analyzer.current_return_type == null) { error = true; - Report.error (source_reference, "Return not allowed in this context"); + Report.error (source_reference, _("Return not allowed in this context")); return false; } if (return_expression == null) { if (!(context.analyzer.current_return_type is VoidType)) { error = true; - Report.error (source_reference, "Return without value in non-void function"); + Report.error (source_reference, _("Return without value in non-void function")); } return !error; } if (context.analyzer.current_return_type is VoidType) { - Report.error (source_reference, "Return with value in void function"); + Report.error (source_reference, _("Return with value in void function")); return false; } if (return_expression.value_type == null) { error = true; - Report.error (source_reference, "Invalid expression in return value"); + Report.error (source_reference, _("Invalid expression in return value")); return false; } if (!return_expression.value_type.compatible (context.analyzer.current_return_type)) { error = true; - Report.error (source_reference, "Return: Cannot convert from `%s' to `%s'".printf (return_expression.value_type.to_string (), context.analyzer.current_return_type.to_string ())); + Report.error (source_reference, _("Return: Cannot convert from `%s' to `%s'").printf (return_expression.value_type.to_string (), context.analyzer.current_return_type.to_string ())); return false; } if (return_expression.value_type.is_disposable () && !context.analyzer.current_return_type.value_owned) { error = true; - Report.error (source_reference, "Return value transfers ownership but method return type hasn't been declared to transfer ownership"); + Report.error (source_reference, _("Return value transfers ownership but method return type hasn't been declared to transfer ownership")); return false; } @@ -135,13 +135,13 @@ public class Vala.ReturnStatement : CodeNode, Statement { if (local != null && local.variable_type.is_disposable () && !context.analyzer.current_return_type.value_owned) { error = true; - Report.error (source_reference, "Local variable with strong reference used as return value and method return type has not been declared to transfer ownership"); + Report.error (source_reference, _("Local variable with strong reference used as return value and method return type has not been declared to transfer ownership")); return false; } if (return_expression is NullLiteral && !context.analyzer.current_return_type.nullable) { - Report.warning (source_reference, "`null' incompatible with return type `%s'".printf (context.analyzer.current_return_type.to_string ())); + Report.warning (source_reference, _("`null' incompatible with return type `%s'").printf (context.analyzer.current_return_type.to_string ())); } return !error; diff --git a/vala/valascanner.vala b/vala/valascanner.vala index 718b65471..711745ab3 100644 --- a/vala/valascanner.vala +++ b/vala/valascanner.vala @@ -121,25 +121,25 @@ public class Vala.Scanner { switch (current[0]) { case 'i': if (fl_i) { - Report.error (get_source_reference (token_length_in_chars), "modifier 'i' used more than once"); + Report.error (get_source_reference (token_length_in_chars), _("modifier 'i' used more than once")); } fl_i = true; break; case 's': if (fl_s) { - Report.error (get_source_reference (token_length_in_chars), "modifier 's' used more than once"); + Report.error (get_source_reference (token_length_in_chars), _("modifier 's' used more than once")); } fl_s = true; break; case 'm': if (fl_m) { - Report.error (get_source_reference (token_length_in_chars), "modifier 'm' used more than once"); + Report.error (get_source_reference (token_length_in_chars), _("modifier 'm' used more than once")); } fl_m = true; break; case 'x': if (fl_x) { - Report.error (get_source_reference (token_length_in_chars), "modifier 'x' used more than once"); + Report.error (get_source_reference (token_length_in_chars), _("modifier 'x' used more than once")); } fl_x = true; break; @@ -225,7 +225,7 @@ public class Vala.Scanner { token_length_in_chars++; } if (digit_length != 4) { - Report.error (get_source_reference (token_length_in_chars), "\\u requires four hex digits"); + Report.error (get_source_reference (token_length_in_chars), _("\\u requires four hex digits")); } break; case 'x': @@ -238,7 +238,7 @@ public class Vala.Scanner { token_length_in_chars++; } if (digit_length < 1) { - Report.error (get_source_reference (token_length_in_chars), "\\x requires at least one hex digit"); + Report.error (get_source_reference (token_length_in_chars), _("\\x requires at least one hex digit")); } break; default: @@ -251,7 +251,7 @@ public class Vala.Scanner { token_length_in_chars++; } } else { - Report.error (get_source_reference (token_length_in_chars), "invalid escape sequence"); + Report.error (get_source_reference (token_length_in_chars), _("invalid escape sequence")); } break; } @@ -264,12 +264,12 @@ public class Vala.Scanner { token_length_in_chars++; } else { current++; - Report.error (get_source_reference (token_length_in_chars), "invalid UTF-8 character"); + Report.error (get_source_reference (token_length_in_chars), _("invalid UTF-8 character")); } } } if (current >= end || current[0] == '\n') { - Report.error (get_source_reference (token_length_in_chars), "syntax error, expected \""); + Report.error (get_source_reference (token_length_in_chars), _("syntax error, expected \"")); state_stack.length--; return read_token (out token_begin, out token_end); } @@ -698,7 +698,7 @@ public class Vala.Scanner { current++; state_stack += State.TEMPLATE_PART; } else { - Report.error (get_source_reference (1), "unexpected character"); + Report.error (get_source_reference (1), _("unexpected character")); return read_template_token (out token_begin, out token_end); } break; @@ -737,7 +737,7 @@ public class Vala.Scanner { token_length_in_chars++; } if (digit_length != 4) { - Report.error (get_source_reference (token_length_in_chars), "\\u requires four hex digits"); + Report.error (get_source_reference (token_length_in_chars), _("\\u requires four hex digits")); } break; case 'x': @@ -750,11 +750,11 @@ public class Vala.Scanner { token_length_in_chars++; } if (digit_length < 1) { - Report.error (get_source_reference (token_length_in_chars), "\\x requires at least one hex digit"); + Report.error (get_source_reference (token_length_in_chars), _("\\x requires at least one hex digit")); } break; default: - Report.error (get_source_reference (token_length_in_chars), "invalid escape sequence"); + Report.error (get_source_reference (token_length_in_chars), _("invalid escape sequence")); break; } } else if (current[0] == '\n') { @@ -769,12 +769,12 @@ public class Vala.Scanner { token_length_in_chars++; } else { current++; - Report.error (get_source_reference (token_length_in_chars), "invalid UTF-8 character"); + Report.error (get_source_reference (token_length_in_chars), _("invalid UTF-8 character")); } } } if (current >= end) { - Report.error (get_source_reference (token_length_in_chars), "syntax error, expected \""); + Report.error (get_source_reference (token_length_in_chars), _("syntax error, expected \"")); state_stack.length--; return read_token (out token_begin, out token_end); } @@ -1124,14 +1124,14 @@ public class Vala.Scanner { current += u.to_utf8 (null); token_length_in_chars++; } else { - Report.error (get_source_reference (token_length_in_chars), "invalid UTF-8 character"); + Report.error (get_source_reference (token_length_in_chars), _("invalid UTF-8 character")); } } } if (current[0] == '"' && current[1] == '"' && current[2] == '"') { current += 3; } else { - Report.error (get_source_reference (token_length_in_chars), "syntax error, expected \"\"\""); + Report.error (get_source_reference (token_length_in_chars), _("syntax error, expected \"\"\"")); } break; } else { @@ -1172,7 +1172,7 @@ public class Vala.Scanner { token_length_in_chars++; } if (digit_length != 4) { - Report.error (get_source_reference (token_length_in_chars), "\\u requires four hex digits"); + Report.error (get_source_reference (token_length_in_chars), _("\\u requires four hex digits")); } break; case 'x': @@ -1185,11 +1185,11 @@ public class Vala.Scanner { token_length_in_chars++; } if (digit_length < 1) { - Report.error (get_source_reference (token_length_in_chars), "\\x requires at least one hex digit"); + Report.error (get_source_reference (token_length_in_chars), _("\\x requires at least one hex digit")); } break; default: - Report.error (get_source_reference (token_length_in_chars), "invalid escape sequence"); + Report.error (get_source_reference (token_length_in_chars), _("invalid escape sequence")); break; } } else if (current[0] == '\n') { @@ -1204,28 +1204,28 @@ public class Vala.Scanner { token_length_in_chars++; } else { current++; - Report.error (get_source_reference (token_length_in_chars), "invalid UTF-8 character"); + Report.error (get_source_reference (token_length_in_chars), _("invalid UTF-8 character")); } } if (current < end && begin[0] == '\'' && current[0] != '\'') { // multiple characters in single character literal - Report.error (get_source_reference (token_length_in_chars), "invalid character literal"); + Report.error (get_source_reference (token_length_in_chars), _("invalid character literal")); } } if (current < end) { current++; } else { - Report.error (get_source_reference (token_length_in_chars), "syntax error, expected %c".printf (begin[0])); + Report.error (get_source_reference (token_length_in_chars), _("syntax error, expected %c").printf (begin[0])); } break; default: unichar u = ((string) current).get_char_validated ((long) (end - current)); if (u != (unichar) (-1)) { current += u.to_utf8 (null); - Report.error (get_source_reference (0), "syntax error, unexpected character"); + Report.error (get_source_reference (0), _("syntax error, unexpected character")); } else { current++; - Report.error (get_source_reference (0), "invalid UTF-8 character"); + Report.error (get_source_reference (0), _("invalid UTF-8 character")); } column++; return read_token (out token_begin, out token_end); @@ -1303,7 +1303,7 @@ public class Vala.Scanner { } else if (len == 5 && matches (begin, "endif")) { parse_pp_endif (); } else { - Report.error (get_source_reference (-len, len), "syntax error, invalid preprocessing directive"); + Report.error (get_source_reference (-len, len), _("syntax error, invalid preprocessing directive")); } if (conditional_stack.length > 0 @@ -1333,7 +1333,7 @@ public class Vala.Scanner { void pp_eol () { pp_space (); if (current >= end || current[0] != '\n') { - Report.error (get_source_reference (0), "syntax error, expected newline"); + Report.error (get_source_reference (0), _("syntax error, expected newline")); } } @@ -1363,7 +1363,7 @@ public class Vala.Scanner { pp_eol (); if (conditional_stack.length == 0 || conditional_stack[conditional_stack.length - 1].else_found) { - Report.error (get_source_reference (0), "syntax error, unexpected #elif"); + Report.error (get_source_reference (0), _("syntax error, unexpected #elif")); return; } @@ -1382,7 +1382,7 @@ public class Vala.Scanner { pp_eol (); if (conditional_stack.length == 0 || conditional_stack[conditional_stack.length - 1].else_found) { - Report.error (get_source_reference (0), "syntax error, unexpected #else"); + Report.error (get_source_reference (0), _("syntax error, unexpected #else")); return; } @@ -1401,7 +1401,7 @@ public class Vala.Scanner { pp_eol (); if (conditional_stack.length == 0) { - Report.error (get_source_reference (0), "syntax error, unexpected #endif"); + Report.error (get_source_reference (0), _("syntax error, unexpected #endif")); return; } @@ -1417,7 +1417,7 @@ public class Vala.Scanner { } if (len == 0) { - Report.error (get_source_reference (0), "syntax error, expected identifier"); + Report.error (get_source_reference (0), _("syntax error, expected identifier")); return false; } @@ -1436,7 +1436,7 @@ public class Vala.Scanner { bool parse_pp_primary_expression () { if (current >= end) { - Report.error (get_source_reference (0), "syntax error, expected identifier"); + Report.error (get_source_reference (0), _("syntax error, expected identifier")); } else if (is_ident_char (current[0])) { return parse_pp_symbol (); } else if (current[0] == '(') { @@ -1449,11 +1449,11 @@ public class Vala.Scanner { current++; column++; } else { - Report.error (get_source_reference (0), "syntax error, expected `)'"); + Report.error (get_source_reference (0), _("syntax error, expected `)'")); } return result; } else { - Report.error (get_source_reference (0), "syntax error, expected identifier"); + Report.error (get_source_reference (0), _("syntax error, expected identifier")); } return false; } @@ -1594,7 +1594,7 @@ public class Vala.Scanner { } if (current == end - 1) { - Report.error (get_source_reference (0), "syntax error, expected */"); + Report.error (get_source_reference (0), _("syntax error, expected */")); return true; } diff --git a/vala/valascope.vala b/vala/valascope.vala index a2a946b09..14201c41e 100644 --- a/vala/valascope.vala +++ b/vala/valascope.vala @@ -62,9 +62,9 @@ public class Vala.Scope { } else if (lookup (name) != null) { owner.error = true; if (owner.name == null && owner.parent_symbol == null) { - Report.error (sym.source_reference, "The root namespace already contains a definition for `%s'".printf (name)); + Report.error (sym.source_reference, _("The root namespace already contains a definition for `%s'").printf (name)); } else { - Report.error (sym.source_reference, "`%s' already contains a definition for `%s'".printf (owner.get_full_name (), name)); + Report.error (sym.source_reference, _("`%s' already contains a definition for `%s'").printf (owner.get_full_name (), name)); } Report.notice (lookup (name).source_reference, "previous definition of `%s' was here".printf (name)); return; diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala index 485ab222d..00acec4c2 100644 --- a/vala/valasemanticanalyzer.vala +++ b/vala/valasemanticanalyzer.vala @@ -441,9 +441,9 @@ public class Vala.SemanticAnalyzer : CodeVisitor { expr.error = true; var m = mtype as MethodType; if (m != null) { - Report.error (expr.source_reference, "%d missing arguments for `%s'".printf (m.get_parameters ().size - args.size, m.to_prototype_string ())); + Report.error (expr.source_reference, _("%d missing arguments for `%s'").printf (m.get_parameters ().size - args.size, m.to_prototype_string ())); } else { - Report.error (expr.source_reference, "Too few arguments, method `%s' does not take %d arguments".printf (mtype.to_string (), args.size)); + Report.error (expr.source_reference, _("Too few arguments, method `%s' does not take %d arguments").printf (mtype.to_string (), args.size)); } error = true; } else { @@ -478,9 +478,9 @@ public class Vala.SemanticAnalyzer : CodeVisitor { expr.error = true; var m = mtype as MethodType; if (m != null) { - Report.error (expr.source_reference, "%d extra arguments for `%s'".printf (args.size - m.get_parameters ().size, m.to_prototype_string ())); + Report.error (expr.source_reference, _("%d extra arguments for `%s'").printf (args.size - m.get_parameters ().size, m.to_prototype_string ())); } else { - Report.error (expr.source_reference, "Too many arguments, method `%s' does not take %d arguments".printf (mtype.to_string (), args.size)); + Report.error (expr.source_reference, _("Too many arguments, method `%s' does not take %d arguments").printf (mtype.to_string (), args.size)); } error = true; } @@ -500,12 +500,12 @@ public class Vala.SemanticAnalyzer : CodeVisitor { // ignore inner error return false; } else if (arg is NamedArgument) { - Report.error (arg.source_reference, "Named arguments are not supported yet"); + Report.error (arg.source_reference, _("Named arguments are not supported yet")); return false; } else if (arg.value_type == null) { // disallow untyped arguments except for type inference of callbacks if (!(arg.target_type is DelegateType) || !(arg.symbol_reference is Method)) { - Report.error (arg.source_reference, "Invalid type for argument %d".printf (i + 1)); + Report.error (arg.source_reference, _("Invalid type for argument %d").printf (i + 1)); return false; } } else { @@ -524,19 +524,19 @@ public class Vala.SemanticAnalyzer : CodeVisitor { if (arg_type == 0) { if (direction == ParameterDirection.REF) { - Report.error (arg.source_reference, "Argument %d: Cannot pass null to reference parameter".printf (i + 1)); + Report.error (arg.source_reference, _("Argument %d: Cannot pass null to reference parameter").printf (i + 1)); return false; } else if (direction != ParameterDirection.OUT && !arg.target_type.nullable) { - Report.warning (arg.source_reference, "Argument %d: Cannot pass null to non-null parameter type".printf (i + 1)); + Report.warning (arg.source_reference, _("Argument %d: Cannot pass null to non-null parameter type").printf (i + 1)); } } else if (arg_type == 1) { if (direction != ParameterDirection.IN) { - Report.error (arg.source_reference, "Argument %d: Cannot pass value to reference or output parameter".printf (i + 1)); + Report.error (arg.source_reference, _("Argument %d: Cannot pass value to reference or output parameter").printf (i + 1)); return false; } } else if (arg_type == 2) { if (direction != ParameterDirection.REF) { - Report.error (arg.source_reference, "Argument %d: Cannot pass ref argument to non-reference parameter".printf (i + 1)); + Report.error (arg.source_reference, _("Argument %d: Cannot pass ref argument to non-reference parameter").printf (i + 1)); return false; } @@ -544,7 +544,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { if (arg.target_type.is_disposable ()) { if (!(arg.value_type is PointerType) && !arg.value_type.value_owned) { /* variable doesn't own the value */ - Report.error (arg.source_reference, "Argument %d: Cannot pass unowned ref argument to owned reference parameter".printf (i + 1)); + Report.error (arg.source_reference, _("Argument %d: Cannot pass unowned ref argument to owned reference parameter").printf (i + 1)); return false; } } @@ -553,13 +553,13 @@ public class Vala.SemanticAnalyzer : CodeVisitor { if (arg.value_type.is_disposable ()) { if (!arg.target_type.value_owned) { /* parameter doesn't own the value */ - Report.error (arg.source_reference, "Argument %d: Cannot pass owned ref argument to unowned reference parameter".printf (i + 1)); + Report.error (arg.source_reference, _("Argument %d: Cannot pass owned ref argument to unowned reference parameter").printf (i + 1)); return false; } } } else if (arg_type == 3) { if (direction != ParameterDirection.OUT) { - Report.error (arg.source_reference, "Argument %d: Cannot pass out argument to non-output parameter".printf (i + 1)); + Report.error (arg.source_reference, _("Argument %d: Cannot pass out argument to non-output parameter").printf (i + 1)); return false; } @@ -567,7 +567,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { if (arg.target_type.is_disposable ()) { if (!(arg.value_type is PointerType) && !arg.value_type.value_owned) { /* variable doesn't own the value */ - Report.error (arg.source_reference, "Invalid assignment from owned expression to unowned variable"); + Report.error (arg.source_reference, _("Invalid assignment from owned expression to unowned variable")); return false; } } @@ -577,12 +577,12 @@ public class Vala.SemanticAnalyzer : CodeVisitor { if (arg.target_type != null) { if ((direction == ParameterDirection.IN || direction == ParameterDirection.REF) && !arg.value_type.compatible (arg.target_type)) { - Report.error (arg.source_reference, "Argument %d: Cannot convert from `%s' to `%s'".printf (i + 1, arg.value_type.to_prototype_string (), arg.target_type.to_prototype_string ())); + Report.error (arg.source_reference, _("Argument %d: Cannot convert from `%s' to `%s'").printf (i + 1, arg.value_type.to_prototype_string (), arg.target_type.to_prototype_string ())); return false; } else if ((direction == ParameterDirection.REF || direction == ParameterDirection.OUT) && !arg.target_type.compatible (arg.value_type) && !(arg is NullLiteral)) { - Report.error (arg.source_reference, "Argument %d: Cannot convert from `%s' to `%s'".printf (i + 1, arg.target_type.to_prototype_string (), arg.value_type.to_prototype_string ())); + Report.error (arg.source_reference, _("Argument %d: Cannot convert from `%s' to `%s'").printf (i + 1, arg.target_type.to_prototype_string (), arg.value_type.to_prototype_string ())); return false; } } @@ -592,7 +592,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { // allow prototype access if target type is delegate without target var deleg_type = arg.target_type as DelegateType; if (deleg_type == null || deleg_type.delegate_symbol.has_target) { - Report.error (arg.source_reference, "Access to instance member `%s' denied".printf (arg.symbol_reference.get_full_name ())); + Report.error (arg.source_reference, _("Access to instance member `%s' denied").printf (arg.symbol_reference.get_full_name ())); return false; } } @@ -607,17 +607,17 @@ public class Vala.SemanticAnalyzer : CodeVisitor { return false; } else if (arg.value_type is SignalType) { arg.error = true; - Report.error (arg.source_reference, "Cannot pass signals as arguments"); + Report.error (arg.source_reference, _("Cannot pass signals as arguments")); return false; } else if (arg.value_type == null) { // disallow untyped arguments except for type inference of callbacks if (!(arg.symbol_reference is Method)) { - Report.error (source_reference, "Invalid type for argument %d".printf (i + 1)); + Report.error (source_reference, _("Invalid type for argument %d").printf (i + 1)); return false; } } else if (arg.target_type != null && !arg.value_type.compatible (arg.target_type)) { // target_type known for printf arguments - Report.error (arg.source_reference, "Argument %d: Cannot convert from `%s' to `%s'".printf (i + 1, arg.value_type.to_string (), arg.target_type.to_string ())); + Report.error (arg.source_reference, _("Argument %d: Cannot convert from `%s' to `%s'").printf (i + 1, arg.value_type.to_string (), arg.target_type.to_string ())); return false; } @@ -734,13 +734,13 @@ public class Vala.SemanticAnalyzer : CodeVisitor { arg.target_type = param_type; } else { - Report.error (source_reference, "Too few arguments for specified format"); + Report.error (source_reference, _("Too few arguments for specified format")); return false; } } } if (!unsupported_format && arg_it.next ()) { - Report.error (source_reference, "Too many arguments for specified format"); + Report.error (source_reference, _("Too many arguments for specified format")); return false; } @@ -850,7 +850,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { if (instance_type == null) { if (node_reference != null) { CodeNode? reference = get_symbol_for_data_type (derived_instance_type); - Report.error ((reference ?? node_reference).source_reference, "The type-parameter `%s' is missing".printf (generic_type.to_string ())); + Report.error ((reference ?? node_reference).source_reference, _("The type-parameter `%s' is missing").printf (generic_type.to_string ())); node_reference.error = true; } return new InvalidType (); @@ -947,12 +947,12 @@ public class Vala.SemanticAnalyzer : CodeVisitor { init.symbol_reference = symbol_lookup_inherited (type.data_type, init.name); if (!(init.symbol_reference is Field || init.symbol_reference is Property)) { init.error = true; - Report.error (init.source_reference, "Invalid member `%s' in `%s'".printf (init.name, type.data_type.get_full_name ())); + Report.error (init.source_reference, _("Invalid member `%s' in `%s'").printf (init.name, type.data_type.get_full_name ())); return; } if (init.symbol_reference.access != SymbolAccessibility.PUBLIC) { init.error = true; - Report.error (init.source_reference, "Access to private member `%s' denied".printf (init.symbol_reference.get_full_name ())); + Report.error (init.source_reference, _("Access to private member `%s' denied").printf (init.symbol_reference.get_full_name ())); return; } DataType member_type = null; @@ -964,7 +964,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { member_type = prop.property_type; if (prop.set_accessor == null || !prop.set_accessor.writable) { init.error = true; - Report.error (init.source_reference, "Property `%s' is read-only".printf (prop.get_full_name ())); + Report.error (init.source_reference, _("Property `%s' is read-only").printf (prop.get_full_name ())); return; } } @@ -976,7 +976,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { if (init.initializer.value_type == null || !init.initializer.value_type.compatible (init.initializer.target_type)) { init.error = true; - Report.error (init.source_reference, "Invalid type for member `%s'".printf (init.name)); + Report.error (init.source_reference, _("Invalid type for member `%s'").printf (init.name)); return; } } diff --git a/vala/valasignal.vala b/vala/valasignal.vala index fa32cbe64..8400f6fa4 100644 --- a/vala/valasignal.vala +++ b/vala/valasignal.vala @@ -185,7 +185,7 @@ public class Vala.Signal : Symbol, Callable { var parent_cl = parent_symbol as Class; if (parent_cl != null && parent_cl.is_compact) { error = true; - Report.error (source_reference, "Signals are not supported in compact classes"); + Report.error (source_reference, _("Signals are not supported in compact classes")); return false; } @@ -193,7 +193,7 @@ public class Vala.Signal : Symbol, Callable { foreach (DataType base_type in parent_cl.get_base_types ()) { if (SemanticAnalyzer.symbol_lookup_inherited (base_type.data_type, name) is Signal) { error = true; - Report.error (source_reference, "Signals with the same name as a signal in a base type are not supported"); + Report.error (source_reference, _("Signals with the same name as a signal in a base type are not supported")); return false; } } @@ -207,7 +207,7 @@ public class Vala.Signal : Symbol, Callable { foreach (Parameter param in parameters) { if (param.ellipsis) { - Report.error (param.source_reference, "Signals with variable argument lists are not supported"); + Report.error (param.source_reference, _("Signals with variable argument lists are not supported")); return false; } @@ -215,7 +215,7 @@ public class Vala.Signal : Symbol, Callable { } if (!is_virtual && body != null) { - Report.error (source_reference, "Only virtual signals can have a default signal handler body"); + Report.error (source_reference, _("Only virtual signals can have a default signal handler body")); } @@ -270,7 +270,7 @@ public class Vala.Signal : Symbol, Callable { if (!external_package && !hides && get_hidden_member () != null) { - Report.warning (source_reference, "%s hides inherited signal `%s'. Use the `new' keyword if hiding was intentional".printf (get_full_name (), get_hidden_member ().get_full_name ())); + Report.warning (source_reference, _("%s hides inherited signal `%s'. Use the `new' keyword if hiding was intentional").printf (get_full_name (), get_hidden_member ().get_full_name ())); } return !error; diff --git a/vala/valasliceexpression.vala b/vala/valasliceexpression.vala index 563733031..8fcbf4f28 100644 --- a/vala/valasliceexpression.vala +++ b/vala/valasliceexpression.vala @@ -132,13 +132,13 @@ public class Vala.SliceExpression : Expression { if (container.value_type == null) { error = true; - Report.error (container.source_reference, "Invalid container expression"); + Report.error (container.source_reference, _("Invalid container expression")); return false; } if (lvalue) { error = true; - Report.error (container.source_reference, "Slice expressions cannot be used as lvalue"); + Report.error (container.source_reference, _("Slice expressions cannot be used as lvalue")); return false; } @@ -150,11 +150,11 @@ public class Vala.SliceExpression : Expression { /* check if the index is of type integer */ if (!(start.value_type is IntegerType || start.value_type is EnumValueType)) { error = true; - Report.error (start.source_reference, "Expression of integer type expected"); + Report.error (start.source_reference, _("Expression of integer type expected")); } if (!(stop.value_type is IntegerType || stop.value_type is EnumValueType)) { error = true; - Report.error (stop.source_reference, "Expression of integer type expected"); + Report.error (stop.source_reference, _("Expression of integer type expected")); } } else { var slice_method = container.value_type.get_member ("slice") as Method; @@ -168,7 +168,7 @@ public class Vala.SliceExpression : Expression { } error = true; - Report.error (source_reference, "The expression `%s' does not denote an array".printf (container.value_type.to_string ())); + Report.error (source_reference, _("The expression `%s' does not denote an array").printf (container.value_type.to_string ())); } return !error; diff --git a/vala/valasourcefile.vala b/vala/valasourcefile.vala index 35eaf5f26..96ba9bc05 100644 --- a/vala/valasourcefile.vala +++ b/vala/valasourcefile.vala @@ -347,7 +347,7 @@ public class Vala.SourceFile { try { mapped_file = new MappedFile (filename, false); } catch (FileError e) { - Report.error (null, "Unable to map file `%s': %s".printf (filename, e.message)); + Report.error (null, _("Unable to map file `%s': %s").printf (filename, e.message)); return null; } } diff --git a/vala/valastruct.vala b/vala/valastruct.vala index c96632805..8558a8f51 100644 --- a/vala/valastruct.vala +++ b/vala/valastruct.vala @@ -250,7 +250,7 @@ public class Vala.Struct : TypeSymbol { var cm = (CreationMethod) m; if (cm.class_name != null && cm.class_name != name) { // type_name is null for constructors generated by GIdlParser - Report.error (m.source_reference, "missing return type in method `%s.%s´".printf (get_full_name (), cm.class_name)); + Report.error (m.source_reference, _("missing return type in method `%s.%s´").printf (get_full_name (), cm.class_name)); m.error = true; return; } @@ -494,7 +494,7 @@ public class Vala.Struct : TypeSymbol { if (!(base_type is ValueType)) { error = true; - Report.error (source_reference, "The base type `%s' of struct `%s' is not a struct".printf (base_type.to_string (), get_full_name ())); + Report.error (source_reference, _("The base type `%s' of struct `%s' is not a struct").printf (base_type.to_string (), get_full_name ())); return false; } } @@ -508,13 +508,13 @@ public class Vala.Struct : TypeSymbol { if (f.binding == MemberBinding.INSTANCE && is_recursive_value_type (f.variable_type)) { error = true; - Report.error (f.source_reference, "Recursive value types are not allowed"); + Report.error (f.source_reference, _("Recursive value types are not allowed")); return false; } if (f.binding == MemberBinding.INSTANCE && f.initializer != null) { error = true; - Report.error (f.source_reference, "Instance field initializers not supported"); + Report.error (f.source_reference, _("Instance field initializers not supported")); return false; } @@ -522,7 +522,7 @@ public class Vala.Struct : TypeSymbol { // for backing property fields a dedicated error will be reported later if (!(f in property_fields) && !(f.initializer.value_type is NullType) && f.variable_type.is_disposable () && f.variable_type.value_owned) { error = true; - Report.error (f.initializer.source_reference, "Owned static struct fields can only be initialized in a function or method"); + Report.error (f.initializer.source_reference, _("Owned static struct fields can only be initialized in a function or method")); } } } @@ -542,7 +542,7 @@ public class Vala.Struct : TypeSymbol { unowned Field? field = prop.field; if (field != null && field.initializer != null && !(field.initializer.value_type is NullType) && field.variable_type.is_disposable () && field.variable_type.value_owned) { error = true; - Report.error (field.initializer.source_reference, "Owned static struct properties can only be initialized in a function or method"); + Report.error (field.initializer.source_reference, _("Owned static struct properties can only be initialized in a function or method")); } } } @@ -557,10 +557,10 @@ public class Vala.Struct : TypeSymbol { } if (base_type == null && !has_instance_field && !is_boolean_type () && !is_integer_type () && !is_floating_type ()) { error = true; - Report.error (source_reference, "struct `%s' cannot be empty".printf (get_full_name ())); + Report.error (source_reference, _("struct `%s' cannot be empty").printf (get_full_name ())); } else if (base_type != null && has_instance_field) { error = true; - Report.error (source_reference, "derived struct `%s' may not have instance fields".printf (get_full_name ())); + Report.error (source_reference, _("derived struct `%s' may not have instance fields").printf (get_full_name ())); } } diff --git a/vala/valaswitchlabel.vala b/vala/valaswitchlabel.vala index ca92de04c..a877b5795 100644 --- a/vala/valaswitchlabel.vala +++ b/vala/valaswitchlabel.vala @@ -107,12 +107,12 @@ public class Vala.SwitchLabel : CodeNode { if (!expression.is_constant ()) { error = true; - Report.error (expression.source_reference, "Expression must be constant"); + Report.error (expression.source_reference, _("Expression must be constant")); return false; } if (!expression.value_type.compatible (switch_statement.expression.value_type)) { error = true; - Report.error (expression.source_reference, "Cannot convert from `%s' to `%s'".printf (expression.value_type.to_string (), switch_statement.expression.value_type.to_string ())); + Report.error (expression.source_reference, _("Cannot convert from `%s' to `%s'").printf (expression.value_type.to_string (), switch_statement.expression.value_type.to_string ())); return false; } } diff --git a/vala/valaswitchstatement.vala b/vala/valaswitchstatement.vala index 78cfa3d82..562162650 100644 --- a/vala/valaswitchstatement.vala +++ b/vala/valaswitchstatement.vala @@ -115,7 +115,7 @@ public class Vala.SwitchStatement : CodeNode, Statement { (!(expression.value_type is IntegerType) && !(expression.value_type is EnumValueType) && !expression.value_type.compatible (context.analyzer.string_type))) { - Report.error (expression.source_reference, "Integer or string expression expected"); + Report.error (expression.source_reference, _("Integer or string expression expected")); error = true; return false; } @@ -142,7 +142,7 @@ public class Vala.SwitchStatement : CodeNode, Statement { if (value != null && !labelset.add (value)) { error = true; - Report.error (label.expression.source_reference, "Switch statement already contains this label"); + Report.error (label.expression.source_reference, _("Switch statement already contains this label")); } } } diff --git a/vala/valasymbol.vala b/vala/valasymbol.vala index 3801c83c8..bf9e10265 100644 --- a/vala/valasymbol.vala +++ b/vala/valasymbol.vala @@ -418,59 +418,59 @@ public abstract class Vala.Symbol : CodeNode { } public virtual void add_namespace (Namespace ns) { - Report.error (ns.source_reference, "unexpected declaration"); + Report.error (ns.source_reference, _("unexpected declaration")); } public virtual void add_class (Class cl) { - Report.error (cl.source_reference, "unexpected declaration"); + Report.error (cl.source_reference, _("unexpected declaration")); } public virtual void add_interface (Interface iface) { - Report.error (iface.source_reference, "unexpected declaration"); + Report.error (iface.source_reference, _("unexpected declaration")); } public virtual void add_struct (Struct st) { - Report.error (st.source_reference, "unexpected declaration"); + Report.error (st.source_reference, _("unexpected declaration")); } public virtual void add_enum (Enum en) { - Report.error (en.source_reference, "unexpected declaration"); + Report.error (en.source_reference, _("unexpected declaration")); } public virtual void add_error_domain (ErrorDomain edomain) { - Report.error (edomain.source_reference, "unexpected declaration"); + Report.error (edomain.source_reference, _("unexpected declaration")); } public virtual void add_delegate (Delegate d) { - Report.error (d.source_reference, "unexpected declaration"); + Report.error (d.source_reference, _("unexpected declaration")); } public virtual void add_constant (Constant constant) { - Report.error (constant.source_reference, "unexpected declaration"); + Report.error (constant.source_reference, _("unexpected declaration")); } public virtual void add_field (Field f) { - Report.error (f.source_reference, "unexpected declaration"); + Report.error (f.source_reference, _("unexpected declaration")); } public virtual void add_method (Method m) { - Report.error (m.source_reference, "unexpected declaration"); + Report.error (m.source_reference, _("unexpected declaration")); } public virtual void add_property (Property prop) { - Report.error (prop.source_reference, "unexpected declaration"); + Report.error (prop.source_reference, _("unexpected declaration")); } public virtual void add_signal (Signal sig) { - Report.error (sig.source_reference, "unexpected declaration"); + Report.error (sig.source_reference, _("unexpected declaration")); } public virtual void add_constructor (Constructor c) { - Report.error (c.source_reference, "unexpected declaration"); + Report.error (c.source_reference, _("unexpected declaration")); } public virtual void add_destructor (Destructor d) { - Report.error (d.source_reference, "unexpected declaration"); + Report.error (d.source_reference, _("unexpected declaration")); } public override string to_string () { diff --git a/vala/valasymbolresolver.vala b/vala/valasymbolresolver.vala index 1c0da5bcf..06fc92c02 100644 --- a/vala/valasymbolresolver.vala +++ b/vala/valasymbolresolver.vala @@ -67,13 +67,13 @@ public class Vala.SymbolResolver : CodeVisitor { if (type.data_type is Class) { if (cl.base_class != null) { cl.error = true; - Report.error (type.source_reference, "%s: Classes cannot have multiple base classes (`%s' and `%s')".printf (cl.get_full_name (), cl.base_class.get_full_name (), type.data_type.get_full_name ())); + Report.error (type.source_reference, _("%s: Classes cannot have multiple base classes (`%s' and `%s')").printf (cl.get_full_name (), cl.base_class.get_full_name (), type.data_type.get_full_name ())); return; } cl.base_class = (Class) type.data_type; if (cl.base_class.is_subtype_of (cl)) { cl.error = true; - Report.error (type.source_reference, "Base class cycle (`%s' and `%s')".printf (cl.get_full_name (), cl.base_class.get_full_name ())); + Report.error (type.source_reference, _("Base class cycle (`%s' and `%s')").printf (cl.get_full_name (), cl.base_class.get_full_name ())); return; } } @@ -96,7 +96,7 @@ public class Vala.SymbolResolver : CodeVisitor { if (base_type != null) { if (base_type.is_subtype_of (st)) { st.error = true; - Report.error (st.source_reference, "Base struct cycle (`%s' and `%s')".printf (st.get_full_name (), base_type.get_full_name ())); + Report.error (st.source_reference, _("Base struct cycle (`%s' and `%s')").printf (st.get_full_name (), base_type.get_full_name ())); return; } } @@ -117,7 +117,7 @@ public class Vala.SymbolResolver : CodeVisitor { foreach (DataType type in iface.get_prerequisites ()) { if (type.data_type != null && type.data_type.is_subtype_of (iface)) { iface.error = true; - Report.error (type.source_reference, "Prerequisite cycle (`%s' and `%s')".printf (iface.get_full_name (), type.data_type.get_full_name ())); + Report.error (type.source_reference, _("Prerequisite cycle (`%s' and `%s')").printf (iface.get_full_name (), type.data_type.get_full_name ())); return; } } @@ -263,7 +263,7 @@ public class Vala.SymbolResolver : CodeVisitor { ns.namespace_symbol = resolve_symbol (unresolved_symbol); if (!(ns.namespace_symbol is Namespace)) { ns.error = true; - Report.error (ns.source_reference, "The namespace name `%s' could not be found".printf (unresolved_symbol.to_string ())); + Report.error (ns.source_reference, _("The namespace name `%s' could not be found").printf (unresolved_symbol.to_string ())); return; } } @@ -302,7 +302,7 @@ public class Vala.SymbolResolver : CodeVisitor { if (local_sym != null) { if (sym != null && sym != local_sym) { unresolved_symbol.error = true; - Report.error (unresolved_symbol.source_reference, "`%s' is an ambiguous reference between `%s' and `%s'".printf (unresolved_symbol.name, sym.get_full_name (), local_sym.get_full_name ())); + Report.error (unresolved_symbol.source_reference, _("`%s' is an ambiguous reference between `%s' and `%s'").printf (unresolved_symbol.name, sym.get_full_name (), local_sym.get_full_name ())); return null; } sym = local_sym; @@ -314,7 +314,7 @@ public class Vala.SymbolResolver : CodeVisitor { var parent_symbol = resolve_symbol (unresolved_symbol.inner); if (parent_symbol == null) { unresolved_symbol.error = true; - Report.error (unresolved_symbol.inner.source_reference, "The symbol `%s' could not be found".printf (unresolved_symbol.inner.name)); + Report.error (unresolved_symbol.inner.source_reference, _("The symbol `%s' could not be found").printf (unresolved_symbol.inner.name)); return null; } parent_symbol.used = true; @@ -391,7 +391,7 @@ public class Vala.SymbolResolver : CodeVisitor { if (sym == null) { // don't report same error twice if (!unresolved_type.unresolved_symbol.error) { - Report.error (unresolved_type.source_reference, "The type name `%s' could not be found".printf (unresolved_type.unresolved_symbol.to_string ())); + Report.error (unresolved_type.source_reference, _("The type name `%s' could not be found").printf (unresolved_type.unresolved_symbol.to_string ())); } return new InvalidType (); } @@ -423,7 +423,7 @@ public class Vala.SymbolResolver : CodeVisitor { return new InvalidType (); } } else { - Report.error (unresolved_type.source_reference, "`%s' is not a type".printf (sym.get_full_name ())); + Report.error (unresolved_type.source_reference, _("`%s' is not a type").printf (sym.get_full_name ())); return new InvalidType (); } diff --git a/vala/valathrowstatement.vala b/vala/valathrowstatement.vala index 9349b1818..ae39d17a8 100644 --- a/vala/valathrowstatement.vala +++ b/vala/valathrowstatement.vala @@ -89,7 +89,7 @@ public class Vala.ThrowStatement : CodeNode, Statement { checked = true; if (context.profile == Profile.POSIX) { - Report.error (source_reference, "`throws' is not supported in POSIX profile"); + Report.error (source_reference, _("`throws' is not supported in POSIX profile")); error = true; return false; } @@ -104,13 +104,13 @@ public class Vala.ThrowStatement : CodeNode, Statement { } if (error_expression.value_type == null) { - Report.error (error_expression.source_reference, "invalid error expression"); + Report.error (error_expression.source_reference, _("invalid error expression")); error = true; return false; } if (context.profile == Profile.GOBJECT && !(error_expression.value_type is ErrorType)) { - Report.error (error_expression.source_reference, "`%s' is not an error type".printf (error_expression.value_type.to_string ())); + Report.error (error_expression.source_reference, _("`%s' is not an error type").printf (error_expression.value_type.to_string ())); error = true; return false; } diff --git a/vala/valatrystatement.vala b/vala/valatrystatement.vala index fcacfc7fb..1f0f2627a 100644 --- a/vala/valatrystatement.vala +++ b/vala/valatrystatement.vala @@ -137,7 +137,7 @@ public class Vala.TryStatement : CodeNode, Statement { checked = true; if (context.profile == Profile.POSIX) { - Report.error (source_reference, "`try' is not supported in POSIX profile"); + Report.error (source_reference, _("`try' is not supported in POSIX profile")); error = true; return false; } diff --git a/vala/valatuple.vala b/vala/valatuple.vala index 87a0a9c4e..9e3ce3ed6 100644 --- a/vala/valatuple.vala +++ b/vala/valatuple.vala @@ -73,7 +73,7 @@ public class Vala.Tuple : Expression { checked = true; - Report.error (source_reference, "tuples are not supported"); + Report.error (source_reference, _("tuples are not supported")); error = true; return false; } diff --git a/vala/valatypecheck.vala b/vala/valatypecheck.vala index 3674b5c45..1b89d936e 100644 --- a/vala/valatypecheck.vala +++ b/vala/valatypecheck.vala @@ -105,7 +105,7 @@ public class Vala.TypeCheck : Expression { type_reference.check (context); if (expression.value_type == null) { - Report.error (expression.source_reference, "invalid left operand"); + Report.error (expression.source_reference, _("invalid left operand")); error = true; return false; } @@ -117,13 +117,13 @@ public class Vala.TypeCheck : Expression { } if (type_reference is ErrorType && !(expression.value_type is ErrorType)) { - Report.error (expression.source_reference, "`%s' must be an error".printf (expression.to_string ())); + Report.error (expression.source_reference, _("`%s' must be an error").printf (expression.to_string ())); error = true; return false; } if (context.profile == Profile.GOBJECT && type_reference.has_type_arguments ()) { - Report.warning (_data_type.source_reference, "Type argument list has no effect"); + Report.warning (_data_type.source_reference, _("Type argument list has no effect")); } value_type = context.analyzer.bool_type; diff --git a/vala/valatypeofexpression.vala b/vala/valatypeofexpression.vala index 5aa28e1fd..966dcdeda 100644 --- a/vala/valatypeofexpression.vala +++ b/vala/valatypeofexpression.vala @@ -83,7 +83,7 @@ public class Vala.TypeofExpression : Expression { value_type = context.analyzer.type_type; if (context.profile == Profile.GOBJECT && type_reference.has_type_arguments ()) { - Report.warning (_data_type.source_reference, "Type argument list without effect"); + Report.warning (_data_type.source_reference, _("Type argument list without effect")); } return !error; diff --git a/vala/valaunaryexpression.vala b/vala/valaunaryexpression.vala index d371d39d9..c2c78ddb7 100644 --- a/vala/valaunaryexpression.vala +++ b/vala/valaunaryexpression.vala @@ -162,7 +162,7 @@ public class Vala.UnaryExpression : Expression { if (inner.value_type is FieldPrototype || inner.value_type is PropertyPrototype) { error = true; - Report.error (inner.source_reference, "Access to instance member `%s' denied".printf (inner.symbol_reference.get_full_name ())); + Report.error (inner.source_reference, _("Access to instance member `%s' denied").printf (inner.symbol_reference.get_full_name ())); return false; } @@ -170,7 +170,7 @@ public class Vala.UnaryExpression : Expression { // integer or floating point type if (!is_numeric_type (inner.value_type)) { error = true; - Report.error (source_reference, "Operator not supported for `%s'".printf (inner.value_type.to_string ())); + Report.error (source_reference, _("Operator not supported for `%s'").printf (inner.value_type.to_string ())); return false; } @@ -179,7 +179,7 @@ public class Vala.UnaryExpression : Expression { // boolean type if (!inner.value_type.compatible (context.analyzer.bool_type)) { error = true; - Report.error (source_reference, "Operator not supported for `%s'".printf (inner.value_type.to_string ())); + Report.error (source_reference, _("Operator not supported for `%s'").printf (inner.value_type.to_string ())); return false; } @@ -188,7 +188,7 @@ public class Vala.UnaryExpression : Expression { // integer type if (!is_integer_type (inner.value_type) && !(inner.value_type is EnumValueType)) { error = true; - Report.error (source_reference, "Operator not supported for `%s'".printf (inner.value_type.to_string ())); + Report.error (source_reference, _("Operator not supported for `%s'").printf (inner.value_type.to_string ())); return false; } @@ -198,14 +198,14 @@ public class Vala.UnaryExpression : Expression { // integer type if (!is_integer_type (inner.value_type)) { error = true; - Report.error (source_reference, "Operator not supported for `%s'".printf (inner.value_type.to_string ())); + Report.error (source_reference, _("Operator not supported for `%s'").printf (inner.value_type.to_string ())); return false; } var ma = find_member_access (inner); if (ma == null) { error = true; - Report.error (source_reference, "Prefix operators not supported for this expression"); + Report.error (source_reference, _("Prefix operators not supported for this expression")); return false; } @@ -227,7 +227,7 @@ public class Vala.UnaryExpression : Expression { value_type = inner.value_type; } else { error = true; - Report.error (source_reference, "ref and out method arguments can only be used with fields, parameters, local variables, and array element access"); + Report.error (source_reference, _("ref and out method arguments can only be used with fields, parameters, local variables, and array element access")); return false; } } else { diff --git a/vala/valaunlockstatement.vala b/vala/valaunlockstatement.vala index d60d5706c..aeb4f9994 100644 --- a/vala/valaunlockstatement.vala +++ b/vala/valaunlockstatement.vala @@ -67,7 +67,7 @@ public class Vala.UnlockStatement : CodeNode, Statement { if (!(resource is MemberAccess && resource.symbol_reference is Lockable)) { error = true; resource.error = true; - Report.error (resource.source_reference, "Expression is either not a member access or does not denote a lockable member"); + Report.error (resource.source_reference, _("Expression is either not a member access or does not denote a lockable member")); return false; } @@ -75,7 +75,7 @@ public class Vala.UnlockStatement : CodeNode, Statement { if (resource.symbol_reference.parent_symbol != context.analyzer.current_class) { error = true; resource.error = true; - Report.error (resource.source_reference, "Only members of the current class are lockable"); + Report.error (resource.source_reference, _("Only members of the current class are lockable")); return false; } @@ -83,7 +83,7 @@ public class Vala.UnlockStatement : CodeNode, Statement { if (context.analyzer.current_class.is_compact) { error = true; resource.error = true; - Report.error (resource.source_reference, "Only members of the non-compact classes are lockable"); + Report.error (resource.source_reference, _("Only members of the non-compact classes are lockable")); return false; } diff --git a/vala/valaunresolvedsymbol.vala b/vala/valaunresolvedsymbol.vala index 40b437159..fd5501fd0 100644 --- a/vala/valaunresolvedsymbol.vala +++ b/vala/valaunresolvedsymbol.vala @@ -49,7 +49,7 @@ public class Vala.UnresolvedSymbol : Symbol { } } - Report.error (expr.source_reference, "Type reference must be simple name or member access expression"); + Report.error (expr.source_reference, _("Type reference must be simple name or member access expression")); return null; } diff --git a/vala/valausedattr.vala b/vala/valausedattr.vala index c4c05cdaa..25364b3af 100644 --- a/vala/valausedattr.vala +++ b/vala/valausedattr.vala @@ -135,11 +135,11 @@ public class Vala.UsedAttr : CodeVisitor { foreach (unowned Attribute attr in sym.attributes) { var set = marked.get (attr.name); if (set == null) { - Report.warning (attr.source_reference, "attribute `%s' never used".printf (attr.name)); + Report.warning (attr.source_reference, _("attribute `%s' never used").printf (attr.name)); } else { foreach (var arg in attr.args.get_keys()) { if (!set.contains (arg)) { - Report.warning (attr.source_reference, "argument `%s' never used".printf (arg)); + Report.warning (attr.source_reference, _("argument `%s' never used").printf (arg)); } } } diff --git a/vala/valaversionattribute.vala b/vala/valaversionattribute.vala index 4af5da27a..e400ff751 100644 --- a/vala/valaversionattribute.vala +++ b/vala/valaversionattribute.vala @@ -165,7 +165,7 @@ public class Vala.VersionAttribute { if (CodeContext.get ().since_check && package_version != null && VersionAttribute.cmp_versions (package_version, since) < 0) { unowned string filename = symbol.source_reference.file.filename; string pkg = Path.get_basename (filename[0:filename.last_index_of_char ('.')]); - Report.error (source_ref, "%s is not available in %s %s. Use %s >= %s".printf (symbol.get_full_name (), pkg, package_version, pkg, since)); + Report.error (source_ref, _("%s is not available in %s %s. Use %s >= %s").printf (symbol.get_full_name (), pkg, package_version, pkg, since)); } result = true; }