Override ToString() in core classes.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Claunia.Localization.Core
|
namespace Claunia.Localization.Core
|
||||||
@@ -119,7 +120,12 @@ namespace Claunia.Localization.Core
|
|||||||
translated = message.Translations.FirstOrDefault(l => l.Locale == locale.Substring(underscore));
|
translated = message.Translations.FirstOrDefault(l => l.Locale == locale.Substring(underscore));
|
||||||
}
|
}
|
||||||
|
|
||||||
index.Add(message.Id, translated is null ? message.Source.Singular : translated.Singular);
|
try { index.Add(message.Id, translated is null ? message.Source.Singular : translated.Singular); }
|
||||||
|
catch(ArgumentException e)
|
||||||
|
{
|
||||||
|
Debug.WriteLine(e);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
indexes.Add(locale, index);
|
indexes.Add(locale, index);
|
||||||
|
|||||||
@@ -80,6 +80,8 @@ namespace Claunia.Localization.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ReadOnlyObservableCollection<Plural> Plurals { get; }
|
public ReadOnlyObservableCollection<Plural> Plurals { get; }
|
||||||
|
|
||||||
|
public override string ToString() => singular;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new plural in this message
|
/// Initializes a new plural in this message
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -107,6 +107,8 @@ namespace Claunia.Localization.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ReadOnlyObservableCollection<Parameter> Parameters { get; }
|
public ReadOnlyObservableCollection<Parameter> Parameters { get; }
|
||||||
|
|
||||||
|
public override string ToString() => Source.Singular;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new localized string in this message
|
/// Initializes a new localized string in this message
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -93,5 +93,7 @@ namespace Claunia.Localization.Core
|
|||||||
Modified?.Invoke(this, EventArgs.Empty);
|
Modified?.Invoke(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString() => description;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -36,5 +36,7 @@ namespace Claunia.Localization.Core
|
|||||||
Modified?.Invoke(this, EventArgs.Empty);
|
Modified?.Invoke(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString() => text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,11 +4,11 @@ namespace Claunia.Localization.Core
|
|||||||
{
|
{
|
||||||
public class Project
|
public class Project
|
||||||
{
|
{
|
||||||
string name;
|
string name;
|
||||||
|
|
||||||
internal EventHandler ProjectModified;
|
internal EventHandler ProjectModified;
|
||||||
string url;
|
string url;
|
||||||
string version;
|
string version;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Project name
|
/// Project name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -47,5 +47,7 @@ namespace Claunia.Localization.Core
|
|||||||
ProjectModified?.Invoke(this, EventArgs.Empty);
|
ProjectModified?.Invoke(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString() => version is null ? name : $"{name} {version}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -59,5 +59,7 @@ namespace Claunia.Localization.Core
|
|||||||
Modified?.Invoke(this, EventArgs.Empty);
|
Modified?.Invoke(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString() => email is null ? name : $"{name} <{email}>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user