From 94366a5e6a1b7d0c8407b00c9d36acb01f19d95b Mon Sep 17 00:00:00 2001 From: Constantin Piber <59023762+cpiber@users.noreply.github.com> Date: Fri, 15 Nov 2024 13:40:01 +0100 Subject: [PATCH] fix: Introduce localized strings for new errors (#329) --- .../DynamicExpresso.Core.csproj | 15 + .../AssignmentOperatorDisabledException.cs | 3 +- .../Exceptions/DuplicateParameterException.cs | 3 +- .../Exceptions/NoApplicableMethodException.cs | 3 +- .../ReflectionNotAllowedException.cs | 3 +- .../Exceptions/UnknownIdentifierException.cs | 3 +- src/DynamicExpresso.Core/Interpreter.cs | 5 +- src/DynamicExpresso.Core/Lambda.cs | 3 +- .../Parsing/InterpreterExpression.cs | 3 +- src/DynamicExpresso.Core/Parsing/Parser.cs | 12 +- src/DynamicExpresso.Core/ReferenceType.cs | 3 +- .../Resources/ErrorMessages.Designer.cs | 493 +++++++----------- .../Resources/ErrorMessages.de.resx | 36 ++ .../Resources/ErrorMessages.resx | 92 +++- 14 files changed, 324 insertions(+), 353 deletions(-) diff --git a/src/DynamicExpresso.Core/DynamicExpresso.Core.csproj b/src/DynamicExpresso.Core/DynamicExpresso.Core.csproj index 29140fcd..4382d88c 100644 --- a/src/DynamicExpresso.Core/DynamicExpresso.Core.csproj +++ b/src/DynamicExpresso.Core/DynamicExpresso.Core.csproj @@ -24,4 +24,19 @@ <PackageReference Include="Microsoft.CSharp" Version="4.7.0" /> </ItemGroup> + <ItemGroup> + <EmbeddedResource Update="Resources\ErrorMessages.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>ErrorMessages.Designer.cs</LastGenOutput> + </EmbeddedResource> + </ItemGroup> + + <ItemGroup> + <Compile Update="Resources\ErrorMessages.Designer.cs"> + <DesignTime>True</DesignTime> + <AutoGen>True</AutoGen> + <DependentUpon>ErrorMessages.resx</DependentUpon> + </Compile> + </ItemGroup> + </Project> diff --git a/src/DynamicExpresso.Core/Exceptions/AssignmentOperatorDisabledException.cs b/src/DynamicExpresso.Core/Exceptions/AssignmentOperatorDisabledException.cs index e13fdbe1..f069690f 100644 --- a/src/DynamicExpresso.Core/Exceptions/AssignmentOperatorDisabledException.cs +++ b/src/DynamicExpresso.Core/Exceptions/AssignmentOperatorDisabledException.cs @@ -1,5 +1,6 @@ using System; using System.Runtime.Serialization; +using DynamicExpresso.Resources; namespace DynamicExpresso.Exceptions { @@ -7,7 +8,7 @@ namespace DynamicExpresso.Exceptions public class AssignmentOperatorDisabledException : ParseException { public AssignmentOperatorDisabledException(string operatorString, int position) - : base(string.Format("Assignment operator '{0}' not allowed", operatorString), position) + : base(string.Format(ErrorMessages.AssignmentOperatorNotAllowed, operatorString), position) { OperatorString = operatorString; } diff --git a/src/DynamicExpresso.Core/Exceptions/DuplicateParameterException.cs b/src/DynamicExpresso.Core/Exceptions/DuplicateParameterException.cs index 765545a1..d5a49d22 100644 --- a/src/DynamicExpresso.Core/Exceptions/DuplicateParameterException.cs +++ b/src/DynamicExpresso.Core/Exceptions/DuplicateParameterException.cs @@ -1,5 +1,6 @@ using System; using System.Runtime.Serialization; +using DynamicExpresso.Resources; namespace DynamicExpresso.Exceptions { @@ -7,7 +8,7 @@ namespace DynamicExpresso.Exceptions public class DuplicateParameterException : DynamicExpressoException { public DuplicateParameterException(string identifier) - : base(string.Format("The parameter '{0}' was defined more than once", identifier)) + : base(string.Format(ErrorMessages.DuplicateParameter, identifier)) { Identifier = identifier; } diff --git a/src/DynamicExpresso.Core/Exceptions/NoApplicableMethodException.cs b/src/DynamicExpresso.Core/Exceptions/NoApplicableMethodException.cs index 29255427..4298d695 100644 --- a/src/DynamicExpresso.Core/Exceptions/NoApplicableMethodException.cs +++ b/src/DynamicExpresso.Core/Exceptions/NoApplicableMethodException.cs @@ -1,5 +1,6 @@ using System; using System.Runtime.Serialization; +using DynamicExpresso.Resources; namespace DynamicExpresso.Exceptions { @@ -7,7 +8,7 @@ namespace DynamicExpresso.Exceptions public class NoApplicableMethodException : ParseException { public NoApplicableMethodException(string methodName, string methodTypeName, int position) - : base(string.Format("No applicable method '{0}' exists in type '{1}'", methodName, methodTypeName), position) + : base(string.Format(ErrorMessages.InvalidMethodCall2, methodName, methodTypeName), position) { MethodTypeName = methodTypeName; MethodName = methodName; diff --git a/src/DynamicExpresso.Core/Exceptions/ReflectionNotAllowedException.cs b/src/DynamicExpresso.Core/Exceptions/ReflectionNotAllowedException.cs index a8b55081..9604c3ee 100644 --- a/src/DynamicExpresso.Core/Exceptions/ReflectionNotAllowedException.cs +++ b/src/DynamicExpresso.Core/Exceptions/ReflectionNotAllowedException.cs @@ -1,5 +1,6 @@ using System; using System.Runtime.Serialization; +using DynamicExpresso.Resources; namespace DynamicExpresso.Exceptions { @@ -7,7 +8,7 @@ namespace DynamicExpresso.Exceptions public class ReflectionNotAllowedException : ParseException { public ReflectionNotAllowedException() - : base("Reflection expression not allowed. To enable reflection use Interpreter.EnableReflection().", 0) + : base(ErrorMessages.ReflectionNotAllowed, 0) { } diff --git a/src/DynamicExpresso.Core/Exceptions/UnknownIdentifierException.cs b/src/DynamicExpresso.Core/Exceptions/UnknownIdentifierException.cs index dab591fe..6591e4c5 100644 --- a/src/DynamicExpresso.Core/Exceptions/UnknownIdentifierException.cs +++ b/src/DynamicExpresso.Core/Exceptions/UnknownIdentifierException.cs @@ -1,5 +1,6 @@ using System; using System.Runtime.Serialization; +using DynamicExpresso.Resources; namespace DynamicExpresso.Exceptions { @@ -7,7 +8,7 @@ namespace DynamicExpresso.Exceptions public class UnknownIdentifierException : ParseException { public UnknownIdentifierException(string identifier, int position) - : base(string.Format("Unknown identifier '{0}'", identifier), position) + : base(string.Format(ErrorMessages.UnknownIdentifier, identifier), position) { Identifier = identifier; } diff --git a/src/DynamicExpresso.Core/Interpreter.cs b/src/DynamicExpresso.Core/Interpreter.cs index 74c81ce6..4a8b05ec 100644 --- a/src/DynamicExpresso.Core/Interpreter.cs +++ b/src/DynamicExpresso.Core/Interpreter.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Linq.Expressions; using DynamicExpresso.Exceptions; +using DynamicExpresso.Resources; namespace DynamicExpresso { @@ -134,7 +135,7 @@ public Interpreter SetDefaultNumberType(DefaultNumberType defaultNumberType) } /// <summary> - /// Allows to enable/disable assignment operators. + /// Allows to enable/disable assignment operators. /// For security when expression are generated by the users is more safe to disable assignment operators. /// </summary> /// <param name="assignmentOperators"></param> @@ -278,7 +279,7 @@ public Interpreter SetIdentifier(Identifier identifier) throw new ArgumentNullException(nameof(identifier)); if (LanguageConstants.ReservedKeywords.Contains(identifier.Name)) - throw new InvalidOperationException($"{identifier.Name} is a reserved word"); + throw new InvalidOperationException(string.Format(ErrorMessages.ReservedWord, identifier.Name)); _settings.Identifiers[identifier.Name] = identifier; diff --git a/src/DynamicExpresso.Core/Lambda.cs b/src/DynamicExpresso.Core/Lambda.cs index 707f51d7..23b8f91e 100644 --- a/src/DynamicExpresso.Core/Lambda.cs +++ b/src/DynamicExpresso.Core/Lambda.cs @@ -5,6 +5,7 @@ using System.Reflection; using System.Runtime.ExceptionServices; using DynamicExpresso.Reflection; +using DynamicExpresso.Resources; namespace DynamicExpresso { @@ -87,7 +88,7 @@ public object Invoke(params object[] args) if (args != null) { if (declaredParameters.Length != args.Length) - throw new InvalidOperationException("Arguments count mismatch."); + throw new InvalidOperationException(ErrorMessages.ArgumentCountMismatch); for (var i = 0; i < args.Length; i++) { diff --git a/src/DynamicExpresso.Core/Parsing/InterpreterExpression.cs b/src/DynamicExpresso.Core/Parsing/InterpreterExpression.cs index 75d5dfb2..1dc98a9d 100644 --- a/src/DynamicExpresso.Core/Parsing/InterpreterExpression.cs +++ b/src/DynamicExpresso.Core/Parsing/InterpreterExpression.cs @@ -4,6 +4,7 @@ using System.Linq.Expressions; using DynamicExpresso.Exceptions; using DynamicExpresso.Reflection; +using DynamicExpresso.Resources; namespace DynamicExpresso.Parsing { @@ -35,7 +36,7 @@ public InterpreterExpression(ParserArguments parserArguments, string expressionT { if (settings.Identifiers.ContainsKey(myParameter.Name)) { - throw new ParseException($"A local or parameter named '{myParameter.Name}' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter", myParameter.Position); + throw new ParseException(string.Format(ErrorMessages.DuplicateLocalParameterDeclaration, myParameter.Name), myParameter.Position); } } diff --git a/src/DynamicExpresso.Core/Parsing/Parser.cs b/src/DynamicExpresso.Core/Parsing/Parser.cs index 5118524c..eb61acdf 100644 --- a/src/DynamicExpresso.Core/Parsing/Parser.cs +++ b/src/DynamicExpresso.Core/Parsing/Parser.cs @@ -175,7 +175,7 @@ private ParameterWithPosition[] ParseLambdaParameterList() } if (!hasOpenParen && parameters.Length > 1) - throw new ParseException("Multiple lambda parameters detected, but with no surrounding parenthesis", _parsePosition); + throw new ParseException(ErrorMessages.MultipleLambdaParametersWithoutBrace, _parsePosition); return parameters; } @@ -508,7 +508,7 @@ public bool IsShiftOperator(out ExpressionType shiftType) // << could be a token, but is not for symmetry else if (_token.id == TokenId.LessThan && _parseChar == '<') { - NextToken(); // consume next < + NextToken(); // consume next < shiftType = ExpressionType.LeftShift; return true; } @@ -1397,7 +1397,7 @@ private Type ParseKnownType() private bool TryParseKnownType(string name, out Type type) { - // if the type is unknown, we need to restart parsing + // if the type is unknown, we need to restart parsing var originalPos = _token.pos; // the name might reference a generic type, with an aliased name (e.g. List<T> = MyList instead of List`1) @@ -1433,7 +1433,7 @@ private Type ParseKnownGenericType(string name, Type type) return null; if (rank != type.GetGenericArguments().Length) - throw new ArgumentException($"The number of generic arguments provided doesn't equal the arity of the generic type definition."); + throw new ArgumentException(ErrorMessages.GenericArgumentCountMismatch); // there are actual type arguments: instantiate the proper generic type if (typeArguments.All(_ => _ != null)) @@ -1959,7 +1959,7 @@ private Expression GenerateGreaterThan(Expression left, Expression right) return GenerateBinary(ExpressionType.GreaterThan, left, right); } - + private Expression GenerateGreaterThanEqual(Expression left, Expression right) { @@ -2533,7 +2533,7 @@ private void NextToken() if (_parsePosition == _expressionTextLength) { if (_token.id == TokenId.End) - throw new InvalidOperationException("NextToken called when already at the end of the expression"); + throw new InvalidOperationException(ErrorMessages.NextTokenAtEnd); t = TokenId.End; break; diff --git a/src/DynamicExpresso.Core/ReferenceType.cs b/src/DynamicExpresso.Core/ReferenceType.cs index 5019b757..f1664214 100644 --- a/src/DynamicExpresso.Core/ReferenceType.cs +++ b/src/DynamicExpresso.Core/ReferenceType.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Reflection; using DynamicExpresso.Reflection; +using DynamicExpresso.Resources; namespace DynamicExpresso { @@ -30,7 +31,7 @@ public ReferenceType(string name, Type type) var genericType = type.GetGenericTypeDefinition(); var genericTypeName = genericType.Name.Substring(0, genericType.Name.IndexOf('`')); genericTypeName += $"<{new string(',', genericType.GetGenericArguments().Length - 1)}>"; - throw new ArgumentException($"Generic type must be referenced via its generic definition: {genericTypeName}"); + throw new ArgumentException(string.Format(ErrorMessages.GenericTypeReference, genericTypeName)); } Type = type; diff --git a/src/DynamicExpresso.Core/Resources/ErrorMessages.Designer.cs b/src/DynamicExpresso.Core/Resources/ErrorMessages.Designer.cs index 7e0643d1..d85515ba 100644 --- a/src/DynamicExpresso.Core/Resources/ErrorMessages.Designer.cs +++ b/src/DynamicExpresso.Core/Resources/ErrorMessages.Designer.cs @@ -1,7 +1,6 @@ -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. -// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -12,552 +11,428 @@ namespace DynamicExpresso.Resources { using System; - /// <summary> - /// A strongly-typed resource class, for looking up localized strings, etc. - /// </summary> - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [System.Diagnostics.DebuggerNonUserCodeAttribute()] + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class ErrorMessages { - private static global::System.Resources.ResourceManager resourceMan; + private static System.Resources.ResourceManager resourceMan; - private static global::System.Globalization.CultureInfo resourceCulture; + private static System.Globalization.CultureInfo resourceCulture; - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal ErrorMessages() { } - - /// <summary> - /// Returns the cached ResourceManager instance used by this class. - /// </summary> - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DynamicExpresso.Resources.ErrorMessages", typeof(ErrorMessages).Assembly); + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Resources.ResourceManager ResourceManager { + get { + if (object.Equals(null, resourceMan)) { + System.Resources.ResourceManager temp = new System.Resources.ResourceManager("DynamicExpresso.Resources.ErrorMessages", typeof(ErrorMessages).Assembly); resourceMan = temp; } return resourceMan; } } - /// <summary> - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// </summary> - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } - } - - /// <summary> - /// Looks up a localized string similar to Ambiguous invocation of indexer in type '{0}'. - /// </summary> - internal static string AmbiguousIndexerInvocation { + } + + internal static string AmbiguousIndexerInvocation { get { return ResourceManager.GetString("AmbiguousIndexerInvocation", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to Ambiguous invocation of method '{0}' in type '{1}'. - /// </summary> internal static string AmbiguousMethodInvocation { get { return ResourceManager.GetString("AmbiguousMethodInvocation", resourceCulture); } } - - /// <summary> - /// Looks up a localized string similar to Ambiguous invocation of user defined operator '{0}' in type '{1}'. - /// </summary> - internal static string AmbiguousUnaryOperatorInvocation - { - get - { - return ResourceManager.GetString("AmbiguousUnaryOperatorInvocation", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to Ambiguous invocation of user defined operator '{0}' in types '{1}' and '{2}'. - /// </summary> - internal static string AmbiguousBinaryOperatorInvocation - { - get - { - return ResourceManager.GetString("AmbiguousBinaryOperatorInvocation", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to Ambiguous invocation of delegate (multiple overloads found). - /// </summary> - internal static string AmbiguousDelegateInvocation - { - get - { - return ResourceManager.GetString("AmbiguousDelegateInvocation", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to Argument list incompatible with delegate expression. - /// </summary> + internal static string ArgsIncompatibleWithDelegate { get { return ResourceManager.GetString("ArgsIncompatibleWithDelegate", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to Argument list incompatible with lambda expression. - /// </summary> internal static string ArgsIncompatibleWithLambda { get { return ResourceManager.GetString("ArgsIncompatibleWithLambda", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to Both of the types '{0}' and '{1}' convert to the other. - /// </summary> internal static string BothTypesConvertToOther { get { return ResourceManager.GetString("BothTypesConvertToOther", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to A value of type '{0}' cannot be converted to type '{1}'. - /// </summary> internal static string CannotConvertValue { get { return ResourceManager.GetString("CannotConvertValue", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to ']' or ',' expected. - /// </summary> internal static string CloseBracketOrCommaExpected { get { return ResourceManager.GetString("CloseBracketOrCommaExpected", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to ')' or ',' expected. - /// </summary> internal static string CloseParenOrCommaExpected { get { return ResourceManager.GetString("CloseParenOrCommaExpected", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to ')' or operator expected. - /// </summary> internal static string CloseParenOrOperatorExpected { get { return ResourceManager.GetString("CloseParenOrOperatorExpected", resourceCulture); } } - - /// <summary> - /// Looks up a localized string similar to '=' expected. - /// </summary> - internal static string EqualExpected - { - get - { - return ResourceManager.GetString("EqualExpected", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to ':' expected. - /// </summary> + internal static string ColonExpected { get { return ResourceManager.GetString("ColonExpected", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to Digit expected. - /// </summary> internal static string DigitExpected { get { return ResourceManager.GetString("DigitExpected", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to '.' or '(' expected. - /// </summary> internal static string DotOrOpenParenExpected { get { return ResourceManager.GetString("DotOrOpenParenExpected", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to Expression expected. - /// </summary> internal static string ExpressionExpected { get { return ResourceManager.GetString("ExpressionExpected", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to Expression must be writable. - /// </summary> internal static string ExpressionMustBeWritable { get { return ResourceManager.GetString("ExpressionMustBeWritable", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to The first expression must be of type 'Boolean'. - /// </summary> internal static string FirstExprMustBeBool { get { return ResourceManager.GetString("FirstExprMustBeBool", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to {0} (at index {1}).. - /// </summary> internal static string Format { get { return ResourceManager.GetString("Format", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to Identifier expected. - /// </summary> internal static string IdentifierExpected { get { return ResourceManager.GetString("IdentifierExpected", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to Operator '{0}' incompatible with operand type '{1}'. - /// </summary> internal static string IncompatibleOperand { get { return ResourceManager.GetString("IncompatibleOperand", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to Operator '{0}' incompatible with operand types '{1}' and '{2}'. - /// </summary> internal static string IncompatibleOperands { get { return ResourceManager.GetString("IncompatibleOperands", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to Incorrect number of indexes. - /// </summary> internal static string IncorrectNumberOfIndexes { get { return ResourceManager.GetString("IncorrectNumberOfIndexes", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to Syntax error '{0}'. - /// </summary> internal static string InvalidCharacter { get { return ResourceManager.GetString("InvalidCharacter", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to Character literal must contain exactly one character. - /// </summary> internal static string InvalidCharacterLiteral { get { return ResourceManager.GetString("InvalidCharacterLiteral", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to Invalid character escape sequence. - /// </summary> internal static string InvalidEscapeSequence { get { return ResourceManager.GetString("InvalidEscapeSequence", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to Array index must be an integer expression. - /// </summary> internal static string InvalidIndex { get { return ResourceManager.GetString("InvalidIndex", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to Invalid integer literal '{0}'. - /// </summary> internal static string InvalidIntegerLiteral { get { return ResourceManager.GetString("InvalidIntegerLiteral", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to No applicable method exists in type '{0}'. - /// </summary> internal static string InvalidMethodCall { get { return ResourceManager.GetString("InvalidMethodCall", resourceCulture); } } - - /// <summary> - /// Looks up a localized string similar to Params array type is not an array, element not found - /// </summary> - internal static string ParamsArrayTypeNotAnArray - { - get - { - return ResourceManager.GetString("ParamsArrayTypeNotAnArray", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to The type arguments for method '{0}' cannot be inferred from the usage. - /// </summary> - internal static string MethodTypeParametersCantBeInferred - { - get - { - return ResourceManager.GetString("MethodTypeParametersCantBeInferred", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to Invalid real literal '{0}'. - /// </summary> - internal static string InvalidRealLiteral { + + internal static string InvalidRealLiteral { get { return ResourceManager.GetString("InvalidRealLiteral", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to Neither of the types '{0}' and '{1}' converts to the other. - /// </summary> internal static string NeitherTypeConvertsToOther { get { return ResourceManager.GetString("NeitherTypeConvertsToOther", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to No applicable constructor exists in type '{0}'. - /// </summary> internal static string NoApplicableConstructor { get { return ResourceManager.GetString("NoApplicableConstructor", resourceCulture); } - } - - /// <summary> - /// Looks up a localized string similar to Ambiguous invocation of constructor in type '{0}'. - /// </summary> - internal static string AmbiguousConstructorInvocation - { - get - { - return ResourceManager.GetString("AmbiguousConstructorInvocation", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to No applicable indexer exists in type '{0}'. - /// </summary> - internal static string NoApplicableIndexer { + } + + internal static string NoApplicableIndexer { get { return ResourceManager.GetString("NoApplicableIndexer", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to '(' expected. - /// </summary> internal static string OpenParenExpected { get { return ResourceManager.GetString("OpenParenExpected", resourceCulture); } } - - /// <summary> - /// Looks up a localized string similar to '{' expected. - /// </summary> - internal static string OpenCurlyBracketExpected - { - get - { - return ResourceManager.GetString("OpenCurlyBracketExpected", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to '}' expected. - /// </summary> - internal static string CloseCurlyBracketExpected - { - get - { - return ResourceManager.GetString("CloseCurlyBracketExpected", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to '>' expected. - /// </summary> - internal static string CloseTypeArgumentListExpected - { - get - { - return ResourceManager.GetString("CloseTypeArgumentListExpected", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to Syntax error. - /// </summary> + internal static string SyntaxError { get { return ResourceManager.GetString("SyntaxError", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to Type '{0}' has no nullable form. - /// </summary> internal static string TypeHasNoNullableForm { get { return ResourceManager.GetString("TypeHasNoNullableForm", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to Type identifier expected. - /// </summary> internal static string TypeIdentifierExpected { get { return ResourceManager.GetString("TypeIdentifierExpected", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to The 'typeof' keyword requires a type as an argument. - /// </summary> internal static string TypeofRequiresAType { get { return ResourceManager.GetString("TypeofRequiresAType", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to The 'typeof' keyword requires 1 argument. - /// </summary> internal static string TypeofRequiresOneArg { get { return ResourceManager.GetString("TypeofRequiresOneArg", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to No property or field '{0}' exists in type '{1}'. - /// </summary> internal static string UnknownPropertyOrField { get { return ResourceManager.GetString("UnknownPropertyOrField", resourceCulture); } } - /// <summary> - /// Looks up a localized string similar to Unterminated string literal. - /// </summary> internal static string UnterminatedStringLiteral { get { return ResourceManager.GetString("UnterminatedStringLiteral", resourceCulture); } } - - /// <summary> - /// Looks up a localized string similar to Unterminated string literal. - /// </summary> + internal static string InvalidOperation { get { return ResourceManager.GetString("InvalidOperation", resourceCulture); } } - - /// <summary> - /// Looks up a localized string similar to Multidimensional arrays are not supported. - /// </summary> - internal static string UnsupportedMultidimensionalArrays - { - get - { - return ResourceManager.GetString("UnsupportedMultidimensionalArrays", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to Invalid initializer member declarator. - /// </summary> - internal static string InvalidInitializerMemberDeclarator { - get { - return ResourceManager.GetString("InvalidInitializerMemberDeclarator", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to Cannot initialize type '{0}' with a collection initializer because it does not implement '{1}'. - /// </summary> - internal static string CollectionInitializationNotSupported { - get { - return ResourceManager.GetString("CollectionInitializationNotSupported", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to The best overloaded Add method '{0}.Add' for the collection initializer has some invalid arguments. - /// </summary> - internal static string UnableToFindAppropriateAddMethod { - get { - return ResourceManager.GetString("UnableToFindAppropriateAddMethod", resourceCulture); - } - } - - } + + internal static string AmbiguousBinaryOperatorInvocation { + get { + return ResourceManager.GetString("AmbiguousBinaryOperatorInvocation", resourceCulture); + } + } + + internal static string AmbiguousUnaryOperatorInvocation { + get { + return ResourceManager.GetString("AmbiguousUnaryOperatorInvocation", resourceCulture); + } + } + + internal static string AmbiguousDelegateInvocation { + get { + return ResourceManager.GetString("AmbiguousDelegateInvocation", resourceCulture); + } + } + + internal static string CloseCurlyBracketExpected { + get { + return ResourceManager.GetString("CloseCurlyBracketExpected", resourceCulture); + } + } + + internal static string OpenCurlyBracketExpected { + get { + return ResourceManager.GetString("OpenCurlyBracketExpected", resourceCulture); + } + } + + internal static string EqualExpected { + get { + return ResourceManager.GetString("EqualExpected", resourceCulture); + } + } + + internal static string CloseTypeArgumentListExpected { + get { + return ResourceManager.GetString("CloseTypeArgumentListExpected", resourceCulture); + } + } + + internal static string MethodTypeParametersCantBeInferred { + get { + return ResourceManager.GetString("MethodTypeParametersCantBeInferred", resourceCulture); + } + } + + internal static string ParamsArrayTypeNotAnArray { + get { + return ResourceManager.GetString("ParamsArrayTypeNotAnArray", resourceCulture); + } + } + + internal static string AmbiguousConstructorInvocation { + get { + return ResourceManager.GetString("AmbiguousConstructorInvocation", resourceCulture); + } + } + + internal static string UnsupportedMultidimensionalArrays { + get { + return ResourceManager.GetString("UnsupportedMultidimensionalArrays", resourceCulture); + } + } + + internal static string InvalidInitializerMemberDeclarator { + get { + return ResourceManager.GetString("InvalidInitializerMemberDeclarator", resourceCulture); + } + } + + internal static string CollectionInitializationNotSupported { + get { + return ResourceManager.GetString("CollectionInitializationNotSupported", resourceCulture); + } + } + + internal static string UnableToFindAppropriateAddMethod { + get { + return ResourceManager.GetString("UnableToFindAppropriateAddMethod", resourceCulture); + } + } + + internal static string ReservedWord { + get { + return ResourceManager.GetString("ReservedWord", resourceCulture); + } + } + + internal static string ArgumentCountMismatch { + get { + return ResourceManager.GetString("ArgumentCountMismatch", resourceCulture); + } + } + + internal static string GenericTypeReference { + get { + return ResourceManager.GetString("GenericTypeReference", resourceCulture); + } + } + + internal static string AssignmentOperatorNotAllowed { + get { + return ResourceManager.GetString("AssignmentOperatorNotAllowed", resourceCulture); + } + } + + internal static string DuplicateParameter { + get { + return ResourceManager.GetString("DuplicateParameter", resourceCulture); + } + } + + internal static string InvalidMethodCall2 { + get { + return ResourceManager.GetString("InvalidMethodCall2", resourceCulture); + } + } + + internal static string ReflectionNotAllowed { + get { + return ResourceManager.GetString("ReflectionNotAllowed", resourceCulture); + } + } + + internal static string UnknownIdentifier { + get { + return ResourceManager.GetString("UnknownIdentifier", resourceCulture); + } + } + + internal static string DuplicateLocalParameterDeclaration { + get { + return ResourceManager.GetString("DuplicateLocalParameterDeclaration", resourceCulture); + } + } + + internal static string MultipleLambdaParametersWithoutBrace { + get { + return ResourceManager.GetString("MultipleLambdaParametersWithoutBrace", resourceCulture); + } + } + + internal static string GenericArgumentCountMismatch { + get { + return ResourceManager.GetString("GenericArgumentCountMismatch", resourceCulture); + } + } + + internal static string NextTokenAtEnd { + get { + return ResourceManager.GetString("NextTokenAtEnd", resourceCulture); + } + } + } } diff --git a/src/DynamicExpresso.Core/Resources/ErrorMessages.de.resx b/src/DynamicExpresso.Core/Resources/ErrorMessages.de.resx index cc3a5d1f..65e6b453 100644 --- a/src/DynamicExpresso.Core/Resources/ErrorMessages.de.resx +++ b/src/DynamicExpresso.Core/Resources/ErrorMessages.de.resx @@ -177,4 +177,40 @@ <data name="UnterminatedStringLiteral" xml:space="preserve"> <value>Nicht-beendetes Zeichenfolgenliteral</value> </data> + <data name="ReservedWord" xml:space="preserve"> + <value>{0} ist ein reserviertes Wort</value> + </data> + <data name="ArgumentCountMismatch" xml:space="preserve"> + <value>Argumentzahl unpassend</value> + </data> + <data name="GenericTypeReference" xml:space="preserve"> + <value>Generische Typen müssen mittels generischer Definition referenziert werden: {0}</value> + </data> + <data name="AssignmentOperatorNotAllowed" xml:space="preserve"> + <value>Zuweisungsoperator '{0}' ist nicht erlaubt</value> + </data> + <data name="DuplicateParameter" xml:space="preserve"> + <value>Der Parameter '{0}' wurde mehrmals definiert</value> + </data> + <data name="InvalidMethodCall2" xml:space="preserve"> + <value>Keine zutreffende Methode '{0}' gefunden im Typ '{1}'</value> + </data> + <data name="ReflectionNotAllowed" xml:space="preserve"> + <value>Spiegelungsausdrücke sind nicht erlaubt. Aktivieren Sie Spiegelung mittels Interpreter.EnableReflection().</value> + </data> + <data name="UnknownIdentifier" xml:space="preserve"> + <value>Unbekannter Bezeichner '{0}'</value> + </data> + <data name="DuplicateLocalParameterDeclaration" xml:space="preserve"> + <value>Eine locale Variable oder Parameter '{0}' kann nicht in dieser Zugriffsebene deklariert werden, da dieser Name bereits in einer höheren Zugriffsebene verwendet wird, um eine lokale Variable oder Parameter zu definieren</value> + </data> + <data name="MultipleLambdaParametersWithoutBrace" xml:space="preserve"> + <value>Mehrere Lambda-Funktionsparameter erkannt, aber keine umgebenden Klammern gegeben</value> + </data> + <data name="GenericArgumentCountMismatch" xml:space="preserve"> + <value>Die Anzahl an Typargumenten für den generischen Typ stimmt nicht mit der Stelligkeit der Definition überein</value> + </data> + <data name="NextTokenAtEnd" xml:space="preserve"> + <value>NextToken wurde am Ende des Ausdrucks aufgerufen</value> + </data> </root> diff --git a/src/DynamicExpresso.Core/Resources/ErrorMessages.resx b/src/DynamicExpresso.Core/Resources/ErrorMessages.resx index 9a3ea951..f5ed85fc 100644 --- a/src/DynamicExpresso.Core/Resources/ErrorMessages.resx +++ b/src/DynamicExpresso.Core/Resources/ErrorMessages.resx @@ -1,17 +1,17 @@ <?xml version="1.0" encoding="utf-8"?> <root> - <!-- - Microsoft ResX Schema - + <!-- + Microsoft ResX Schema + Version 2.0 - - The primary goals of this format is to allow a simple XML format - that is mostly human readable. The generation and parsing of the - various data types are done through the TypeConverter classes + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes associated with the data types. - + Example: - + ... ado.net/XML headers & schema ... <resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="version">2.0</resheader> @@ -26,36 +26,36 @@ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> <comment>This is a comment</comment> </data> - - There are any number of "resheader" rows that contain simple + + There are any number of "resheader" rows that contain simple name/value pairs. - - Each data row contains a name, and value. The row also contains a - type or mimetype. Type corresponds to a .NET class that support - text/value conversion through the TypeConverter architecture. - Classes that don't support this are serialized and stored with the + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the mimetype set. - - The mimetype is used for serialized objects, and tells the - ResXResourceReader how to depersist the object. This is currently not + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not extensible. For a given mimetype the value must be set accordingly: - - Note - application/x-microsoft.net.object.binary.base64 is the format - that the ResXResourceWriter will generate, however the reader can + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can read any of the formats listed below. - + mimetype: application/x-microsoft.net.object.binary.base64 - value : The object must be serialized with + value : The object must be serialized with : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. - + mimetype: application/x-microsoft.net.object.soap.base64 - value : The object must be serialized with + value : The object must be serialized with : System.Runtime.Serialization.Formatters.Soap.SoapFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.bytearray.base64 - value : The object must be serialized into a byte array + value : The object must be serialized into a byte array : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> @@ -276,4 +276,40 @@ <data name="UnableToFindAppropriateAddMethod" xml:space="preserve"> <value>The best overloaded Add method '{0}.Add' for the collection initializer has some invalid arguments</value> </data> -</root> \ No newline at end of file + <data name="ReservedWord" xml:space="preserve"> + <value>{0} is a reserved word</value> + </data> + <data name="ArgumentCountMismatch" xml:space="preserve"> + <value>Arguments count mismatch</value> + </data> + <data name="GenericTypeReference" xml:space="preserve"> + <value>Generic type must be referenced via its generic definition: {0}</value> + </data> + <data name="AssignmentOperatorNotAllowed" xml:space="preserve"> + <value>Assignment operator '{0}' not allowed</value> + </data> + <data name="DuplicateParameter" xml:space="preserve"> + <value>The parameter '{0}' was defined more than once</value> + </data> + <data name="InvalidMethodCall2" xml:space="preserve"> + <value>No applicable method '{0}' exists in type '{1}'</value> + </data> + <data name="ReflectionNotAllowed" xml:space="preserve"> + <value>Reflection expression not allowed. To enable reflection use Interpreter.EnableReflection().</value> + </data> + <data name="UnknownIdentifier" xml:space="preserve"> + <value>Unknown identifier '{0}'</value> + </data> + <data name="DuplicateLocalParameterDeclaration" xml:space="preserve"> + <value>A local or parameter named '{0}' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter</value> + </data> + <data name="MultipleLambdaParametersWithoutBrace" xml:space="preserve"> + <value>Multiple lambda parameters detected, but with no surrounding parenthesis</value> + </data> + <data name="GenericArgumentCountMismatch" xml:space="preserve"> + <value>The number of generic arguments provided doesn't equal the arity of the generic type definition</value> + </data> + <data name="NextTokenAtEnd" xml:space="preserve"> + <value>NextToken called when already at the end of the expression</value> + </data> +</root>