Skip to content

Commit

Permalink
Initial commit of localisation
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis1972 committed Jan 6, 2021
1 parent 8f2053c commit 9dca4fb
Show file tree
Hide file tree
Showing 27 changed files with 2,486 additions and 79 deletions.
12 changes: 12 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@
"$msCompile"
]
},
{
"label": "Regenerate LibZipSharp Localisations",
"type": "shell",
"command": "msbuild LibZipSharp.csproj /restore /t:UpdateXlf",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$msCompile"
]
},
{
"label": "Pack LibZipSharp Nuget",
"type": "shell",
Expand Down
2 changes: 1 addition & 1 deletion LibZipSharp.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_LibZipSharpNugetVersion>1.0.21-rc</_LibZipSharpNugetVersion>
<_LibZipSharpNugetVersion>1.0.21</_LibZipSharpNugetVersion>
</PropertyGroup>
</Project>
1 change: 1 addition & 0 deletions NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<configuration>
<packageSources>
<clear />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" protocolVersion="3" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="build" value="." />
</packageSources>
Expand Down
21 changes: 11 additions & 10 deletions PlatformServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
using System;
using System.IO;
using System.Collections.Generic;
using Xamarin.Tools.Zip.Properties;

namespace Xamarin.Tools.Zip
{
Expand All @@ -48,7 +49,7 @@ public static void RegisterServices (IPlatformServices services)
{
if (services == null)
return;

if (serviceRegistry.Contains (services))
return;
serviceRegistry.Add (services);
Expand All @@ -58,7 +59,7 @@ public static void UnregisterServices (IPlatformServices services)
{
if (services == null)
return;

if (serviceRegistry.Count == 0 || !serviceRegistry.Contains (services))
return;
serviceRegistry.Remove (services);
Expand Down Expand Up @@ -91,7 +92,7 @@ public bool IsRegularFile (ZipArchive archive, string path)
public EntryPermissions GetFilesystemPermissions (ZipArchive archive, string path)
{
if (String.IsNullOrEmpty (path))
throw new ArgumentException ("must not be null or empty", nameof (path));
throw new ArgumentException (string.Format (Resources.MustNotBeNullOrEmpty_string, nameof (path)), nameof (path));

EntryPermissions permissions = EntryPermissions.Default;
if (!CallServices ((IPlatformServices services) => services.GetFilesystemPermissions (archive, path, out permissions)))
Expand All @@ -108,8 +109,8 @@ public void SetEntryPermissions (ZipArchive archive, ulong index, EntryPermissio
public void SetEntryPermissions (ZipArchive archive, string sourcePath, ulong index, EntryPermissions permissions)
{
if (String.IsNullOrEmpty (sourcePath))
throw new ArgumentException ("must not be null or empty", nameof (sourcePath));
throw new ArgumentException (string.Format (Resources.MustNotBeNullOrEmpty_string, nameof (sourcePath)), nameof (sourcePath));

CallServices ((IPlatformServices services) => services.SetEntryPermissions (archive, sourcePath, index, permissions));
}

Expand All @@ -118,7 +119,7 @@ public long StoreSpecialFile (ZipArchive archive, string sourcePath, string arch
if (archive == null)
throw new ArgumentNullException (nameof (archive));
if (String.IsNullOrEmpty (sourcePath))
throw new ArgumentException ("must not be null or empty", nameof (sourcePath));
throw new ArgumentException (string.Format (Resources.MustNotBeNullOrEmpty_string, nameof (sourcePath)), nameof (sourcePath));

long index = -1;
CompressionMethod cm = CompressionMethod.Default;
Expand All @@ -132,15 +133,15 @@ public void ReadAndProcessExtraFields (ZipEntry entry)
{
if (entry == null)
throw new ArgumentNullException (nameof (entry));

CallServices ((IPlatformServices services) => services.ReadAndProcessExtraFields (entry));
}

public bool WriteExtraFields (ZipArchive archive, ZipEntry entry, IList<ExtraField> extraFields = null)
{
if (entry == null)
throw new ArgumentNullException (nameof (entry));

return CallServices ((IPlatformServices services) => services.WriteExtraFields (archive, entry, extraFields));
}

Expand All @@ -149,7 +150,7 @@ public void SetFileProperties (ZipEntry entry, string extractedFilePath, bool th
if (entry == null)
throw new ArgumentNullException (nameof (entry));
if (String.IsNullOrEmpty (extractedFilePath))
throw new ArgumentException ("must not be null or empty", nameof (extractedFilePath));
throw new ArgumentException (string.Format (Resources.MustNotBeNullOrEmpty_string, nameof (extractedFilePath)), nameof (extractedFilePath));

CallServices ((IPlatformServices services) => services.SetFileProperties (entry, extractedFilePath, throwOnNativeExceptions));
}
Expand All @@ -158,7 +159,7 @@ bool CallServices (Func<IPlatformServices, bool> code)
{
if (code == null)
return false;

foreach (IPlatformServices services in serviceRegistry) {
if (services == null)
continue;
Expand Down
239 changes: 239 additions & 0 deletions Properties/Resources.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
<?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=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>
<data name="MustNotBeNullOrEmpty_string" xml:space="preserve">
<value>'{0}' must not be null or empty.</value>
<comment>{0} - The name of the parameter</comment>
</data>
<data name="InvalidEntryType_string_type" xml:space="preserve">
<value>'{0}' is an instance of '{1}', which is not a valid entry type. The expected type is '{2}'.</value>
<comment>{0} - The name of the parameter.
{1} - The expected type of the parameter.
{2} - The actual type of the parameter.</comment>
</data>
<data name="UnsupportedPermission_UnixExternalPermissions" xml:space="preserve">
<value>'{0}' is not a supported file type. Only regular files, directories, and symbolic links are currently supported.</value>
<comment>{0} - The name of the permission.</comment>
</data>
<data name="MustBeAnInstanceOf_string_type" xml:space="preserve">
<value>'{0}' must be an instance of '{1}'.</value>
<comment>{0} - The name of the parameter.
{1} - The type the parameter should be.</comment>
</data>
<data name="ExpectedAnInstanceOf_string_type" xml:space="preserve">
<value>{0}' is an instance of '{1}' instead of the expected type '{2}'.</value>
<comment>{0} - The expected type of the parameter.
{1} - The name of the parameter.
{2} - The actual type of the parameter.</comment>
</data>
<data name="UnableToDetermineFileType_file" xml:space="preserve">
<value>Failed to determine type of the file '{0}'.</value>
<comment>{0} - A filename</comment>
</data>
<data name="FailedToReadSymLink_link_error" xml:space="preserve">
<value>Could not read the symbolic link '{0}': {1}.</value>
<comment>{0} - The symbolic link that was being read.
{1} - The actual error message reported by the operating system.</comment>
</data>
<data name="FileTypeNotSupported_filetype" xml:space="preserve">
<value>Storing files of type '{0}' is not supported.</value>
<comment>{0} - The type of the file.</comment>
</data>
<data name="FailedToSetOwner_entry_error_oserror" xml:space="preserve">
<value>Warning: failed to set owner of entry '{0}' ({1}:{2}).</value>
<comment>{0} - A filename.
{1} - The error message.
{2} - The operating system error.</comment>
</data>
<data name="FailedToStatFile_file_error" xml:space="preserve">
<value>Warning: failed to stat file '{0}': {1}.</value>
<comment>{0} - A filename.
{1} - The error message.</comment>
</data>
<data name="UnexpectedOptionsType_string_type_type" xml:space="preserve">
<value>'{0}' is an instance of '{1}', which is not a valid options type. The expected type is '{2}'.</value>
<comment>{0} - The parameter name.
{1} - The expected type of the parameter.
{2} - The actual type of the parameter.</comment>
</data>
<data name="FileAlreadyExists" xml:space="preserve">
<value>The file already exists.</value>
</data>
<data name="FilePathAlreadyExists_file" xml:space="preserve">
<value>File '{0}' already exists.</value>
<comment>{0} - A filename.</comment>
</data>
<data name="OutOfMemory" xml:space="preserve">
<value>libzip failed due to an out of memory error.</value>
<comment>The following terms should not be translated: libzip</comment>
</data>
<data name="StreamFailedConsistencyChecks" xml:space="preserve">
<value>The stream failed consistency checks.</value>
</data>
<data name="StreamDoesNotExist" xml:space="preserve">
<value>Stream does not exist and file creation wasn't requested.</value>
</data>
<data name="StreamIsNotAZip" xml:space="preserve">
<value>Stream is not a ZIP archive.</value>
</data>
<data name="StreamCouldNotBeOpened" xml:space="preserve">
<value>Stream could not be opened.</value>
</data>
<data name="ErrorReadingStream" xml:space="preserve">
<value>An error occured while reading the stream.</value>
</data>
<data name="StreamDoesNotSupportSeeking" xml:space="preserve">
<value>The stream does not support seeking.</value>
</data>
<data name="UnexpectedLibZipError_error" xml:space="preserve">
<value>Unexpected libzip error: {0}.</value>
<comment>The following is the name of a library and should not be translated: libzip
{0} - An error message from libzip.</comment>
</data>
<data name="FileFailedConsistencyChecks_file" xml:space="preserve">
<value>The file {0} failed consistency checks.</value>
<comment>{0} - A filename.</comment>
</data>
<data name="FileDoesNotExist_file" xml:space="preserve">
<value>The file '{0}' does not exist and file creation wasn't requested.</value>
<comment>{0} - A filename.</comment>
</data>
<data name="FileIsNotAZip_file" xml:space="preserve">
<value>The file '{0}' is not a ZIP archive.</value>
<comment>{0} - A filename.</comment>
</data>
<data name="FileCouldNotBeOpened_file" xml:space="preserve">
<value>The file '{0}' could not be opened.</value>
<comment>{0} - A filename.</comment>
</data>
<data name="ErrorReadingFile_file" xml:space="preserve">
<value>Error occured while reading the file '{0}'.</value>
<comment>{0} - A filename.</comment>
</data>
<data name="FileDoesNotSupportSeeking_file" xml:space="preserve">
<value>The file '{0}' does not support seeking.</value>
<comment>{0} - A filename.</comment>
</data>
<data name="DestinationMustNotBeEmpty" xml:space="preserve">
<value>Archive destination path must not be empty.</value>
</data>
<data name="UnknownError" xml:space="preserve">
<value>Unknown error.</value>
</data>
</root>
Loading

0 comments on commit 9dca4fb

Please sign in to comment.