Localize using strongly typed resources:
generated Class with
strotygen -p -t Yavsc.Models.IT.Fixing.Bug.resx
must be modified :
* prefix with 'Yavsc.Server.Resources.' the baseName
in call to new System.Resources.ResourceManager
* remove the internal ctor
additionally, the generated class must be or unique or partial
This commit is contained in:
parent
b9a75b71b8
commit
9501ee1f16
13 changed files with 342 additions and 44 deletions
6
src/test/Mandatory/YavscMandatory.cs → src/test/Mandatory/BatchTests.cs
Executable file → Normal file
6
src/test/Mandatory/YavscMandatory.cs → src/test/Mandatory/BatchTests.cs
Executable file → Normal file
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNet.Builder.Internal;
|
||||
using Microsoft.AspNet.Razor;
|
||||
|
|
@ -29,13 +29,13 @@ namespace test
|
|||
|
||||
[Collection("Yavsc mandatory success story")]
|
||||
[Trait("regres", "no")]
|
||||
public class YavscMandatory: BaseTestContext, IClassFixture<ServerSideFixture>, IDisposable
|
||||
public class BatchTests: BaseTestContext, IClassFixture<ServerSideFixture>, IDisposable
|
||||
{
|
||||
|
||||
ApplicationDbContext _dbContext;
|
||||
ServerSideFixture _fixture;
|
||||
|
||||
public YavscMandatory(ITestOutputHelper output, ServerSideFixture fixture) : base (output, fixture)
|
||||
public BatchTests(ITestOutputHelper output, ServerSideFixture fixture) : base (output, fixture)
|
||||
{
|
||||
_dbContext = fixture.DbContext;
|
||||
_fixture = fixture;
|
||||
23
src/test/Mandatory/Resources.cs
Normal file
23
src/test/Mandatory/Resources.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
namespace test {
|
||||
public class ResxResources {
|
||||
const string resPath = "Resources/Test.TestResources.resx";
|
||||
|
||||
public void HaveAResxLoader()
|
||||
{
|
||||
System.Resources.ResourceReader loader = new System.Resources.ResourceReader(resPath);
|
||||
// IDictionary
|
||||
var etor = loader.GetEnumerator();
|
||||
while (etor.Current !=null)
|
||||
{
|
||||
byte[] data;
|
||||
string stringdata;
|
||||
string resName = etor.Key.ToString();
|
||||
|
||||
loader.GetResourceData(resName, out stringdata, out data);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
66
src/test/Resources/Test.TestResources.resx
Normal file
66
src/test/Resources/Test.TestResources.resx
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<!--
|
||||
route name for the api controller used to tag the 'BlogPost' entity
|
||||
-->
|
||||
<data name="ErrMessageTooLong"><value>Too Long ({MaxLen} at maximum, {ecart} in excess))</value></data>
|
||||
<data name="ErrMessageTooShort"><value>Too Short ({MinLen} at minus, {ecart} missing)</value></data>
|
||||
</root>
|
||||
Loading…
Add table
Add a link
Reference in a new issue