Skip to content

Conversation

andreaskienle
Copy link
Contributor

@andreaskienle andreaskienle commented Jul 29, 2025

This PR refactors the i18n a bit:

  • Show debug log (in console) only when running locally
  • Move initialization away from the root directory
  • Refactor schema validations to accept the t function rather than using the global functions (this way they should be re-triggered when at some point the language changes)

@andreaskienle andreaskienle requested a review from Copilot July 29, 2025 09:02
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 refactors the internationalization (i18n) configuration by relocating the i18n setup file from the root directory to a more organized structure within the utils folder and updating validation schemas to accept translation functions as parameters.

  • Moved i18n configuration from root i18n.ts to src/utils/i18n/i18n.ts
  • Refactored validation schemas to accept translation functions as parameters instead of using global i18n imports
  • Updated import statements across multiple files to reference the new i18n location

Reviewed Changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/utils/i18n/i18n.ts New i18n configuration file with improved debug flag logic
src/main.tsx Updated import path for i18n configuration
src/lib/api/validations/schemas.ts Refactored to use factory functions accepting translation function parameters
src/components/Wizards/CreateManagedControlPlane/CreateManagedControlPlaneWizardContainer.tsx Updated to use new schema factory with memoized validation
src/components/Dialogs/CreateWorkspaceDialogContainer.tsx Updated to use new schema factory with memoized validation
src/components/Dialogs/CreateProjectDialogContainer.tsx Updated to use new schema factory with memoized validation
src/components/Dialogs/CreateProjectDialog.cy.tsx Updated test to use new schema factory pattern
i18n.ts Removed original i18n configuration file
cypress/support/commands.ts Updated import path for i18n configuration
Comments suppressed due to low confidence (1)

src/lib/api/validations/schemas.ts:9

  • [nitpick] The function name 'createValidateChargingTarget' is inconsistent with the naming pattern. It should be 'createChargingTargetValidator' to match the pattern of other factory functions in this file.
function createValidateChargingTarget<T extends { chargingTargetType?: string; chargingTarget?: string }>(

@andreaskienle andreaskienle marked this pull request as ready for review July 29, 2025 09:09
Copy link
Contributor

@lucasgoral lucasgoral left a comment

Choose a reason for hiding this comment

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

LGTM :)

@andreaskienle andreaskienle merged commit 0cdf73b into main Aug 4, 2025
5 checks passed
@andreaskienle andreaskienle deleted the fix-i18n branch August 4, 2025 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants