forked from stakira/OpenUtau
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request stakira#1107 from maiko3tattun/0421_TranslateError…
…message Improved translation of error messages for more flexibility
- Loading branch information
Showing
17 changed files
with
199 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
|
||
namespace OpenUtau.Core { | ||
public class MessageCustomizableException : Exception { | ||
|
||
public override string Message { get; } = string.Empty; | ||
public string TranslatableMessage { get; set; } = string.Empty; | ||
public Exception SubstanceException { get; } | ||
public bool ShowStackTrace { get; } = true; | ||
|
||
/// <summary> | ||
/// This allows the use of translatable messages and the hiding of stack traces in the message box. | ||
/// <summary> | ||
/// <paramref name="message">untranslated message</paramref> | ||
/// <paramref name="translatableMessage">By enclosing the resource key with a tag like "<translate:key>", only that part will be translated.</paramref> | ||
/// <paramref name="e">underlying exception</paramref> | ||
public MessageCustomizableException(string message, string translatableMessage, Exception e) { | ||
Message = message; | ||
TranslatableMessage = translatableMessage; | ||
SubstanceException = e; | ||
} | ||
|
||
/// <summary> | ||
/// This allows the use of translatable messages and the hiding of stack traces in the message box. | ||
/// <summary> | ||
/// <paramref name="message">untranslated message</paramref> | ||
/// <paramref name="translatableMessage">By enclosing the resource key with a tag like "<translate:key>", only that part will be translated.</paramref> | ||
/// <paramref name="e">underlying exception</paramref> | ||
/// <paramref name="showStackTrace">Can be omitted. Default is true.</paramref> | ||
public MessageCustomizableException(string message, string translatableMessage, Exception e, bool showStackTrace) { | ||
Message = message; | ||
TranslatableMessage = translatableMessage; | ||
SubstanceException = e; | ||
ShowStackTrace = showStackTrace; | ||
} | ||
|
||
public override string ToString() { | ||
return SubstanceException.ToString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.