Skip to content
Merged
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [9.0.0] - 2026-02-02

### Changed

- BREAKING CHANGE: Move code that depends on Windows.Forms or System.Drawing into an L10NSharp.Windows.Forms namespace. Rename L10NSharp.UI as L10NSharp.Windows.Forms.UIComponents. Move L10NExtender out of UI subfolder into L10NSharp.Windows.Forms. Move Winforms related tests to L10NSharp.Windows.Forms.Tests. Change the folder for L10NSharp tests to match its namespace L10NSharp.Tests.
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Company>SIL</Company>
<Authors>SIL Global</Authors>
<Product>L10NSharp</Product>
<Copyright>Copyright © 2010-2025 SIL Global</Copyright>
<Copyright>Copyright © 2010-2026 SIL Global</Copyright>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
2 changes: 1 addition & 1 deletion src/L10NSharp.Tests/LocalizationManagerXliffTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void Create_PreferredUiLanguageIsGenericVariant_CreatesLocalizationManage
string genericLocaleId, string countrySpecificLocalId)
{
LocalizationManager.ClearLoadedManagers();
var dir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);
var dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var lm = LocalizationManager.Create(genericLocaleId, "Test", "Test", "1.0",
Path.Combine(dir, "../../../src/L10NSharp.Tests/TestXliff2"), "", "",
new string[] {});
Expand Down
21 changes: 9 additions & 12 deletions src/L10NSharp.Tests/TempFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ public TempFile(string[] contentLines)
File.WriteAllLines(_path, contentLines);
}

public string Path
{
get { return _path; }
}
public string Path => _path;

// See comment on class above regarding Dispose
public void Dispose()
Expand Down Expand Up @@ -97,7 +94,7 @@ public static TempFile CreateAndGetPathButDontMakeTheFile()
/// <summary>
/// Use this one when it's important to have a certain file extension
/// </summary>
/// <param name="extension">with or with out '.', will work the same</param>
/// <param name="extension">with or without '.', will work the same</param>
public static TempFile WithExtension(string extension)
{
extension = extension.TrimStart('.');
Expand All @@ -109,16 +106,16 @@ public static TempFile WithExtension(string extension)
/// <summary>
/// Use this one when it's important to have a certain file name (with, or without extension).
/// </summary>
/// <param name="filename">with or with out an extension, will work the same</param>
/// <param name="filename">with or without an extension, will work the same</param>
public static TempFile WithFilename(string filename)
{
if(filename == null)
throw new ArgumentNullException("filename");
throw new ArgumentNullException(nameof(filename));
if(filename == string.Empty)
throw new ArgumentException("Filename has no content", "filename");
throw new ArgumentException("Filename has no content", nameof(filename));
filename = filename.Trim();
if(filename == string.Empty)
throw new ArgumentException("Filename has only whitespace", "filename");
throw new ArgumentException("Filename has only whitespace", nameof(filename));

var pathname = System.IO.Path.Combine(System.IO.Path.GetTempPath(), filename);
File.Create(pathname).Close();
Expand All @@ -136,7 +133,7 @@ public static TempFile WithFilenameInTempFolder(string fileName)
var tempFolder = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetRandomFileName());
Directory.CreateDirectory(tempFolder);
var path = System.IO.Path.Combine(tempFolder, fileName);
var result = TempFile.TrackExisting(path);
var result = TrackExisting(path);
result._folderToDelete = tempFolder;
return result;
}
Expand All @@ -145,7 +142,7 @@ public static TempFile WithFilenameInTempFolder(string fileName)
/// Used to make a real file out of a resource for the purpose of testing
/// </summary>
/// <param name="resource">e.g., an audio resource</param>
/// <param name="extension">with or with out '.', will work the same</param>
/// <param name="extension">with or without '.', will work the same</param>
public static TempFile FromResource(Stream resource, string extension)
{
var f = WithExtension(extension);
Expand All @@ -159,7 +156,7 @@ public static TempFile FromResource(Stream resource, string extension)
/// Used to make a real file out of a resource for the purpose of testing
/// </summary>
/// <param name="resource">e.g., a video resource</param>
/// <param name="extension">with or with out '.', will work the same</param>
/// <param name="extension">with or without '.', will work the same</param>
public static TempFile FromResource(byte[] resource, string extension)
{
var f = WithExtension(extension);
Expand Down
2 changes: 1 addition & 1 deletion src/L10NSharp.Tests/XLiffSchemaValidationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ private static string SchemaLocation
{
get
{
var dir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);
var dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var installedXliffDir = "../../../src/L10NSharp.Tests/TestXliff";

var schemaLocation = Path.Combine(dir, installedXliffDir,
Expand Down
6 changes: 2 additions & 4 deletions src/L10NSharp.Tests/XLiffUtilsTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;
using System.Reflection;
using NUnit.Framework;
Expand All @@ -13,9 +13,7 @@ public class XLiffUtilsTests

public XLiffUtilsTests()
{
var asmFile = Assembly.GetExecutingAssembly().CodeBase.Replace("file://", String.Empty);
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
asmFile = asmFile.TrimStart('/');
var asmFile = Assembly.GetExecutingAssembly().Location;
var folder = Path.GetDirectoryName(asmFile); // will be something like <repodir>/output/Debug
folder = Path.GetDirectoryName(folder);
folder = Path.GetDirectoryName(folder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class ILocalizableComponentXLiffTests
/// ------------------------------------------------------------------------------------
protected void TestSetup(string installedTranslationDir)
{
var dir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);
var dir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().Location).LocalPath);
m_manager = LocalizationManagerWinforms.Create("en", "LocalizableComponentTest", "LocalizableComponentTest", "1.0",
Path.Combine(dir, installedTranslationDir),
"", null, "", new string[] { })
Expand Down
Loading