Skip to content

Commit 3fa042b

Browse files
authored
Merge pull request #73 from dellis1972/localise
Initial commit of localisation
2 parents 438aceb + 9dca4fb commit 3fa042b

27 files changed

+2486
-79
lines changed

.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
<Project DefaultTargets="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+
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" protocolVersion="3" />
56
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
67
<add key="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
using System;
2727
using System.IO;
2828
using System.Collections.Generic;
29+
using Xamarin.Tools.Zip.Properties;
2930

3031
namespace Xamarin.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
public EntryPermissions GetFilesystemPermissions (ZipArchive archive, string path)
9293
{
9394
if (String.IsNullOrEmpty (path))
94-
throw new ArgumentException ("must not be null or empty", nameof (path));
95+
throw new ArgumentException (string.Format (Resources.MustNotBeNullOrEmpty_string, nameof (path)), nameof (path));
9596

9697
EntryPermissions permissions = EntryPermissions.Default;
9798
if (!CallServices ((IPlatformServices services) => services.GetFilesystemPermissions (archive, path, out permissions)))
@@ -108,8 +109,8 @@ public void SetEntryPermissions (ZipArchive archive, ulong index, EntryPermissio
108109
public void SetEntryPermissions (ZipArchive archive, string sourcePath, ulong index, EntryPermissions permissions)
109110
{
110111
if (String.IsNullOrEmpty (sourcePath))
111-
throw new ArgumentException ("must not be null or empty", nameof (sourcePath));
112-
112+
throw new ArgumentException (string.Format (Resources.MustNotBeNullOrEmpty_string, nameof (sourcePath)), nameof (sourcePath));
113+
113114
CallServices ((IPlatformServices services) => 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
throw new ArgumentNullException (nameof (archive));
120121
if (String.IsNullOrEmpty (sourcePath))
121-
throw new ArgumentException ("must not be null or empty", nameof (sourcePath));
122+
throw new ArgumentException (string.Format (Resources.MustNotBeNullOrEmpty_string, nameof (sourcePath)), nameof (sourcePath));
122123

123124
long index = -1;
124125
CompressionMethod cm = CompressionMethod.Default;
@@ -132,15 +133,15 @@ public void ReadAndProcessExtraFields (ZipEntry entry)
132133
{
133134
if (entry == null)
134135
throw new ArgumentNullException (nameof (entry));
135-
136+
136137
CallServices ((IPlatformServices services) => services.ReadAndProcessExtraFields (entry));
137138
}
138139

139140
public bool WriteExtraFields (ZipArchive archive, ZipEntry entry, IList<ExtraField> extraFields = null)
140141
{
141142
if (entry == null)
142143
throw new ArgumentNullException (nameof (entry));
143-
144+
144145
return CallServices ((IPlatformServices services) => 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
throw new ArgumentNullException (nameof (entry));
151152
if (String.IsNullOrEmpty (extractedFilePath))
152-
throw new ArgumentException ("must not be null or empty", nameof (extractedFilePath));
153+
throw new ArgumentException (string.Format (Resources.MustNotBeNullOrEmpty_string, nameof (extractedFilePath)), nameof (extractedFilePath));
153154

154155
CallServices ((IPlatformServices services) => services.SetFileProperties (entry, extractedFilePath, throwOnNativeExceptions));
155156
}
@@ -158,7 +159,7 @@ bool CallServices (Func<IPlatformServices, bool> code)
158159
{
159160
if (code == null)
160161
return false;
161-
162+
162163
foreach (IPlatformServices services in serviceRegistry) {
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:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63+
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64+
<xsd:element name="root" msdata:IsDataSet="true">
65+
<xsd:complexType>
66+
<xsd:choice maxOccurs="unbounded">
67+
<xsd:element name="metadata">
68+
<xsd:complexType>
69+
<xsd:sequence>
70+
<xsd:element name="value" type="xsd:string" minOccurs="0" />
71+
</xsd:sequence>
72+
<xsd:attribute name="name" use="required" type="xsd:string" />
73+
<xsd:attribute name="type" type="xsd:string" />
74+
<xsd:attribute name="mimetype" type="xsd:string" />
75+
<xsd:attribute ref="xml:space" />
76+
</xsd:complexType>
77+
</xsd:element>
78+
<xsd:element name="assembly">
79+
<xsd:complexType>
80+
<xsd:attribute name="alias" type="xsd:string" />
81+
<xsd:attribute name="name" type="xsd:string" />
82+
</xsd:complexType>
83+
</xsd:element>
84+
<xsd:element name="data">
85+
<xsd:complexType>
86+
<xsd:sequence>
87+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89+
</xsd:sequence>
90+
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93+
<xsd:attribute ref="xml:space" />
94+
</xsd:complexType>
95+
</xsd:element>
96+
<xsd:element name="resheader">
97+
<xsd:complexType>
98+
<xsd:sequence>
99+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100+
</xsd:sequence>
101+
<xsd:attribute name="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+
<resheader name="resmimetype">
109+
<value>text/microsoft-resx</value>
110+
</resheader>
111+
<resheader name="version">
112+
<value>2.0</value>
113+
</resheader>
114+
<resheader name="reader">
115+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116+
</resheader>
117+
<resheader name="writer">
118+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119+
</resheader>
120+
<data name="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+
<data name="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+
<data name="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+
<data name="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+
<data name="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+
<data name="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+
<data name="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+
<data name="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+
<data name="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+
<data name="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+
<data name="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+
<data name="FileAlreadyExists" xml:space="preserve">
176+
<value>The file already exists.</value>
177+
</data>
178+
<data name="FilePathAlreadyExists_file" xml:space="preserve">
179+
<value>File '{0}' already exists.</value>
180+
<comment>{0} - A filename.</comment>
181+
</data>
182+
<data name="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+
<data name="StreamFailedConsistencyChecks" xml:space="preserve">
187+
<value>The stream failed consistency checks.</value>
188+
</data>
189+
<data name="StreamDoesNotExist" xml:space="preserve">
190+
<value>Stream does not exist and file creation wasn't requested.</value>
191+
</data>
192+
<data name="StreamIsNotAZip" xml:space="preserve">
193+
<value>Stream is not a ZIP archive.</value>
194+
</data>
195+
<data name="StreamCouldNotBeOpened" xml:space="preserve">
196+
<value>Stream could not be opened.</value>
197+
</data>
198+
<data name="ErrorReadingStream" xml:space="preserve">
199+
<value>An error occured while reading the stream.</value>
200+
</data>
201+
<data name="StreamDoesNotSupportSeeking" xml:space="preserve">
202+
<value>The stream does not support seeking.</value>
203+
</data>
204+
<data name="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+
<data name="FileFailedConsistencyChecks_file" xml:space="preserve">
210+
<value>The file {0} failed consistency checks.</value>
211+
<comment>{0} - A filename.</comment>
212+
</data>
213+
<data name="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+
<data name="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+
<data name="FileCouldNotBeOpened_file" xml:space="preserve">
222+
<value>The file '{0}' could not be opened.</value>
223+
<comment>{0} - A filename.</comment>
224+
</data>
225+
<data name="ErrorReadingFile_file" xml:space="preserve">
226+
<value>Error occured while reading the file '{0}'.</value>
227+
<comment>{0} - A filename.</comment>
228+
</data>
229+
<data name="FileDoesNotSupportSeeking_file" xml:space="preserve">
230+
<value>The file '{0}' does not support seeking.</value>
231+
<comment>{0} - A filename.</comment>
232+
</data>
233+
<data name="DestinationMustNotBeEmpty" xml:space="preserve">
234+
<value>Archive destination path must not be empty.</value>
235+
</data>
236+
<data name="UnknownError" xml:space="preserve">
237+
<value>Unknown error.</value>
238+
</data>
239+
</root>

0 commit comments

Comments
 (0)