提交 b6042142 编写于 作者: A AlekseyTs

Ensure command line compilers load string resources using correct culture. (changeset 1338478)

上级 6e1fc764
......@@ -19,6 +19,7 @@
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<ItemGroup Label="File References">
<Reference Include="System.Globalization" />
<Reference Include="System.Reflection.Metadata">
<HintPath>..\..\..\..\packages\Microsoft.Bcl.Metadata.1.0.12-alpha\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
</Reference>
......
......@@ -279,8 +279,8 @@ internal override bool SuppressDefaultResponseFile(IEnumerable<string> args)
protected override void PrintLogo(TextWriter consoleOutput)
{
Assembly thisAssembly = GetType().Assembly;
consoleOutput.WriteLine(CSharpResources.LogoLine1, FileVersionInfo.GetVersionInfo(thisAssembly.Location).FileVersion);
consoleOutput.WriteLine(CSharpResources.LogoLine2);
consoleOutput.WriteLine(ErrorFacts.GetMessage(MessageID.IDS_LogoLine1, Culture), FileVersionInfo.GetVersionInfo(thisAssembly.Location).FileVersion);
consoleOutput.WriteLine(ErrorFacts.GetMessage(MessageID.IDS_LogoLine2, Culture));
consoleOutput.WriteLine();
}
......@@ -290,7 +290,7 @@ protected override void PrintLogo(TextWriter consoleOutput)
/// <param name="consoleOutput"></param>
protected override void PrintHelp(TextWriter consoleOutput)
{
consoleOutput.WriteLine(CSharpResources.CSCHelp);
consoleOutput.WriteLine(ErrorFacts.GetMessage(MessageID.IDS_CSCHelp, Culture));
}
protected override bool TryGetCompilerDiagnosticCode(string diagnosticId, out uint code)
......
......@@ -88,25 +88,6 @@ internal class CSharpResources {
}
}
/// <summary>
/// Looks up a localized string similar to
/// Visual C# Compiler Options
///
/// - OUTPUT FILES -
/// /out:&lt;file&gt; Specify output file name (default: base name of
/// file with main class or first file)
/// /target:exe Build a console executable (default) (Short
/// form: /t:exe)
/// /target:winexe Build a Windows executable (Short form:
/// /t:winexe)
/// /target:library [rest of string was truncated]&quot;;.
/// </summary>
internal static string CSCHelp {
get {
return ResourceManager.GetString("CSCHelp", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to element is expected.
/// </summary>
......@@ -8621,6 +8602,25 @@ internal class CSharpResources {
}
}
/// <summary>
/// Looks up a localized string similar to
/// Visual C# Compiler Options
///
/// - OUTPUT FILES -
/// /out:&lt;file&gt; Specify output file name (default: base name of
/// file with main class or first file)
/// /target:exe Build a console executable (default) (Short
/// form: /t:exe)
/// /target:winexe Build a Windows executable (Short form:
/// /t:winexe)
/// /target:library [rest of string was truncated]&quot;;.
/// </summary>
internal static string IDS_CSCHelp {
get {
return ResourceManager.GetString("IDS_CSCHelp", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to directory does not exist.
/// </summary>
......@@ -9098,6 +9098,24 @@ internal class CSharpResources {
}
}
/// <summary>
/// Looks up a localized string similar to Microsoft (R) Visual C# Compiler version {0}.
/// </summary>
internal static string IDS_LogoLine1 {
get {
return ResourceManager.GetString("IDS_LogoLine1", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Copyright (C) Microsoft Corporation. All rights reserved..
/// </summary>
internal static string IDS_LogoLine2 {
get {
return ResourceManager.GetString("IDS_LogoLine2", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to method group.
/// </summary>
......@@ -9422,24 +9440,6 @@ internal class CSharpResources {
}
}
/// <summary>
/// Looks up a localized string similar to Microsoft (R) Visual C# Compiler version {0}.
/// </summary>
internal static string LogoLine1 {
get {
return ResourceManager.GetString("LogoLine1", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Copyright (C) Microsoft Corporation. All rights reserved..
/// </summary>
internal static string LogoLine2 {
get {
return ResourceManager.GetString("LogoLine2", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to LookupOptions has an invalid combination of options.
/// </summary>
......
......@@ -3780,13 +3780,13 @@
<data name="ChainingSpeculativeModelIsNotSupported" xml:space="preserve">
<value>Chaining speculative semantic model is not supported. You should create a speculative model from the non-speculative ParentModel.</value>
</data>
<data name="LogoLine1" xml:space="preserve">
<data name="IDS_LogoLine1" xml:space="preserve">
<value>Microsoft (R) Visual C# Compiler version {0}</value>
</data>
<data name="LogoLine2" xml:space="preserve">
<data name="IDS_LogoLine2" xml:space="preserve">
<value>Copyright (C) Microsoft Corporation. All rights reserved.</value>
</data>
<data name="CSCHelp" xml:space="preserve">
<data name="IDS_CSCHelp" xml:space="preserve">
<value>
<![CDATA[ Visual C# Compiler Options
......
......@@ -110,6 +110,10 @@ internal enum MessageID
IDS_FeatureNameof = MessageBase + 12695,
IDS_FeatureDictionaryInitializer = MessageBase + 12696,
IDS_FeatureStructParameterlessConstructors = MessageBase + 12697,
IDS_LogoLine1 = MessageBase + 12698,
IDS_LogoLine2 = MessageBase + 12699,
IDS_CSCHelp = MessageBase + 12700,
}
// Message IDs may refer to strings that need to be localized.
......
......@@ -1424,7 +1424,7 @@ lVbRuntimePlus:
Dim constant = InternalSyntax.CConst.TryCreate(symbol.Value)
If constant Is Nothing Then
Throw New ArgumentException(String.Format(VBResources.InvalidPreprocessorConstantType, symbol.Key, symbol.Value.GetType()), parameterName)
Throw New ArgumentException(String.Format(ErrorFactory.IdToString(ERRID.IDS_InvalidPreprocessorConstantType, Culture), symbol.Key, symbol.Value.GetType()), parameterName)
End If
result(symbol.Key) = constant
......
......@@ -145,11 +145,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Private Sub PrintReferences(resolvedReferences As List(Of MetadataReference), consoleOutput As TextWriter)
For Each reference In resolvedReferences
If reference.Properties.Kind = MetadataImageKind.Module Then
consoleOutput.WriteLine(ErrorFactory.ResourceManager.GetString("IDS_MSG_ADDMODULE"), reference.Display)
consoleOutput.WriteLine(ErrorFactory.IdToString(ERRID.IDS_MSG_ADDMODULE, Culture), reference.Display)
ElseIf reference.Properties.EmbedInteropTypes Then
consoleOutput.WriteLine(ErrorFactory.ResourceManager.GetString("IDS_MSG_ADDLINKREFERENCE"), reference.Display)
consoleOutput.WriteLine(ErrorFactory.IdToString(ERRID.IDS_MSG_ADDLINKREFERENCE, Culture), reference.Display)
Else
consoleOutput.WriteLine(ErrorFactory.ResourceManager.GetString("IDS_MSG_ADDREFERENCE"), reference.Display)
consoleOutput.WriteLine(ErrorFactory.IdToString(ERRID.IDS_MSG_ADDREFERENCE, Culture), reference.Display)
End If
Next
......@@ -177,8 +177,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
''' <param name="consoleOutput"></param>
Protected Overrides Sub PrintLogo(consoleOutput As TextWriter)
Dim thisAssembly As Assembly = Me.GetType().Assembly
consoleOutput.WriteLine(VBResources.LogoLine1, FileVersionInfo.GetVersionInfo(thisAssembly.Location).FileVersion)
consoleOutput.WriteLine(VBResources.LogoLine2)
consoleOutput.WriteLine(ErrorFactory.IdToString(ERRID.IDS_LogoLine1, Culture), FileVersionInfo.GetVersionInfo(thisAssembly.Location).FileVersion)
consoleOutput.WriteLine(ErrorFactory.IdToString(ERRID.IDS_LogoLine2, Culture))
consoleOutput.WriteLine()
End Sub
......@@ -187,7 +187,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
''' </summary>
''' <param name="consoleOutput"></param>
Protected Overrides Sub PrintHelp(consoleOutput As TextWriter)
consoleOutput.WriteLine(VBResources.VBCHelp)
consoleOutput.WriteLine(ErrorFactory.IdToString(ERRID.IDS_VBCHelp, Culture))
End Sub
Protected Overrides Function TryGetCompilerDiagnosticCode(diagnosticId As String, ByRef code As UInteger) As Boolean
......
......@@ -1855,8 +1855,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
WRN_PrefixAndXmlnsLocalName = 42360
WRN_UseValueForXmlExpression3 = 42361 ' Replaces ERR_UseValueForXmlExpression3
IDS_ProjectSettingsLocationName = 42362 ' unless we have a separate resource, we need to use a error number for this.
'WRN_PDBConstantStringValueTooLong = 42363 we gave up on this warning. See comments in commonCompilation.Emit()
WRN_ReturnTypeAttributeOnWriteOnlyProperty = 42364
......@@ -1906,9 +1904,17 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
FEATUREID_Last = 55007
' Adding diagnostic arguments from resx file, TO DO: ASSIGN IDS
IDS_ProjectSettingsLocationName
IDS_FunctionReturnType
IDS_TheSystemCannotFindThePathSpecified
IDS_UnrecognizedFileFormat
IDS_MSG_ADDMODULE
IDS_MSG_ADDLINKREFERENCE
IDS_MSG_ADDREFERENCE
IDS_LogoLine1
IDS_LogoLine2
IDS_VBCHelp
IDS_InvalidPreprocessorConstantType
End Enum
End Namespace
......@@ -11469,6 +11469,33 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Preprocessor constant &apos;{0}&apos; of type &apos;{1}&apos; is not supported, only primitive types are allowed..
'''</summary>
Friend ReadOnly Property IDS_InvalidPreprocessorConstantType() As String
Get
Return ResourceManager.GetString("IDS_InvalidPreprocessorConstantType", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Microsoft (R) Visual Basic Compiler version {0}.
'''</summary>
Friend ReadOnly Property IDS_LogoLine1() As String
Get
Return ResourceManager.GetString("IDS_LogoLine1", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Copyright (C) Microsoft Corporation. All rights reserved..
'''</summary>
Friend ReadOnly Property IDS_LogoLine2() As String
Get
Return ResourceManager.GetString("IDS_LogoLine2", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Adding embedded assembly reference &apos;{0}&apos;.
'''</summary>
......@@ -11524,20 +11551,29 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Property
'''<summary>
''' Looks up a localized string similar to Skipping some types in analyzer assembly {0} due to a ReflectionTypeLoadException : {1}..
''' Looks up a localized string similar to Visual Basic Compiler Options
'''
''' - OUTPUT FILE -
'''/out:&lt;file&gt; Specifies the output file name.
'''/target:exe Create a console application (default).
''' (Short form: /t)
'''/target:winexe Create a Windows application.
'''/target:library Create a library assembly.
'''/target:module Create a module that can be added to an
''' [rest of string was truncated]&quot;;.
'''</summary>
Friend ReadOnly Property INF_UnableToLoadSomeTypesInAnalyzer() As String
Friend ReadOnly Property IDS_VBCHelp() As String
Get
Return ResourceManager.GetString("INF_UnableToLoadSomeTypesInAnalyzer", resourceCulture)
Return ResourceManager.GetString("IDS_VBCHelp", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Preprocessor constant &apos;{0}&apos; of type &apos;{1}&apos; is not supported, only primitive types are allowed..
''' Looks up a localized string similar to Skipping some types in analyzer assembly {0} due to a ReflectionTypeLoadException : {1}..
'''</summary>
Friend ReadOnly Property InvalidPreprocessorConstantType() As String
Friend ReadOnly Property INF_UnableToLoadSomeTypesInAnalyzer() As String
Get
Return ResourceManager.GetString("InvalidPreprocessorConstantType", resourceCulture)
Return ResourceManager.GetString("INF_UnableToLoadSomeTypesInAnalyzer", resourceCulture)
End Get
End Property
......@@ -11550,24 +11586,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Microsoft (R) Visual Basic Compiler version {0}.
'''</summary>
Friend ReadOnly Property LogoLine1() As String
Get
Return ResourceManager.GetString("LogoLine1", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Copyright (C) Microsoft Corporation. All rights reserved..
'''</summary>
Friend ReadOnly Property LogoLine2() As String
Get
Return ResourceManager.GetString("LogoLine2", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Node is not within syntax tree.
'''</summary>
......@@ -11775,24 +11793,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Visual Basic Compiler Options
'''
''' - OUTPUT FILE -
'''/out:&lt;file&gt; Specifies the output file name.
'''/target:exe Create a console application (default).
''' (Short form: /t)
'''/target:winexe Create a Windows application.
'''/target:library Create a library assembly.
'''/target:module Create a module that can be added to an
''' [rest of string was truncated]&quot;;.
'''</summary>
Friend ReadOnly Property VBCHelp() As String
Get
Return ResourceManager.GetString("VBCHelp", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Conversion from &apos;{0}&apos; to &apos;{1}&apos; may be ambiguous..
'''</summary>
......
......@@ -4481,13 +4481,13 @@
<data name="ChainingSpeculativeModelIsNotSupported" xml:space="preserve">
<value>Chaining speculative semantic model is not supported. You should create a speculative model from the non-speculative ParentModel.</value>
</data>
<data name="LogoLine1" xml:space="preserve">
<data name="IDS_LogoLine1" xml:space="preserve">
<value>Microsoft (R) Visual Basic Compiler version {0}</value>
</data>
<data name="LogoLine2" xml:space="preserve">
<data name="IDS_LogoLine2" xml:space="preserve">
<value>Copyright (C) Microsoft Corporation. All rights reserved.</value>
</data>
<data name="VBCHelp" xml:space="preserve">
<data name="IDS_VBCHelp" xml:space="preserve">
<value><![CDATA[ Visual Basic Compiler Options
- OUTPUT FILE -
......@@ -4663,7 +4663,7 @@
<data name="ERR_InvalidFormatSpecifier" xml:space="preserve">
<value>'{0}' is not a valid format specifier</value>
</data>
<data name="InvalidPreprocessorConstantType" xml:space="preserve">
<data name="IDS_InvalidPreprocessorConstantType" xml:space="preserve">
<value>Preprocessor constant '{0}' of type '{1}' is not supported, only primitive types are allowed.</value>
</data>
<data name="ERR_ExpectedWarningKeyword" xml:space="preserve">
......
......@@ -65,7 +65,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Dim constant = InternalSyntax.CConst.TryCreate(symbol.Value)
If constant Is Nothing Then
Throw New ArgumentException(String.Format(VBResources.InvalidPreprocessorConstantType, symbol.Key, symbol.Value.GetType()), parameterName)
Throw New ArgumentException(String.Format(VBResources.IDS_InvalidPreprocessorConstantType, symbol.Key, symbol.Value.GetType()), parameterName)
End If
Next
End Sub
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册