Author: lluis
Date: 2007-12-03 14:09:09 -0500 (Mon, 03 Dec 2007)
New Revision: 90580
Added:
trunk/mono-addins/Test/SystemInfoExtension/Resources.ca.resx
trunk/mono-addins/Test/SystemInfoExtension/Resources.resx
trunk/mono-addins/Test/UnitTests/TestLocalization.cs
Modified:
trunk/mono-addins/Test/ChangeLog
trunk/mono-addins/Test/CommandExtension/CommandExtensionNode.cs
trunk/mono-addins/Test/FileContentExtension/FileContentExtension.addin.xml
trunk/mono-addins/Test/FileContentExtension/FileContentExtensionNode.cs
trunk/mono-addins/Test/FileExtender/ExtraExtender.addin.xml
trunk/mono-addins/Test/HelloWorldExtension/HelloWorldWriter.cs
trunk/mono-addins/Test/SystemInfoExtension/Makefile.am
trunk/mono-addins/Test/SystemInfoExtension/ModuleExtensionNode.cs
trunk/mono-addins/Test/SystemInfoExtension/SystemInfoExtension.addin.xml
trunk/mono-addins/Test/SystemInfoExtension/SystemInfoExtension.mdp
trunk/mono-addins/Test/SystemInfoExtension/SystemInfoWriter.cs
trunk/mono-addins/Test/UnitTests/IWriter.cs
trunk/mono-addins/Test/UnitTests/Makefile.am
trunk/mono-addins/Test/UnitTests/TestBase.cs
trunk/mono-addins/Test/UnitTests/TestLoadUnload.cs
trunk/mono-addins/Test/UnitTests/UnitTests.mdp
Log:
* UnitTests/UnitTests.mdp, UnitTests/TestLoadUnload.cs,
UnitTests/IWriter.cs, UnitTests/TestLocalization.cs,
UnitTests/Makefile.am, UnitTests/TestBase.cs,
FileContentExtension/FileContentExtensionNode.cs,
FileContentExtension/FileContentExtension.addin.xml,
HelloWorldExtension/HelloWorldWriter.cs,
CommandExtension/CommandExtensionNode.cs,
SystemInfoExtension/SystemInfoWriter.cs,
SystemInfoExtension/Makefile.am,
SystemInfoExtension/SystemInfoExtension.addin.xml,
SystemInfoExtension/Resources.resx,
SystemInfoExtension/ModuleExtensionNode.cs,
SystemInfoExtension/SystemInfoExtension.mdp,
SystemInfoExtension/Resources.ca.resx,
FileExtender/ExtraExtender.addin.xml: Added localization tests.
Modified: trunk/mono-addins/Test/ChangeLog
===================================================================
--- trunk/mono-addins/Test/ChangeLog 2007-12-03 19:03:40 UTC (rev 90579)
+++ trunk/mono-addins/Test/ChangeLog 2007-12-03 19:09:09 UTC (rev 90580)
@@ -1,3 +1,21 @@
+2007-12-03 Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
+ * UnitTests/UnitTests.mdp, UnitTests/TestLoadUnload.cs,
+ UnitTests/IWriter.cs, UnitTests/TestLocalization.cs,
+ UnitTests/Makefile.am, UnitTests/TestBase.cs,
+ FileContentExtension/FileContentExtensionNode.cs,
+ FileContentExtension/FileContentExtension.addin.xml,
+ HelloWorldExtension/HelloWorldWriter.cs,
+ CommandExtension/CommandExtensionNode.cs,
+ SystemInfoExtension/SystemInfoWriter.cs,
+ SystemInfoExtension/Makefile.am,
+ SystemInfoExtension/SystemInfoExtension.addin.xml,
+ SystemInfoExtension/Resources.resx,
+ SystemInfoExtension/ModuleExtensionNode.cs,
+ SystemInfoExtension/SystemInfoExtension.mdp,
+ SystemInfoExtension/Resources.ca.resx,
+ FileExtender/ExtraExtender.addin.xml: Added localization tests.
+
2007-10-29 Lluis Sanchez Gual <[EMAIL PROTECTED]>
* CommandExtension/CommandExtension.mdp,
Modified: trunk/mono-addins/Test/CommandExtension/CommandExtensionNode.cs
===================================================================
--- trunk/mono-addins/Test/CommandExtension/CommandExtensionNode.cs
2007-12-03 19:03:40 UTC (rev 90579)
+++ trunk/mono-addins/Test/CommandExtension/CommandExtensionNode.cs
2007-12-03 19:09:09 UTC (rev 90580)
@@ -8,11 +8,11 @@
{
public class CommandExtensionNode: TypeExtensionNode, IWriter
{
- [NodeAttribute]
- string title;
+ [NodeAttribute (Localizable=true)]
+ protected string title;
[NodeAttribute]
- string command;
+ protected string command;
public override object CreateInstance ()
{
@@ -27,5 +27,15 @@
{
return "cmd:" + command;
}
+
+ public override string ToString ()
+ {
+ return title;
+ }
+
+ public string Test (string test)
+ {
+ return test;
+ }
}
}
Modified:
trunk/mono-addins/Test/FileContentExtension/FileContentExtension.addin.xml
===================================================================
--- trunk/mono-addins/Test/FileContentExtension/FileContentExtension.addin.xml
2007-12-03 19:03:40 UTC (rev 90579)
+++ trunk/mono-addins/Test/FileContentExtension/FileContentExtension.addin.xml
2007-12-03 19:09:09 UTC (rev 90580)
@@ -15,6 +15,8 @@
<Addin id="Core" version="0.1.0" />
</Dependencies>
+ <Localizer type="Gettext" />
+
<!-- Adds a new extension node type to the SimpleApp/Writers extension
point,
to be used by other add-ins. This node type can have children
nodes -->
<ExtensionPoint path = "/SimpleApp/Writers">
@@ -35,7 +37,7 @@
<!-- Extensions -->
<Extension path = "/SimpleApp/Writers">
- <FileContent id="SomeFile" fileName="someFile">
+ <FileContent id="SomeFile" fileName="someFile" title="Sample
file">
<Content xpath="root" />
</FileContent>
</Extension>
@@ -52,7 +54,7 @@
<Addin id="SystemInfoExtension" version="0.1.0" />
</Dependencies>
<Extension path = "/SystemInformation/Modules">
- <Module name="System information" />
+ <Module name="File system information"
insertbefore="System"/>
</Extension>
</Module>
</Addin>
Modified:
trunk/mono-addins/Test/FileContentExtension/FileContentExtensionNode.cs
===================================================================
--- trunk/mono-addins/Test/FileContentExtension/FileContentExtensionNode.cs
2007-12-03 19:03:40 UTC (rev 90579)
+++ trunk/mono-addins/Test/FileContentExtension/FileContentExtensionNode.cs
2007-12-03 19:09:09 UTC (rev 90580)
@@ -8,12 +8,19 @@
public class FileContentExtensionNode: TypeExtensionNode, IWriter
{
[NodeAttribute]
- string fileName;
+ protected string fileName;
+ [NodeAttribute (Localizable=true)]
+ protected string title;
+
public string FileName {
get { return fileName; }
}
+ public string Title {
+ get { return title; }
+ }
+
public override object CreateInstance ()
{
return this;
@@ -30,12 +37,22 @@
s += "[" + c + "]";
return s;
}
+
+ public override string ToString ()
+ {
+ return title;
+ }
+
+ public string Test (string test)
+ {
+ return test;
+ }
}
public class ContentExtensionNode: TypeExtensionNode
{
[NodeAttribute]
- string xpath;
+ protected string xpath;
public string XPath {
get { return xpath; }
Modified: trunk/mono-addins/Test/FileExtender/ExtraExtender.addin.xml
===================================================================
--- trunk/mono-addins/Test/FileExtender/ExtraExtender.addin.xml 2007-12-03
19:03:40 UTC (rev 90579)
+++ trunk/mono-addins/Test/FileExtender/ExtraExtender.addin.xml 2007-12-03
19:09:09 UTC (rev 90580)
@@ -8,6 +8,16 @@
<Addin id="FileContentExtension" version="0.1.0" />
<Addin id="SystemInfoExtension" version="0.1.0" />
</Dependencies>
+
+ <Localizer type="StringTable">
+ <Locale id="ca">
+ <Msg id="First sample file" str="Primer arxiu
d'exemple" />
+ <Msg id="Second sample file" str="Segon arxiu
d'exemple" />
+ </Locale>
+ <Locale id="ca-ES">
+ <Msg id="Third sample file" str="Tercer arxiu
d'exemple" />
+ </Locale>
+ </Localizer>
<!-- Extensions -->
@@ -20,6 +30,12 @@
</Condition>
</FileContent>
</Condition>
+
+ <Condition id="GlobalInfo" value="testTranslation">
+ <FileContent id="SomeFileTransTest1"
fileName="someFile1" title="First sample file"/>
+ <FileContent id="SomeFileTransTest2"
fileName="someFile2" title="Second sample file"/>
+ <FileContent id="SomeFileTransTest3"
fileName="someFile3" title="Third sample file"/>
+ </Condition>
</Extension>
</Addin>
Modified: trunk/mono-addins/Test/HelloWorldExtension/HelloWorldWriter.cs
===================================================================
--- trunk/mono-addins/Test/HelloWorldExtension/HelloWorldWriter.cs
2007-12-03 19:03:40 UTC (rev 90579)
+++ trunk/mono-addins/Test/HelloWorldExtension/HelloWorldWriter.cs
2007-12-03 19:09:09 UTC (rev 90580)
@@ -19,5 +19,14 @@
{
return "Hello world!";
}
+
+ public string Test (string test)
+ {
+ switch (test) {
+ case "currentAddin":
+ return AddinManager.CurrentAddin.ToString ();
+ }
+ return "Unknown test";
+ }
}
}
Modified: trunk/mono-addins/Test/SystemInfoExtension/Makefile.am
===================================================================
--- trunk/mono-addins/Test/SystemInfoExtension/Makefile.am 2007-12-03
19:03:40 UTC (rev 90579)
+++ trunk/mono-addins/Test/SystemInfoExtension/Makefile.am 2007-12-03
19:09:09 UTC (rev 90580)
@@ -9,17 +9,20 @@
if ENABLE_TESTS
-all: $(ASSEMBLY)
+all: $(ASSEMBLY) $(SATELLITE_ASSEMBLY)
endif
FILES = \
ModuleExtensionNode.cs \
MyClass.cs \
- SystemInfoWriter.cs
+ SystemInfoWriter.cs
DATA_FILES = SystemInfoExtension.addin.xml
-RESOURCES =
+RESOURCES =
+
+SATELLITE_ASSEMBLY = ../lib/ca/SystemInfoExtension.resources.dll
+MAIN_RESOURCE = Resources.resources
EXTRAS =
@@ -27,11 +30,26 @@
DLL_REFERENCES =
-$(ASSEMBLY) $(ASSEMBLY).mdb: $(build_sources) $(build_resources)
$(build_datafiles)
+$(ASSEMBLY) $(ASSEMBLY).mdb: $(build_sources) $(build_resources)
$(build_datafiles) $(MAIN_RESOURCE)
mkdir -p $(dir $(ASSEMBLY))
+ $(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$@
-target:$(COMPILE_TARGET) /res:$(MAIN_RESOURCE) $(build_sources)
$(build_resources_embed) $(build_references_ref)
- $(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$@
-target:$(COMPILE_TARGET) $(build_sources) $(build_resources_embed)
$(build_references_ref)
+$(MAIN_RESOURCE): Resources.resx
+ resgen /compile Resources.resx
+$(SATELLITE_ASSEMBLY): Resources.ca.resx
+ resgen /compile Resources.ca.resx
+ mkdir -p $(dir $(ASSEMBLY))/ca
+ al /t:lib /embed:Resources.ca.resources,Resources.ca.resources
/out:$(SATELLITE_ASSEMBLY) /culture:ca
+# Workaround to mono bug #345627 - Satellite resource assemblies not loaded
from the main assembly directory
+ mkdir -p ../UnitTests/bin/Debug/ca
+ cp $(SATELLITE_ASSEMBLY) ../UnitTests/bin/Debug/ca
+
if ENABLE_TESTS
+
include $(top_srcdir)/makefile-sample.include
+
+CLEANFILES += $(SATELLITE_ASSEMBLY) $(MAIN_RESOURCE)
+
endif
+
Modified: trunk/mono-addins/Test/SystemInfoExtension/ModuleExtensionNode.cs
===================================================================
--- trunk/mono-addins/Test/SystemInfoExtension/ModuleExtensionNode.cs
2007-12-03 19:03:40 UTC (rev 90579)
+++ trunk/mono-addins/Test/SystemInfoExtension/ModuleExtensionNode.cs
2007-12-03 19:09:09 UTC (rev 90580)
@@ -6,18 +6,30 @@
{
public class ModuleExtensionNode: ExtensionNode
{
- [NodeAttribute]
+ // Not using NodeAttribute here to avoid caching localized
strings
string name;
[NodeAttribute (Required=false)]
- string version;
+ protected string version;
public string Name {
- get { return name; }
+ get { return Addin.Localizer.GetString (name); }
}
public string Version {
get { return version; }
}
+
+ public override string ToString ()
+ {
+ return name;
+ }
+
+ protected override void Read (NodeElement elem)
+ {
+ base.Read (elem);
+ name = elem.GetAttribute ("name");
+ }
+
}
}
Added: trunk/mono-addins/Test/SystemInfoExtension/Resources.ca.resx
===================================================================
--- trunk/mono-addins/Test/SystemInfoExtension/Resources.ca.resx
2007-12-03 19:03:40 UTC (rev 90579)
+++ trunk/mono-addins/Test/SystemInfoExtension/Resources.ca.resx
2007-12-03 19:09:09 UTC (rev 90580)
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ 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
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader,
System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter,
System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a
comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1"
mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing"
mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <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
+ 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
+ mimetype set.
+
+ 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
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ 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
+ : 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
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="System information" xml:space="preserve">
+ <value>Informació del sistema</value>
+ </data>
+ <data name="Modules" xml:space="preserve">
+ <value>Mòduls</value>
+ </data>
+</root>
\ No newline at end of file
Added: trunk/mono-addins/Test/SystemInfoExtension/Resources.resx
===================================================================
--- trunk/mono-addins/Test/SystemInfoExtension/Resources.resx 2007-12-03
19:03:40 UTC (rev 90579)
+++ trunk/mono-addins/Test/SystemInfoExtension/Resources.resx 2007-12-03
19:09:09 UTC (rev 90580)
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ 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
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader,
System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter,
System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a
comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1"
mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing"
mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <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
+ 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
+ mimetype set.
+
+ 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
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ 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
+ : 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
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="System information" xml:space="preserve">
+ <value>System information</value>
+ </data>
+ <data name="Modules" xml:space="preserve">
+ <value>Modules</value>
+ </data>
+</root>
Modified:
trunk/mono-addins/Test/SystemInfoExtension/SystemInfoExtension.addin.xml
===================================================================
--- trunk/mono-addins/Test/SystemInfoExtension/SystemInfoExtension.addin.xml
2007-12-03 19:03:40 UTC (rev 90579)
+++ trunk/mono-addins/Test/SystemInfoExtension/SystemInfoExtension.addin.xml
2007-12-03 19:09:09 UTC (rev 90580)
@@ -16,6 +16,8 @@
<Addin id="CommandExtension" version="0.1.0" />
</Dependencies>
+ <Localizer type="StringResource" />
+
<ExtensionPoint path = "/SystemInformation/Modules" name = "Modules">
<Description>Module information providers.</Description>
<ExtensionNode name="Module"
type="SystemInfoExtension.ModuleExtensionNode"/>
@@ -120,7 +122,7 @@
</Extension>
<Extension path = "/SystemInformation/Modules">
- <Module name="System information" />
+ <Module name="System information" id="System"/>
</Extension>
<Extension path = "/SimpleApp/Writers2">
Modified: trunk/mono-addins/Test/SystemInfoExtension/SystemInfoExtension.mdp
===================================================================
--- trunk/mono-addins/Test/SystemInfoExtension/SystemInfoExtension.mdp
2007-12-03 19:03:40 UTC (rev 90579)
+++ trunk/mono-addins/Test/SystemInfoExtension/SystemInfoExtension.mdp
2007-12-03 19:09:09 UTC (rev 90580)
@@ -13,6 +13,8 @@
<File name="SystemInfoWriter.cs" subtype="Code" buildaction="Compile" />
<File name="ModuleExtensionNode.cs" subtype="Code" buildaction="Compile" />
<File name="Makefile.am" subtype="Code" buildaction="Nothing" />
+ <File name="Resources.ca.resx" subtype="Code"
buildaction="EmbedAsResource" />
+ <File name="Resources.resx" subtype="Code" buildaction="EmbedAsResource" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="System,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
Modified: trunk/mono-addins/Test/SystemInfoExtension/SystemInfoWriter.cs
===================================================================
--- trunk/mono-addins/Test/SystemInfoExtension/SystemInfoWriter.cs
2007-12-03 19:03:40 UTC (rev 90579)
+++ trunk/mono-addins/Test/SystemInfoExtension/SystemInfoWriter.cs
2007-12-03 19:09:09 UTC (rev 90580)
@@ -8,7 +8,7 @@
public class SystemInfoWriter: IWriter
{
public string Title {
- get { return "Modules"; }
+ get { return AddinManager.CurrentLocalizer.GetString
("Modules"); }
}
public string Write ()
@@ -18,5 +18,10 @@
s += " " + node.Name;
return s;
}
+
+ public string Test (string test)
+ {
+ return test;
+ }
}
}
Modified: trunk/mono-addins/Test/UnitTests/IWriter.cs
===================================================================
--- trunk/mono-addins/Test/UnitTests/IWriter.cs 2007-12-03 19:03:40 UTC (rev
90579)
+++ trunk/mono-addins/Test/UnitTests/IWriter.cs 2007-12-03 19:09:09 UTC (rev
90580)
@@ -10,5 +10,6 @@
{
string Title { get; }
string Write ();
+ string Test (string test);
}
}
Modified: trunk/mono-addins/Test/UnitTests/Makefile.am
===================================================================
--- trunk/mono-addins/Test/UnitTests/Makefile.am 2007-12-03 19:03:40 UTC
(rev 90579)
+++ trunk/mono-addins/Test/UnitTests/Makefile.am 2007-12-03 19:09:09 UTC
(rev 90580)
@@ -23,6 +23,7 @@
TestEvents.cs \
TestExtensions.cs \
TestLoadUnload.cs \
+ TestLocalization.cs \
TestSetup.cs
DATA_FILES = \
Modified: trunk/mono-addins/Test/UnitTests/TestBase.cs
===================================================================
--- trunk/mono-addins/Test/UnitTests/TestBase.cs 2007-12-03 19:03:40 UTC
(rev 90579)
+++ trunk/mono-addins/Test/UnitTests/TestBase.cs 2007-12-03 19:09:09 UTC
(rev 90580)
@@ -33,8 +33,8 @@
void OnLoadError (object s, AddinErrorEventArgs args)
{
- Console.WriteLine ("Add-in error: " + args.Message);
- Console.WriteLine (args.AddinId);
+ Console.WriteLine ("Add-in error (" + args.AddinId +
"): " + args.Message);
+ Console.WriteLine (args.Exception);
}
void OnLoad (object s, AddinEventArgs args)
Modified: trunk/mono-addins/Test/UnitTests/TestLoadUnload.cs
===================================================================
--- trunk/mono-addins/Test/UnitTests/TestLoadUnload.cs 2007-12-03 19:03:40 UTC
(rev 90579)
+++ trunk/mono-addins/Test/UnitTests/TestLoadUnload.cs 2007-12-03 19:09:09 UTC
(rev 90580)
@@ -3,6 +3,7 @@
using NUnit.Framework;
using Mono.Addins;
using System.IO;
+using SimpleApp;
namespace UnitTests
{
@@ -154,5 +155,17 @@
Assert.IsNotNull (ainfo, "t2");
Assert.IsTrue (ainfo.Enabled, "t2.1");
}
+
+ [Test()]
+ public void TestCurrentAddin ()
+ {
+ Assert.AreEqual ("SimpleApp.Core,0.1.0",
AddinManager.CurrentAddin.ToString ());
+
+ InstanceExtensionNode node = (InstanceExtensionNode)
AddinManager.GetExtensionNode
("/SimpleApp/Writers/HelloWorldExtension.HelloWorldWriter");
+ Assert.IsNotNull (node, "t1");
+
+ IWriter w = (IWriter) node.CreateInstance ();
+ Assert.AreEqual ("SimpleApp.HelloWorldExtension,0.1.0",
w.Test ("currentAddin"));
+ }
}
}
Added: trunk/mono-addins/Test/UnitTests/TestLocalization.cs
===================================================================
--- trunk/mono-addins/Test/UnitTests/TestLocalization.cs 2007-12-03
19:03:40 UTC (rev 90579)
+++ trunk/mono-addins/Test/UnitTests/TestLocalization.cs 2007-12-03
19:09:09 UTC (rev 90580)
@@ -0,0 +1,108 @@
+
+using System;
+using NUnit.Framework;
+using Mono.Addins;
+using System.IO;
+using System.Threading;
+using System.Globalization;
+using SimpleApp;
+
+namespace UnitTests
+{
+ [TestFixture()]
+ public class TestLocalization: TestBase
+ {
+ public override void Setup ()
+ {
+ base.Setup ();
+ }
+
+ [Test]
+ public void TestStringTable ()
+ {
+ GlobalInfoCondition.Value = "testTranslation";
+
+ ExtensionContext ctx;
+ ExtensionNode node;
+
+ // Use a new extension context for every check, since
strings are cached in
+ // the nodes, and every extension has its own copy of
the tree
+
+ Thread.CurrentThread.CurrentCulture = new CultureInfo
("en-US");
+ ctx = AddinManager.CreateExtensionContext ();
+ node = ctx.GetExtensionNode
("/SimpleApp/ExtraWriters/SomeFileTransTest1");
+ Assert.IsNotNull (node, "t1.1");
+ Assert.AreEqual ("First sample file", node.ToString ());
+ node = ctx.GetExtensionNode
("/SimpleApp/ExtraWriters/SomeFileTransTest2");
+ Assert.IsNotNull (node, "t1.2");
+ Assert.AreEqual ("Second sample file", node.ToString
());
+ node = ctx.GetExtensionNode
("/SimpleApp/ExtraWriters/SomeFileTransTest3");
+ Assert.IsNotNull (node, "t1.3");
+ Assert.AreEqual ("Third sample file", node.ToString ());
+
+ Thread.CurrentThread.CurrentCulture = new CultureInfo
("ca-ES");
+ ctx = AddinManager.CreateExtensionContext ();
+ node = ctx.GetExtensionNode
("/SimpleApp/ExtraWriters/SomeFileTransTest1");
+ Assert.IsNotNull (node, "t2.1");
+ Assert.AreEqual ("Primer arxiu d'exemple",
node.ToString ());
+ node = ctx.GetExtensionNode
("/SimpleApp/ExtraWriters/SomeFileTransTest2");
+ Assert.IsNotNull (node, "t2.2");
+ Assert.AreEqual ("Segon arxiu d'exemple", node.ToString
());
+ node = ctx.GetExtensionNode
("/SimpleApp/ExtraWriters/SomeFileTransTest3");
+ Assert.IsNotNull (node, "t2.3");
+ Assert.AreEqual ("Tercer arxiu d'exemple",
node.ToString ());
+ }
+
+ [Test]
+ public void TestStringResource ()
+ {
+ ExtensionContext ctx;
+ InstanceExtensionNode node;
+ IWriter w;
+
+ // Use a new extension context for every check, since
strings are cached in
+ // the nodes, and every extension has its own copy of
the tree
+
+ Thread.CurrentThread.CurrentCulture = new CultureInfo
("en-US");
+ ctx = AddinManager.CreateExtensionContext ();
+ node = ctx.GetExtensionNode
("/SimpleApp/Writers/SystemInfoExtension.SystemInfoWriter") as
InstanceExtensionNode;
+ Assert.IsNotNull (node, "t1");
+ w = (IWriter) node.CreateInstance ();
+ Assert.AreEqual ("System Info: File system information
System information", w.Write ());
+ Assert.AreEqual ("Modules", w.Title);
+
+ Thread.CurrentThread.CurrentCulture = new CultureInfo
("ca-ES");
+ ctx = AddinManager.CreateExtensionContext ();
+ node = ctx.GetExtensionNode
("/SimpleApp/Writers/SystemInfoExtension.SystemInfoWriter") as
InstanceExtensionNode;
+ Assert.IsNotNull (node, "t2");
+ w = (IWriter) node.CreateInstance ();
+ Assert.AreEqual ("System Info: File system information
Informació del sistema", w.Write ());
+ Assert.AreEqual ("Mòduls", w.Title);
+ }
+
+/* The locale can't be changed at run-time.
+
+ [Test]
+ public void TestStringGetText ()
+ {
+ ExtensionContext ctx;
+ ExtensionNode node;
+
+ // Use a new extension context for every check, since
strings are cached in
+ // the nodes, and every extension has its own copy of
the tree
+
+ Thread.CurrentThread.CurrentCulture = new CultureInfo
("en-US");
+ ctx = AddinManager.CreateExtensionContext ();
+ node = ctx.GetExtensionNode
("/SimpleApp/Writers/SomeFile");
+ Assert.IsNotNull (node, "t1.1");
+ Assert.AreEqual ("Sample file", node.ToString ());
+
+ Thread.CurrentThread.CurrentCulture = new CultureInfo
("ca-ES");
+ ctx = AddinManager.CreateExtensionContext ();
+ node = ctx.GetExtensionNode
("/SimpleApp/Writers/SomeFile");
+ Assert.IsNotNull (node, "t2.1");
+ Assert.AreEqual ("Arxiu d'exemple", node.ToString ());
+ }
+*/
+ }
+}
Modified: trunk/mono-addins/Test/UnitTests/UnitTests.mdp
===================================================================
--- trunk/mono-addins/Test/UnitTests/UnitTests.mdp 2007-12-03 19:03:40 UTC
(rev 90579)
+++ trunk/mono-addins/Test/UnitTests/UnitTests.mdp 2007-12-03 19:09:09 UTC
(rev 90580)
@@ -22,6 +22,7 @@
<File name="test.addins" subtype="Code" buildaction="FileCopy" />
<File name="Makefile.am" subtype="Code" buildaction="Nothing" />
<File name="IWriter.cs" subtype="Code" buildaction="Compile" />
+ <File name="TestLocalization.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="System,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
@@ -31,6 +32,7 @@
<ProjectReference type="Gac" localcopy="True" refto="nunit.framework,
Version=2.2.0.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" />
<ProjectReference type="Gac" localcopy="True" refto="nunit.util,
Version=2.2.0.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" />
</References>
+ <Deployment.LinuxDeployData scriptName="unittests" generatePcFile="False" />
<MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True"
RelativeMakefileName="./Makefile.am" BuildTargetName="" CleanTargetName=""
SyncReferences="True" RelativeConfigureInPath="../../">
<BuildFilesVar Sync="True" Name="FILES" />
<DeployFilesVar Sync="True" Name="DATA_FILES" />
@@ -40,5 +42,4 @@
<AsmRefVar Sync="True" Name="DLL_REFERENCES" />
<ProjectRefVar Sync="True" Name="PROJECT_REFERENCES" />
</MonoDevelop.Autotools.MakefileInfo>
- <Deployment.LinuxDeployData scriptName="unittests" generatePcFile="False" />
</Project>
\ No newline at end of file
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches