-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extract i localization manager (#27)
* exstracted interfaces for LocalizationManager and LocalizationManager * updated LocalizationManagerTests * #23 renamed LocalizationLogger to LocalizedLogger * changed AddTransient to AddSingleton
- Loading branch information
Showing
12 changed files
with
103 additions
and
34 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
2 changes: 1 addition & 1 deletion
2
Aquality.Selenium.Core/src/Aquality.Selenium.Core/Aquality.Selenium.Core.xml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
16 changes: 16 additions & 0 deletions
16
Aquality.Selenium.Core/src/Aquality.Selenium.Core/Localization/ILocalizationManager.cs
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,16 @@ | ||
namespace Aquality.Selenium.Core.Localization | ||
{ | ||
/// <summary> | ||
/// This interface is using for translation messages to different languages | ||
/// </summary> | ||
public interface ILocalizationManager | ||
{ | ||
/// <summary> | ||
/// Get localized message from resources by its key. | ||
/// </summary> | ||
/// <param name="messageKey">Key in resource file.</param> | ||
/// <param name="args">Arguments, which will be provided to template of localized message.</param> | ||
/// <returns>Localized message.</returns> | ||
string GetLocalizedMessage(string messageKey, params object[] args); | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
Aquality.Selenium.Core/src/Aquality.Selenium.Core/Localization/ILocalizedLogger.cs
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,56 @@ | ||
using System; | ||
|
||
namespace Aquality.Selenium.Core.Localization | ||
{ | ||
/// <summary> | ||
/// Log messages to different languages | ||
/// </summary> | ||
public interface ILocalizedLogger | ||
{ | ||
/// <summary> | ||
/// Logs localized message for action with INFO level which is applied for element, for example, click, send keys etc. | ||
/// </summary> | ||
/// <param name="elementType">Type of the element.</param> | ||
/// <param name="elementName">Name of the element.</param> | ||
/// <param name="messageKey">Key in resource file.</param> | ||
/// <param name="args">Arguments, which will be provided to template of localized message.</param> | ||
void InfoElementAction(string elementType, string elementName, string messageKey, params object[] args); | ||
|
||
/// <summary> | ||
/// Logs localized message with INFO level. | ||
/// </summary> | ||
/// <param name="messageKey">Key in resource file.</param> | ||
/// <param name="args">Arguments, which will be provided to template of localized message.</param> | ||
void Info(string messageKey, params object[] args); | ||
|
||
/// <summary> | ||
/// Logs localized message with DEBUG level. | ||
/// </summary> | ||
/// <param name="messageKey">Key in resource file.</param> | ||
/// <param name="exception">Exception, gets null value by default.</param> | ||
/// <param name="args">Arguments, which will be provided to template of localized message.</param> | ||
void Debug(string messageKey, Exception exception = null, params object[] args); | ||
|
||
/// <summary> | ||
/// Logs localized message with WARN level. | ||
/// </summary> | ||
/// <param name="messageKey">Key in resource file.</param> | ||
/// <param name="args">Arguments, which will be provided to template of localized message.</param> | ||
void Warn(string messageKey, params object[] args); | ||
|
||
/// <summary> | ||
/// Logs localized message with ERROR level. | ||
/// </summary> | ||
/// <param name="messageKey">Key in resource file.</param> | ||
/// <param name="args">Arguments, which will be provided to template of localized message.</param> | ||
void Error(string messageKey, params object[] args); | ||
|
||
/// <summary> | ||
/// Logs localized message with FATAL level. | ||
/// </summary> | ||
/// <param name="messageKey">Key in resource file.</param> | ||
/// <param name="exception">Exception, gets null value by default.</param> | ||
/// <param name="args">Arguments, which will be provided to template of localized message.</param> | ||
void Fatal(string messageKey, Exception exception = null, params object[] args); | ||
} | ||
} |
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