Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix/TRPRO-288-option-to-disable-pipe-splitting-on-format-build #92

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace Ashampoo.Translation.Systems.Formats.Abstractions;

public record FormatWriteOptions;

Check warning on line 3 in src/Ashampoo.Translation.Systems.Formats.Abstractions/src/FormatWriteOptions.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Missing XML comment for publicly visible type or member 'FormatWriteOptions'
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@
/// </summary>
/// <param name="stream"></param>
/// <exception cref="UnsupportedFormatException"></exception>
void Write(Stream stream)
void Write(Stream stream, FormatWriteOptions? options = null)

Check warning on line 42 in src/Ashampoo.Translation.Systems.Formats.Abstractions/src/IFormat.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Parameter 'options' has no matching param tag in the XML comment for 'IFormat.Write(Stream, FormatWriteOptions?)' (but other parameters do)
{
WriteAsync(stream).Wait();
WriteAsync(stream, options).Wait();
}

/// <summary>
/// Writes the format to the given stream asynchronously.
/// </summary>
/// <param name="stream"></param>
/// <exception cref="UnsupportedFormatException"></exception>
Task WriteAsync(Stream stream);
Task WriteAsync(Stream stream, FormatWriteOptions? options = null);

Check warning on line 52 in src/Ashampoo.Translation.Systems.Formats.Abstractions/src/IFormat.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Parameter 'options' has no matching param tag in the XML comment for 'IFormat.WriteAsync(Stream, FormatWriteOptions?)' (but other parameters do)

/// <summary>
/// The <see cref="IFormatHeader"/> containing the header information for this format.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ public AshLangFormat()
}

/// <inheritdoc />
public void Write(Stream stream)
public void Write(Stream stream, FormatWriteOptions? options = null)
{
var chunkWriter = new ChunkWriter(stream, Chunks);
chunkWriter.Write();
}

/// <inheritdoc />
public Task WriteAsync(Stream stream)
public Task WriteAsync(Stream stream, FormatWriteOptions? options = null)
{
Write(stream);
return Task.CompletedTask;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

private const char CommentDelimiter = '|';

public CsvFormat()

Check warning on line 34 in src/Ashampoo.Translation.Systems.Formats/src/CSV/CsvFormat.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Missing XML comment for publicly visible type or member 'CsvFormat.CsvFormat()'
{
var csvFormatHeader = new CsvFormatHeader();
Header = csvFormatHeader;
Expand Down Expand Up @@ -153,7 +153,7 @@
}

/// <inheritdoc />
public async Task WriteAsync(Stream stream)
public async Task WriteAsync(Stream stream, FormatWriteOptions? options = null)
{
Guard.IsNotNullOrWhiteSpace(Delimiter.ToString());
await using StreamWriter writer = new(stream, leaveOpen: true, encoding: Encoding.UTF8);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private string RemoveMarker(string str)
}

/// <inheritdoc />
public void Write(Stream stream)
public void Write(Stream stream, FormatWriteOptions? options = null)
{
XSSFWorkbook workbook = new(); // Create a new workbook
var sheet = workbook.CreateSheet("Sheet 1"); // Create a new sheet
Expand Down Expand Up @@ -206,9 +206,9 @@ public void Write(Stream stream)
}

/// <inheritdoc />
public Task WriteAsync(Stream stream)
public Task WriteAsync(Stream stream, FormatWriteOptions? options = null)
{
Write(stream);
Write(stream, options);
return Task.CompletedTask;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
}

/// <inheritdoc/>
public void Write(Stream stream)
public void Write(Stream stream, FormatWriteOptions? options = null)
{
using StreamWriter writer = new(stream, leaveOpen: true);

Expand All @@ -120,7 +120,7 @@
///
/// </summary>
/// <param name="stream"></param>
public async Task WriteAsync(Stream stream)
public async Task WriteAsync(Stream stream, FormatWriteOptions? options = null)

Check warning on line 123 in src/Ashampoo.Translation.Systems.Formats/src/JavaProperties/JavaPropertiesFormat.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Parameter 'options' has no matching param tag in the XML comment for 'JavaPropertiesFormat.WriteAsync(Stream, FormatWriteOptions?)' (but other parameters do)
{
await using StreamWriter writer = new(stream, leaveOpen: true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@
}

/// <inheritdoc />
public void Write(Stream stream)
public void Write(Stream stream, FormatWriteOptions? options = null)
{
WriteAsync(stream).Wait();
WriteAsync(stream, options).Wait();
}

/// <summary>
Expand All @@ -176,7 +176,7 @@
/// <param name="stream">
/// The stream to write to.
/// </param>
public async Task WriteAsync(Stream stream)
public async Task WriteAsync(Stream stream, FormatWriteOptions? options = null)

Check warning on line 179 in src/Ashampoo.Translation.Systems.Formats/src/Json/JsonFormat.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Parameter 'options' has no matching param tag in the XML comment for 'JsonFormat.WriteAsync(Stream, FormatWriteOptions?)' (but other parameters do)
{
var root = new JsonObject();
CreateJsonObjects(root); // Create JSON objects from TranslationUnits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@
}

/// <inheritdoc />
public void Write(Stream stream)
public void Write(Stream stream, FormatWriteOptions? options = null)
{
WriteAsync(stream).Wait();
WriteAsync(stream, options).Wait();
}

/// <summary>
Expand All @@ -132,7 +132,7 @@
/// <exception cref="Exception">
/// Thrown if the format is invalid.
/// </exception>
public async Task WriteAsync(Stream stream)
public async Task WriteAsync(Stream stream, FormatWriteOptions? options = null)

Check warning on line 135 in src/Ashampoo.Translation.Systems.Formats/src/NLang/NLangFormat.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Parameter 'options' has no matching param tag in the XML comment for 'NLangFormat.WriteAsync(Stream, FormatWriteOptions?)' (but other parameters do)
{
// NLang is UTF16 LE
await using var writer = new StreamWriter(stream, Encoding.Unicode, leaveOpen: true);
Expand Down
4 changes: 2 additions & 2 deletions src/Ashampoo.Translation.Systems.Formats/src/PO/POFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
}

/// <inheritdoc />
public void Write(Stream stream)
public void Write(Stream stream, FormatWriteOptions? options = null)
{
using var writer = new StreamWriter(stream, Encoding.UTF8, leaveOpen: true);

Expand Down Expand Up @@ -228,7 +228,7 @@
/// <exception cref="Exception">
/// Thrown if an error occurs.
/// </exception>
public async Task WriteAsync(Stream stream)
public async Task WriteAsync(Stream stream, FormatWriteOptions? options = null)

Check warning on line 231 in src/Ashampoo.Translation.Systems.Formats/src/PO/POFormat.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Parameter 'options' has no matching param tag in the XML comment for 'POFormat.WriteAsync(Stream, FormatWriteOptions?)' (but other parameters do)
{
await using var writer = new StreamWriter(stream, Encoding.UTF8, leaveOpen: true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ namespace Ashampoo.Translation.Systems.Formats.PO;
public sealed record PoBuilderOptions : IFormatBuilderOptions
{
/// <summary>
/// Disables splitting of the id into msgctxt and msgid if a pipe separator is detected.
/// Enables splitting of the id into msgctxt and msgid if a pipe separator is detected.
/// <remarks>
/// Defaults to True.
/// </remarks>
/// </summary>
public bool SplitContextAndId { get; init; } = true;
};
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private List<string> GetComments(XElement element)
}

/// <inheritdoc />
public async Task WriteAsync(Stream stream)
public async Task WriteAsync(Stream stream, FormatWriteOptions? options = null)
{
var test = XmlWriter.Create(stream, new XmlWriterSettings
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private void ReadTranslations()
}

/// <inheritdoc />
public void Write(Stream stream)
public void Write(Stream stream, FormatWriteOptions? options = null)
{
//Add an empty namespace and empty value
var ns = new XmlSerializerNamespaces();
Expand All @@ -146,7 +146,7 @@ public void Write(Stream stream)
/// Asynchronously writes the current instance to the given <paramref name="stream"/>.
/// </summary>
/// <param name="stream"></param>
public async Task WriteAsync(Stream stream)
public async Task WriteAsync(Stream stream, FormatWriteOptions? options = null)
{
var ns = new XmlSerializerNamespaces();
ns.Add("", "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private async Task<bool> ConfigureHeader(FormatReadOptions? options)
}

/// <inheritdoc />
public void Write(Stream stream)
public void Write(Stream stream, FormatWriteOptions? options = null)
{
//Add an empty namespace and empty value
var ns = new XmlSerializerNamespaces();
Expand Down Expand Up @@ -200,7 +200,7 @@ public void Write(Stream stream)
/// <param name="stream">
/// The stream to write to.
/// </param>
public async Task WriteAsync(Stream stream)
public async Task WriteAsync(Stream stream, FormatWriteOptions? options = null)
{

//Add an empty namespace and empty value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private MockFormatWithTranslationUnits(Language language, string id, string valu
TranslationUnits.Add(translationUnit);
}

public Task WriteAsync(Stream stream)
public Task WriteAsync(Stream stream, FormatWriteOptions? options = null)
{
throw new NotImplementedException();
}
Expand Down
Loading