Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract strings in code to resources/values/strings.xml and used it from there #21

Merged

Conversation

b0r1ngx
Copy link
Contributor

@b0r1ngx b0r1ngx commented Mar 25, 2024

Hello, Arkadii, I'm done with extracting user strings from code, please review.

I think that we may extract strings only that user interact with, because later its valueble for translate it for example.

Summary by CodeRabbit

  • New Features
    • Introduced dynamic text retrieval for various UI elements using resource strings.
  • Refactor
    • Refactored UI components to use resource strings for actions, labels, and buttons.
  • Documentation
    • Added a TODO comment in the Main.kt file for potential resource integration with WebAssembly.

Copy link

coderabbitai bot commented Mar 25, 2024

Walkthrough

The recent updates across the Minesweeper app's codebase primarily focus on enhancing internationalisation and localisation support. This includes adding imports for generated resources, utilising resource strings for UI text like actions, labels, and buttons, and incorporating ExperimentalResourceApi for advanced resource handling. Additionally, there's a specific note on exploring resource usage for WebAssembly, indicating a forward-looking approach to cross-platform compatibility.

Changes

Files Changes
.../game/GameContent.kt
.../root/RootContent.kt
.../settings/EditSettingsContent.kt
Added imports for generated resources and utilised resource strings for UI elements like actions, labels, and buttons.
.../jvmMain/kotlin/Main.kt Added resource handling for window title.
.../wasmJsMain/kotlin/Main.kt Added a TODO for exploring resource usage in WebAssembly.

🐰✨
In a land of code and binary,
Where resources were once a mystery,
Came a rabbit, wise and merry,
To sprinkle localisation, quite the fairy.
With strings and resources, all in a flurry,
Our app now speaks globally, no need to worry!
🌍✨

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 78bc9d8 and bb3d233.
Files ignored due to path filters (1)
  • composeApp/src/commonMain/composeResources/values/strings.xml is excluded by: !**/*.xml
Files selected for processing (5)
  • composeApp/src/commonMain/kotlin/com/arkivanov/minesweeper/game/GameContent.kt (7 hunks)
  • composeApp/src/commonMain/kotlin/com/arkivanov/minesweeper/root/RootContent.kt (2 hunks)
  • composeApp/src/commonMain/kotlin/com/arkivanov/minesweeper/settings/EditSettingsContent.kt (3 hunks)
  • composeApp/src/jvmMain/kotlin/Main.kt (2 hunks)
  • composeApp/src/wasmJsMain/kotlin/Main.kt (1 hunks)
Additional comments: 17
composeApp/src/wasmJsMain/kotlin/Main.kt (1)
  • 36-36: The TODO comment about understanding how to use resources for Wasm is noted. It might be beneficial to add more details or link this TODO to a specific issue in your project's issue tracker for better visibility and tracking.
composeApp/src/jvmMain/kotlin/Main.kt (2)
  • 12-14: The imports for handling resources are correctly added.
  • 34-34: Utilizing stringResource for the window title is a good practice for supporting localization. This change aligns well with the PR's objectives.
composeApp/src/commonMain/kotlin/com/arkivanov/minesweeper/root/RootContent.kt (3)
  • 19-23: The imports for accessing resource strings are correctly added.
  • 34-34: Utilizing stringResource for the app name in the TopAppBar title is a good practice for supporting localization.
  • 39-39: Using stringResource for the settings icon's content description enhances accessibility and supports localization.
composeApp/src/commonMain/kotlin/com/arkivanov/minesweeper/settings/EditSettingsContent.kt (6)
  • 19-26: The imports for accessing resource strings are correctly added.
  • 42-42: Utilizing stringResource for the width label in the TextField is a good practice for supporting localization.
  • 49-49: Using stringResource for the height label supports localization and enhances the user experience.
  • 56-56: Incorporating stringResource for the mine count label aligns with best practices for localization.
  • 65-65: Applying stringResource for the cancel button text is a good practice for supporting localization.
  • 69-69: Utilizing stringResource for the apply button text enhances maintainability and supports localization efforts.
composeApp/src/commonMain/kotlin/com/arkivanov/minesweeper/game/GameContent.kt (5)
  • 57-68: The imports for accessing resource strings are correctly added.
  • 95-95: Utilizing stringResource for the mines counter content description is a good practice for supporting localization and enhancing accessibility.
  • 108-108: Using stringResource for the timer content description supports localization and enhances accessibility.
  • 207-207: Applying stringResource for the restart button's content description aligns with best practices for localization and accessibility.
  • 225-225: Incorporating stringResource for control instructions enhances the user experience and supports localization efforts.

2) Changed "" to '' (string to char)
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between bb3d233 and 0f5492a.
Files ignored due to path filters (1)
  • composeApp/src/commonMain/composeResources/values/strings.xml is excluded by: !**/*.xml
Files selected for processing (1)
  • composeApp/src/commonMain/kotlin/com/arkivanov/minesweeper/game/GameContent.kt (8 hunks)
Files skipped from review as they are similar to previous changes (1)
  • composeApp/src/commonMain/kotlin/com/arkivanov/minesweeper/game/GameContent.kt

@b0r1ngx
Copy link
Contributor Author

b0r1ngx commented Mar 25, 2024

One more thing that I want to say, the task of increasing level of accessibility is a not easy task and requires additional work and tests, so I think in context of this PR we may not target on this, but awesome that we have discussion about it!

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 0f5492a and 6daf906.
Files ignored due to path filters (1)
  • composeApp/src/commonMain/composeResources/values/strings.xml is excluded by: !**/*.xml
Files selected for processing (1)
  • composeApp/src/commonMain/kotlin/com/arkivanov/minesweeper/game/GameContent.kt (8 hunks)
Files skipped from review as they are similar to previous changes (1)
  • composeApp/src/commonMain/kotlin/com/arkivanov/minesweeper/game/GameContent.kt

arkivanov
arkivanov previously approved these changes Mar 25, 2024
composeApp/src/wasmJsMain/kotlin/Main.kt Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 6daf906 and 64ad7aa.
Files ignored due to path filters (1)
  • composeApp/src/commonMain/composeResources/values/strings.xml is excluded by: !**/*.xml
Files selected for processing (1)
  • composeApp/src/wasmJsMain/kotlin/Main.kt (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • composeApp/src/wasmJsMain/kotlin/Main.kt

@b0r1ngx b0r1ngx requested a review from arkivanov March 25, 2024 18:05
@b0r1ngx
Copy link
Contributor Author

b0r1ngx commented Mar 25, 2024

Is GIVEN_created_WHEN_first_click_on_cell_THEN_state_started test start failing?
(check auto build)

@arkivanov
Copy link
Owner

Is GIVEN_created_WHEN_first_click_on_cell_THEN_state_started test start failing? (check auto build)

I think test test is flaky, filed #22.

@arkivanov arkivanov merged commit d12d323 into arkivanov:master Mar 25, 2024
1 check passed
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