Skip to content

Conversation

Hirogen
Copy link
Collaborator

@Hirogen Hirogen commented Jul 7, 2025

this pr introduces multi language translation

  1. Key: Classname_<type: UI|Logger<level: warn|info|error>>_MessageKey
  2. Key: CommonName_MessageKey
  3. Key:Classname_UI_ControlType<Button,Label, etc.)_ControlName

Examples:

  • Program_Logger_Error_IPCChannel_ClientError: Class: Program.cs, Type: Logger, Level Error, MessageKey: IPCChannel_ClientError
  • Program_UI_Error_ConfigFileNotFound: Class: Program.cs, Type: UI, Level Error, MessageKey: ConfigFileNotFound
  • Title_LogExpert: CommonName: Title, MessageKey: LogExpert, using this for MessageBoxes in the title

@Hirogen Hirogen linked an issue Jul 7, 2025 that may be closed by this pull request
@Hirogen Hirogen requested a review from Copilot July 8, 2025 10:59
Copilot

This comment was marked as outdated.

@Hirogen Hirogen requested a review from Copilot July 9, 2025 12:46
Copilot

This comment was marked as outdated.

@Hirogen Hirogen requested a review from Copilot July 10, 2025 10:29
Copilot

This comment was marked as outdated.

@Hirogen Hirogen requested a review from Copilot July 10, 2025 10:34
Copilot

This comment was marked as outdated.

@Hirogen Hirogen self-assigned this Jul 15, 2025
@Hirogen Hirogen added enhancement this will make things better Feature what a great idea labels Jul 15, 2025
@Hirogen Hirogen added this to the 1.30.0 milestone Jul 15, 2025
@Hirogen Hirogen requested a review from Copilot July 17, 2025 09:46
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces multi-language translation support for LogExpert with resource-based localization using structured key naming conventions.

  • Implements a comprehensive resource key naming system with patterns for UI components, logger messages, and common elements
  • Adds culture-specific functionality with language selection in settings and proper culture initialization
  • Refactors hardcoded strings throughout the application to use resource keys with proper error handling and exception specificity

Reviewed Changes

Copilot reviewed 41 out of 50 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/LogExpert/Program.cs Main application entry point with culture initialization and comprehensive error handling using resources
src/LogExpert/Config/ConfigManager.cs Configuration management updated to use resource keys and support default language settings
src/LogExpert/Classes/LogExpertProxy.cs Proxy class updated with resource-based logging messages
src/LogExpert/Classes/LogExpertApplicationContext.cs Application context with platform-specific attributes added
src/LogExpert.sln Solution file updated to include README.md
src/LogExpert.UI/LogExpert.UI.csproj Project file cleanup removing SubType specification
Multiple UI files Extensive refactoring of UI components to use resource keys and improved error handling
Files not reviewed (5)
  • src/LogExpert.Resources/Resources.de.Designer.cs: Language not supported
  • src/LogExpert.UI/Controls/DateTimeDragControl.Designer.cs: Language not supported
  • src/LogExpert.UI/Controls/LogWindow/LogWindow.designer.cs: Language not supported
  • src/LogExpert.UI/Dialogs/Eminus/EminusConfigDlg.Designer.cs: Language not supported
  • src/LogExpert.UI/Dialogs/LogTabWindow/LogTabWindow.designer.cs: Language not supported

Comment on lines 75 to 79

PluginRegistry.PluginRegistry.Instance.Create(ConfigManager.Instance.ConfigDir, ConfigManager.Instance.Settings.Preferences.PollingInterval);
SetCulture();

_ = PluginRegistry.PluginRegistry.Instance.Create(ConfigManager.Instance.ConfigDir, ConfigManager.Instance.Settings.Preferences.PollingInterval);

Copy link

Copilot AI Jul 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SetCulture() method is called before plugin registry initialization, but it depends on ConfigManager.Instance.Settings which may not be fully initialized yet. Consider moving SetCulture() after the plugin registry initialization or adding null checks.

Copilot uses AI. Check for mistakes.

return true;
}

//intentional fall-through for all other keys
Copy link

Copilot AI Jul 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The massive switch statement with 340+ empty case blocks is unnecessary and makes the code difficult to maintain. Consider removing all the empty cases and just use the default case, or implement specific logic only for the cases that need it.

Copilot uses AI. Check for mistakes.

Comment on lines 307 to +313
DataGridViewAdvancedCellBorderStyle.None => 0,
DataGridViewAdvancedCellBorderStyle.InsetDouble or DataGridViewAdvancedCellBorderStyle.OutsetDouble => 2,
_ => 1
DataGridViewAdvancedCellBorderStyle.NotSet => 0, // Default border size for NotSet
DataGridViewAdvancedCellBorderStyle.Single => 0, // Default border size for Single
DataGridViewAdvancedCellBorderStyle.Inset => 0, // Default border size for Inset
DataGridViewAdvancedCellBorderStyle.Outset => 0, // Default border size for Outset
DataGridViewAdvancedCellBorderStyle.OutsetPartial => 0, // Default border size for OutsetPartial
Copy link

Copilot AI Jul 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The switch expression has multiple cases that all return 0, but they are explicitly listed with comments. This could be simplified by grouping them or using a more concise approach.

Copilot uses AI. Check for mistakes.


settings.Preferences.DefaultEncoding ??= Encoding.Default.HeaderName;

settings.Preferences.DefaultLanguage ??= CultureInfo.GetCultureInfo("en-US").Name;
Copy link

Copilot AI Jul 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default language is hardcoded as 'en-US'. Consider using a constant or configuration value to make this more maintainable and configurable.

Suggested change
settings.Preferences.DefaultLanguage ??= CultureInfo.GetCultureInfo("en-US").Name;
const string DEFAULT_LANGUAGE = "en-US";
settings.Preferences.DefaultLanguage ??= CultureInfo.GetCultureInfo(DEFAULT_LANGUAGE).Name;

Copilot uses AI. Check for mistakes.


private readonly Image _emptyImage = new Bitmap(16, 16);
private readonly LogTabWindow _logTabWin;
private const string DEFAULT_FONT_NAME = "Courier New";
Copy link

Copilot AI Jul 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The default font name is hardcoded. Consider making this configurable or using system defaults to improve cross-platform compatibility.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement this will make things better Feature what a great idea

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi Language Translation

1 participant