Skip to content

Commit 9dca4fb

Browse files
committed
Initial commit of localisation
1 parent 8f2053c commit 9dca4fb

27 files changed

Lines changed: 2486 additions & 79 deletions

‎.vscode/tasks.json‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@
1515
"$msCompile"
1616
]
1717
},
18+
{
19+
"label": "Regenerate LibZipSharp Localisations",
20+
"type": "shell",
21+
"command": "msbuild LibZipSharp.csproj /restore /t:UpdateXlf",
22+
"group": {
23+
"kind": "build",
24+
"isDefault": true
25+
},
26+
"problemMatcher": [
27+
"$msCompile"
28+
]
29+
},
1830
{
1931
"label": "Pack LibZipSharp Nuget",
2032
"type": "shell",

‎LibZipSharp.props‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<ProjectDefaultTargets="Build"ToolsVersion="4.0"xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22
<PropertyGroup>
3-
<_LibZipSharpNugetVersion>1.0.21-rc</_LibZipSharpNugetVersion>
3+
<_LibZipSharpNugetVersion>1.0.21</_LibZipSharpNugetVersion>
44
</PropertyGroup>
55
</Project>

‎NuGet.Config‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<configuration>
33
<packageSources>
44
<clear />
5+
<addkey="dotnet-eng"value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json"protocolVersion="3" />
56
<addkey="nuget.org"value="https://api.nuget.org/v3/index.json" />
67
<addkey="build"value="." />
78
</packageSources>

‎PlatformServices.cs‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
usingSystem;
2727
usingSystem.IO;
2828
usingSystem.Collections.Generic;
29+
usingXamarin.Tools.Zip.Properties;
2930

3031
namespaceXamarin.Tools.Zip
3132
{
@@ -48,7 +49,7 @@ public static void RegisterServices (IPlatformServices services)
4849
{
4950
if(services==null)
5051
return;
51-
52+
5253
if(serviceRegistry.Contains(services))
5354
return;
5455
serviceRegistry.Add(services);
@@ -58,7 +59,7 @@ public static void UnregisterServices (IPlatformServices services)
5859
{
5960
if(services==null)
6061
return;
61-
62+
6263
if(serviceRegistry.Count==0||!serviceRegistry.Contains(services))
6364
return;
6465
serviceRegistry.Remove(services);
@@ -91,7 +92,7 @@ public bool IsRegularFile (ZipArchive archive, string path)
9192
publicEntryPermissionsGetFilesystemPermissions(ZipArchivearchive,stringpath)
9293
{
9394
if(String.IsNullOrEmpty(path))
94-
thrownewArgumentException("must not be null or empty",nameof(path));
95+
thrownewArgumentException(string.Format(Resources.MustNotBeNullOrEmpty_string,nameof(path)),nameof(path));
9596

9697
EntryPermissionspermissions=EntryPermissions.Default;
9798
if(!CallServices((IPlatformServicesservices)=>services.GetFilesystemPermissions(archive,path,outpermissions)))
@@ -108,8 +109,8 @@ public void SetEntryPermissions (ZipArchive archive, ulong index, EntryPermissio
108109
publicvoidSetEntryPermissions(ZipArchivearchive,stringsourcePath,ulongindex,EntryPermissionspermissions)
109110
{
110111
if(String.IsNullOrEmpty(sourcePath))
111-
thrownewArgumentException("must not be null or empty",nameof(sourcePath));
112-
112+
thrownewArgumentException(string.Format(Resources.MustNotBeNullOrEmpty_string,nameof(sourcePath)),nameof(sourcePath));
113+
113114
CallServices((IPlatformServicesservices)=>services.SetEntryPermissions(archive,sourcePath,index,permissions));
114115
}
115116

@@ -118,7 +119,7 @@ public long StoreSpecialFile (ZipArchive archive, string sourcePath, string arch
118119
if(archive==null)
119120
thrownewArgumentNullException(nameof(archive));
120121
if(String.IsNullOrEmpty(sourcePath))
121-
thrownewArgumentException("must not be null or empty",nameof(sourcePath));
122+
thrownewArgumentException(string.Format(Resources.MustNotBeNullOrEmpty_string,nameof(sourcePath)),nameof(sourcePath));
122123

123124
longindex=-1;
124125
CompressionMethodcm=CompressionMethod.Default;
@@ -132,15 +133,15 @@ public void ReadAndProcessExtraFields (ZipEntry entry)
132133
{
133134
if(entry==null)
134135
thrownewArgumentNullException(nameof(entry));
135-
136+
136137
CallServices((IPlatformServicesservices)=>services.ReadAndProcessExtraFields(entry));
137138
}
138139

139140
publicboolWriteExtraFields(ZipArchivearchive,ZipEntryentry,IList<ExtraField>extraFields=null)
140141
{
141142
if(entry==null)
142143
thrownewArgumentNullException(nameof(entry));
143-
144+
144145
returnCallServices((IPlatformServicesservices)=>services.WriteExtraFields(archive,entry,extraFields));
145146
}
146147

@@ -149,7 +150,7 @@ public void SetFileProperties (ZipEntry entry, string extractedFilePath, bool th
149150
if(entry==null)
150151
thrownewArgumentNullException(nameof(entry));
151152
if(String.IsNullOrEmpty(extractedFilePath))
152-
thrownewArgumentException("must not be null or empty",nameof(extractedFilePath));
153+
thrownewArgumentException(string.Format(Resources.MustNotBeNullOrEmpty_string,nameof(extractedFilePath)),nameof(extractedFilePath));
153154

154155
CallServices((IPlatformServicesservices)=>services.SetFileProperties(entry,extractedFilePath,throwOnNativeExceptions));
155156
}
@@ -158,7 +159,7 @@ bool CallServices (Func<IPlatformServices, bool> code)
158159
{
159160
if(code==null)
160161
returnfalse;
161-
162+
162163
foreach(IPlatformServicesservicesinserviceRegistry){
163164
if(services==null)
164165
continue;

‎Properties/Resources.resx‎

Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<root>
3+
<!--
4+
Microsoft ResX Schema
5+
6+
Version 2.0
7+
8+
The primary goals of this format is to allow a simple XML format
9+
that is mostly human readable. The generation and parsing of the
10+
various data types are done through the TypeConverter classes
11+
associated with the data types.
12+
13+
Example:
14+
15+
... ado.net/XML headers & schema ...
16+
<resheader name="resmimetype">text/microsoft-resx</resheader>
17+
<resheader name="version">2.0</resheader>
18+
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19+
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20+
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21+
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22+
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23+
<value>[base64 mime encoded serialized .NET Framework object]</value>
24+
</data>
25+
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26+
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27+
<comment>This is a comment</comment>
28+
</data>
29+
30+
There are any number of "resheader" rows that contain simple
31+
name/value pairs.
32+
33+
Each data row contains a name, and value. The row also contains a
34+
type or mimetype. Type corresponds to a .NET class that support
35+
text/value conversion through the TypeConverter architecture.
36+
Classes that don't support this are serialized and stored with the
37+
mimetype set.
38+
39+
The mimetype is used for serialized objects, and tells the
40+
ResXResourceReader how to depersist the object. This is currently not
41+
extensible. For a given mimetype the value must be set accordingly:
42+
43+
Note - application/x-microsoft.net.object.binary.base64 is the format
44+
that the ResXResourceWriter will generate, however the reader can
45+
read any of the formats listed below.
46+
47+
mimetype: application/x-microsoft.net.object.binary.base64
48+
value : The object must be serialized with
49+
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50+
: and then encoded with base64 encoding.
51+
52+
mimetype: application/x-microsoft.net.object.soap.base64
53+
value : The object must be serialized with
54+
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55+
: and then encoded with base64 encoding.
56+
57+
mimetype: application/x-microsoft.net.object.bytearray.base64
58+
value : The object must be serialized into a byte array
59+
: using a System.ComponentModel.TypeConverter
60+
: and then encoded with base64 encoding.
61+
-->
62+
<xsd:schemaid="root"xmlns=""xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63+
<xsd:importnamespace="http://www.w3.org/XML/1998/namespace" />
64+
<xsd:elementname="root"msdata:IsDataSet="true">
65+
<xsd:complexType>
66+
<xsd:choicemaxOccurs="unbounded">
67+
<xsd:elementname="metadata">
68+
<xsd:complexType>
69+
<xsd:sequence>
70+
<xsd:elementname="value"type="xsd:string"minOccurs="0" />
71+
</xsd:sequence>
72+
<xsd:attributename="name"use="required"type="xsd:string" />
73+
<xsd:attributename="type"type="xsd:string" />
74+
<xsd:attributename="mimetype"type="xsd:string" />
75+
<xsd:attributeref="xml:space" />
76+
</xsd:complexType>
77+
</xsd:element>
78+
<xsd:elementname="assembly">
79+
<xsd:complexType>
80+
<xsd:attributename="alias"type="xsd:string" />
81+
<xsd:attributename="name"type="xsd:string" />
82+
</xsd:complexType>
83+
</xsd:element>
84+
<xsd:elementname="data">
85+
<xsd:complexType>
86+
<xsd:sequence>
87+
<xsd:elementname="value"type="xsd:string"minOccurs="0"msdata:Ordinal="1" />
88+
<xsd:elementname="comment"type="xsd:string"minOccurs="0"msdata:Ordinal="2" />
89+
</xsd:sequence>
90+
<xsd:attributename="name"type="xsd:string"use="required"msdata:Ordinal="1" />
91+
<xsd:attributename="type"type="xsd:string"msdata:Ordinal="3" />
92+
<xsd:attributename="mimetype"type="xsd:string"msdata:Ordinal="4" />
93+
<xsd:attributeref="xml:space" />
94+
</xsd:complexType>
95+
</xsd:element>
96+
<xsd:elementname="resheader">
97+
<xsd:complexType>
98+
<xsd:sequence>
99+
<xsd:elementname="value"type="xsd:string"minOccurs="0"msdata:Ordinal="1" />
100+
</xsd:sequence>
101+
<xsd:attributename="name"type="xsd:string"use="required" />
102+
</xsd:complexType>
103+
</xsd:element>
104+
</xsd:choice>
105+
</xsd:complexType>
106+
</xsd:element>
107+
</xsd:schema>
108+
<resheadername="resmimetype">
109+
<value>text/microsoft-resx</value>
110+
</resheader>
111+
<resheadername="version">
112+
<value>2.0</value>
113+
</resheader>
114+
<resheadername="reader">
115+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116+
</resheader>
117+
<resheadername="writer">
118+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119+
</resheader>
120+
<dataname="MustNotBeNullOrEmpty_string"xml:space="preserve">
121+
<value>'{0}' must not be null or empty.</value>
122+
<comment>{0} - The name of the parameter</comment>
123+
</data>
124+
<dataname="InvalidEntryType_string_type"xml:space="preserve">
125+
<value>'{0}' is an instance of '{1}', which is not a valid entry type. The expected type is '{2}'.</value>
126+
<comment>{0} - The name of the parameter.
127+
{1} - The expected type of the parameter.
128+
{2} - The actual type of the parameter.</comment>
129+
</data>
130+
<dataname="UnsupportedPermission_UnixExternalPermissions"xml:space="preserve">
131+
<value>'{0}' is not a supported file type. Only regular files, directories, and symbolic links are currently supported.</value>
132+
<comment>{0} - The name of the permission.</comment>
133+
</data>
134+
<dataname="MustBeAnInstanceOf_string_type"xml:space="preserve">
135+
<value>'{0}' must be an instance of '{1}'.</value>
136+
<comment>{0} - The name of the parameter.
137+
{1} - The type the parameter should be.</comment>
138+
</data>
139+
<dataname="ExpectedAnInstanceOf_string_type"xml:space="preserve">
140+
<value>{0}' is an instance of '{1}' instead of the expected type '{2}'.</value>
141+
<comment>{0} - The expected type of the parameter.
142+
{1} - The name of the parameter.
143+
{2} - The actual type of the parameter.</comment>
144+
</data>
145+
<dataname="UnableToDetermineFileType_file"xml:space="preserve">
146+
<value>Failed to determine type of the file '{0}'.</value>
147+
<comment>{0} - A filename</comment>
148+
</data>
149+
<dataname="FailedToReadSymLink_link_error"xml:space="preserve">
150+
<value>Could not read the symbolic link '{0}': {1}.</value>
151+
<comment>{0} - The symbolic link that was being read.
152+
{1} - The actual error message reported by the operating system.</comment>
153+
</data>
154+
<dataname="FileTypeNotSupported_filetype"xml:space="preserve">
155+
<value>Storing files of type '{0}' is not supported.</value>
156+
<comment>{0} - The type of the file.</comment>
157+
</data>
158+
<dataname="FailedToSetOwner_entry_error_oserror"xml:space="preserve">
159+
<value>Warning: failed to set owner of entry '{0}' ({1}:{2}).</value>
160+
<comment>{0} - A filename.
161+
{1} - The error message.
162+
{2} - The operating system error.</comment>
163+
</data>
164+
<dataname="FailedToStatFile_file_error"xml:space="preserve">
165+
<value>Warning: failed to stat file '{0}': {1}.</value>
166+
<comment>{0} - A filename.
167+
{1} - The error message.</comment>
168+
</data>
169+
<dataname="UnexpectedOptionsType_string_type_type"xml:space="preserve">
170+
<value>'{0}' is an instance of '{1}', which is not a valid options type. The expected type is '{2}'.</value>
171+
<comment>{0} - The parameter name.
172+
{1} - The expected type of the parameter.
173+
{2} - The actual type of the parameter.</comment>
174+
</data>
175+
<dataname="FileAlreadyExists"xml:space="preserve">
176+
<value>The file already exists.</value>
177+
</data>
178+
<dataname="FilePathAlreadyExists_file"xml:space="preserve">
179+
<value>File '{0}' already exists.</value>
180+
<comment>{0} - A filename.</comment>
181+
</data>
182+
<dataname="OutOfMemory"xml:space="preserve">
183+
<value>libzip failed due to an out of memory error.</value>
184+
<comment>The following terms should not be translated: libzip</comment>
185+
</data>
186+
<dataname="StreamFailedConsistencyChecks"xml:space="preserve">
187+
<value>The stream failed consistency checks.</value>
188+
</data>
189+
<dataname="StreamDoesNotExist"xml:space="preserve">
190+
<value>Stream does not exist and file creation wasn't requested.</value>
191+
</data>
192+
<dataname="StreamIsNotAZip"xml:space="preserve">
193+
<value>Stream is not a ZIP archive.</value>
194+
</data>
195+
<dataname="StreamCouldNotBeOpened"xml:space="preserve">
196+
<value>Stream could not be opened.</value>
197+
</data>
198+
<dataname="ErrorReadingStream"xml:space="preserve">
199+
<value>An error occured while reading the stream.</value>
200+
</data>
201+
<dataname="StreamDoesNotSupportSeeking"xml:space="preserve">
202+
<value>The stream does not support seeking.</value>
203+
</data>
204+
<dataname="UnexpectedLibZipError_error"xml:space="preserve">
205+
<value>Unexpected libzip error: {0}.</value>
206+
<comment>The following is the name of a library and should not be translated: libzip
207+
{0} - An error message from libzip.</comment>
208+
</data>
209+
<dataname="FileFailedConsistencyChecks_file"xml:space="preserve">
210+
<value>The file {0} failed consistency checks.</value>
211+
<comment>{0} - A filename.</comment>
212+
</data>
213+
<dataname="FileDoesNotExist_file"xml:space="preserve">
214+
<value>The file '{0}' does not exist and file creation wasn't requested.</value>
215+
<comment>{0} - A filename.</comment>
216+
</data>
217+
<dataname="FileIsNotAZip_file"xml:space="preserve">
218+
<value>The file '{0}' is not a ZIP archive.</value>
219+
<comment>{0} - A filename.</comment>
220+
</data>
221+
<dataname="FileCouldNotBeOpened_file"xml:space="preserve">
222+
<value>The file '{0}' could not be opened.</value>
223+
<comment>{0} - A filename.</comment>
224+
</data>
225+
<dataname="ErrorReadingFile_file"xml:space="preserve">
226+
<value>Error occured while reading the file '{0}'.</value>
227+
<comment>{0} - A filename.</comment>
228+
</data>
229+
<dataname="FileDoesNotSupportSeeking_file"xml:space="preserve">
230+
<value>The file '{0}' does not support seeking.</value>
231+
<comment>{0} - A filename.</comment>
232+
</data>
233+
<dataname="DestinationMustNotBeEmpty"xml:space="preserve">
234+
<value>Archive destination path must not be empty.</value>
235+
</data>
236+
<dataname="UnknownError"xml:space="preserve">
237+
<value>Unknown error.</value>
238+
</data>
239+
</root>

0 commit comments

Comments
 (0)