feat(webui): language selector #593

Merged
Sainan merged 4 commits from langsel into main 2024-12-22 11:38:50 -08:00
Owner

Closes #407

Closes #407
coderabbitai[bot] commented 2024-12-21 16:48:09 -08:00 (Migrated from github.com)
Author
Owner

Warning

Rate limit exceeded

@Sainan has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 25 minutes and 28 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 71dfa789df and 307fba9635.

📒 Files selected for processing (1)
  • static/webui/script.js (1 hunks)

Walkthrough

This pull request introduces a comprehensive multi-language support system across the application's frontend and backend components. The changes span multiple files, focusing on enabling dynamic language selection and localization of item names and interface elements.

The core modifications involve replacing the existing single-language (English) approach with a flexible language handling mechanism. In the itemDataService.ts, a new getString function is introduced that can retrieve strings from various language dictionaries based on a provided language code. The getItemListsController is updated to accept a language parameter from the request query, allowing item lists to be fetched in different languages.

The frontend (index.html and script.js) complements these backend changes by adding a language selection dropdown and implementing client-side language management functions. These functions enable users to change the application's language dynamically, persist their language preference, and trigger corresponding item list updates.

The implementation supports multiple languages including English, German, Spanish, French, Italian, Japanese, Korean, Polish, Portuguese, Russian, Chinese (Simplified and Traditional), Thai, Turkish, and Ukrainian, providing a more inclusive user experience.

Sequence Diagram

sequenceDiagram
    participant User
    participant Frontend
    participant LanguageService
    participant Backend

    User->>Frontend: Select Language
    Frontend->>Frontend: setLanguage()
    Frontend->>Backend: Fetch Item List (with lang param)
    Backend->>LanguageService: Retrieve Localized Strings
    LanguageService-->>Backend: Return Localized Item Names
    Backend-->>Frontend: Return Localized Item List
    Frontend->>Frontend: Update UI with Localized Content
  • #582: Modifications to inventoryController related to account information retrieval, which might intersect with the language handling improvements in this PR.

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>, please review it.
    • Generate unit testing code 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 testing code 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.
<!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- This is an auto-generated comment: rate limited by coderabbit.ai --> > [!WARNING] > ## Rate limit exceeded > > @Sainan has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait **25 minutes and 28 seconds** before requesting another review. > > <details> > <summary>⌛ How to resolve this issue?</summary> > > After the wait time has elapsed, a review can be triggered using the `@coderabbitai review` command as a PR comment. Alternatively, push new commits to this PR. > > We recommend that you space out your commits to avoid hitting the rate limit. > > </details> > > > <details> > <summary>🚦 How do rate limits work?</summary> > > CodeRabbit enforces hourly rate limits for each developer per organization. > > Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. > > Please see our [FAQ](https://docs.coderabbit.ai/faq) for further information. > > </details> > > <details> > <summary>📥 Commits</summary> > > Reviewing files that changed from the base of the PR and between 71dfa789df27c33cbbbe3a2c2ddfb0810327286b and 307fba9635cf6f6ed84db51a23ed01f3b6397d4a. > > </details> > > <details> > <summary>📒 Files selected for processing (1)</summary> > > * `static/webui/script.js` (1 hunks) > > </details> <!-- end of auto-generated comment: rate limited by coderabbit.ai --> <!-- walkthrough_start --> ## Walkthrough This pull request introduces a comprehensive multi-language support system across the application's frontend and backend components. The changes span multiple files, focusing on enabling dynamic language selection and localization of item names and interface elements. The core modifications involve replacing the existing single-language (English) approach with a flexible language handling mechanism. In the `itemDataService.ts`, a new `getString` function is introduced that can retrieve strings from various language dictionaries based on a provided language code. The `getItemListsController` is updated to accept a language parameter from the request query, allowing item lists to be fetched in different languages. The frontend (`index.html` and `script.js`) complements these backend changes by adding a language selection dropdown and implementing client-side language management functions. These functions enable users to change the application's language dynamically, persist their language preference, and trigger corresponding item list updates. The implementation supports multiple languages including English, German, Spanish, French, Italian, Japanese, Korean, Polish, Portuguese, Russian, Chinese (Simplified and Traditional), Thai, Turkish, and Ukrainian, providing a more inclusive user experience. ## Sequence Diagram ```mermaid sequenceDiagram participant User participant Frontend participant LanguageService participant Backend User->>Frontend: Select Language Frontend->>Frontend: setLanguage() Frontend->>Backend: Fetch Item List (with lang param) Backend->>LanguageService: Retrieve Localized Strings LanguageService-->>Backend: Return Localized Item Names Backend-->>Frontend: Return Localized Item List Frontend->>Frontend: Update UI with Localized Content ``` ## Possibly related PRs - **#582**: Modifications to `inventoryController` related to account information retrieval, which might intersect with the language handling improvements in this PR. <!-- walkthrough_end --> <!-- internal state start --> <!-- FAHghAtBAEAqAWBLAztF0CGA7TBXALgPYQDmAplmQE4b5kAm0AxoQLasX4Bc0ADldEIAjAFZkm+RADcyqIQE9mhetQxChifADoMiaFAB8wY+CjGAxOegAFAErQAyrnYYq84wjJ9cAGx/QqMgBHXFl8aEl8HwZoACIAMzJaAAoAdzIhXEQASh4fbBJcDHJoZDJoiUIqWOhUjFRkXCFWTTpGBQj4L1wygQddLGxMLEZ0RBUsSXjEGI78LugsZyFqaABWAE4AZi04Bf5EVldFXlwqXkIywXjO9Ds0VCI0Vl5ojknMaHysQuKvMoqRAEiVoZy8qU0SBw83BGWgPVWiEm1HiGCYXmSAFUAJLZa6dLz8QhiCS7BDoCjwbDo97hXSsR6EZ5EmTw3rQMgAD141BmWHR0A6GD8hAhPzZ1EZpXK4nCMMQAn4ZESVECjG+vxK8SqBMwvFeiCYtEQhCwWmMAEF6PRNCbBn55AAaW6oU5+ALBULIOnWwLIMqobCMJg+S6yB6NLxLVgrAQAFgADAB2Z1Im1GyTi+a0XWHV5kWnG034mFfApFEoA2U6v2EHwyR4LFj86hYVA1z0KgucdsEHxImJIzo5lCRskLe5GnArTBMdH+mLzKiEXAkeC67UisUkaCY2wAGR4AG14Ph8LxkFwAPRXkiQppaFisK/IXhoihIkT1agyKhXhxvuiAByn4YA4P7UFebo+FemxbAAuskp7npeN53vMD5Pi+gEflgX69L+/44SBeFgRBf7QbB2zZOawCGCYkAwBQjCEDcGAEMQ5CUDQbRKOwn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wrdxDYDKLrLowa6awq3ACqgb38SqD9StAl349YlNNAlBK4JAQKLg3RFrSwcKGbcsmrBBCtlZxrBw6r7o6RREIbwwW0tsprv8eR9toCsadxGhWsvpWFyNRirNeEqThqDFRqbRXxBSy4MTmCAYgZl4kg28BwrF78Fgur4ZDIha/Rhwvq5bJhGbAh4hARw1YKaZCkNMMB4hCZhhzInzorjA1h4r6lTpzoip9x5q0RFAooVBMqLRbyvNpgpxwh4k7FX18RTMYLIDTZ1a4SiQD4/5rs6qjh9Qy4SrMMQEMb0xjR1NSgkAU6+Yb5z5PgkaBzlBfBXBZrdTJgBgp49QiQVingibsCCxOZFVaIAA2eKu9JIcIFaaYQoHMrAVmxeLoHMZsS+s4AtMoZ6kqpApvN2K5c2ATdGOtfwc4lGQMURbK7TPRQ0S+LcFLHUOezmeQJubsvU1QZ6tbUTe+8IDUsETO4AAAeUrR8GdDQYOnexMtlE+HDMCBOtLlZD5KpF8B9Jfx3vd1CvlvwrovIFpGtoQqhqSTOpwCJHnADEvkOGgYEA01gZYC6Goc5VEVoIgDJj5FGzTW5F5E8tokzN8Rp1zMbPZObOvvCV9KiRiQ53iW7MrN52ZVHWQ2kvBUZi6vOI0rElsr4oErzynw/PrxfG/ORi0A3MalSSsd0rD1scansfmmcfIDEuVzcffLHM8dXJ/N8e+RgECeeq5RCa6tAdyoqW9G5vVzfONA8bnwSZ8b8a3PNXskUgOxYjYg4l3MgN0gEgCAwEMn7z2gkmUEsg0GsnkjslAEYj4haHwC6XGGQB6Q22VIYC6Qjmh3on6agGYA2AAA4mA1hD6mAEw1AYqln1AGBURkx6AhAtgNh6ANgSKEwkg1h6AkwMA4xDmkwkxGAFIBmkwSL6BUQkwlmTn4gYqkwmAtgtgmB1AVgtgMAYqmAYrrR4ghAEwlnzmthfntnD6hBbJKmBndJNARnz5xmVVJn6BQtRFDAgA --> <!-- internal state end --> <!-- tips_start --> --- 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? <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <details> <summary>🪧 Tips</summary> ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit <commit_id>, please review it.` - `Generate unit testing code 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 testing code 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` 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 using PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR. ([Beta](https://docs.coderabbit.ai/early-access#beta)) - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. ### Other keywords and placeholders - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. - Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description. - Add `@coderabbitai` anywhere in the PR title to generate the title automatically. ### Documentation and Community - Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements. </details> <!-- tips_end -->
coderabbitai[bot] (Migrated from github.com) reviewed 2024-12-21 16:50:00 -08:00
coderabbitai[bot] (Migrated from github.com) left a comment
Author
Owner

Actionable comments posted: 1

🧹 Nitpick comments (8)
static/webui/script.js (3)

87-93: Improve Robustness of setActiveLanguage Handling

This function sets the global language on the window object. Consider adding a fallback check to ensure the DOM elements exist before accessing them, to avoid potential runtime errors when querying elements with data-lang attributes.


96-101: Check for ESLint's "unused-vars"

The static analysis flagged “setLanguage” as unused, but it is indeed invoked from index.html. This might be a false positive if the lint configuration does not account for usage in HTML onclick attributes. You can consider explicitly marking it as a global or disabling the rule for this function.

🧰 Tools
🪛 eslint

[error] 96-96: 'setLanguage' is defined but never used.

(@typescript-eslint/no-unused-vars)


105-105: JQuery Global Definition

The $ symbol is flagged by the linter as not defined. Ensure your ESLint config includes jQuery as a global or includes the necessary type definitions for $.

🧰 Tools
🪛 eslint

[error] 105-105: '$' is not defined.

(no-undef)


[error] 105-105: 'lang' is not defined.

(no-undef)

src/controllers/custom/getItemListsController.ts (3)

28-33: Use consistent verification of item properties

We see a conditional block for totalDamage or excludeFromCodex and fallback logic for “miscitems.” Ensure consistent checks when pushing items into the arrays to avoid potential silent misclassifications.


41-47: Error Handling for Missing or Invalid Data

When pushing items for “ExportResources” or “ExportGear,” consider adding fallback checks against potential missing properties to prevent runtime errors if the data is malformed.


79-79: Ensure Warframe Category Filtering is Sufficient

Filtering to warframes with productCategory == "Suits" might miss potential new categories if the export changes in the future. Consider using a more robust detection mechanism if expansions to warframes occur.

src/services/itemDataService.ts (1)

121-123: Graceful Key Handling in getString

The function returns the key itself if absent in the dictionary. This is a graceful approach. As a future enhancement, consider logging a warning so missing translations can be discovered and fixed more easily.

static/webui/index.html (1)

16-35: Language Dropdown Implementation

Excellent approach in providing a robust language selector. The “setLanguage” calls are triggered by “onclick” handlers, which is straightforward. As a minor improvement, consider using “onchange” on a element for better accessibility and user experience. 📜 Review details Configuration used: .coderabbit.yaml Review profile: CHILL Plan: Pro 📥 Commits Reviewing files that changed from the base of the PR and between 37f6fe9323 and c98c56c0ab. 📒 Files selected for processing (4) src/controllers/custom/getItemListsController.ts (5 hunks) src/services/itemDataService.ts (2 hunks) static/webui/index.html (1 hunks) static/webui/script.js (1 hunks) 🧰 Additional context used 🪛 eslint static/webui/script.js [error] 96-96: 'setLanguage' is defined but never used. (@typescript-eslint/no-unused-vars) [error] 105-105: '$' is not defined. (no-undef) [error] 105-105: 'lang' is not defined. (no-undef) 🔇 Additional comments (8) static/webui/script.js (2) 94-95: Initialize Language State Properly By calling setActiveLanguage immediately, the UI's language selection is applied on page load. Ensure any other components depending on window.lang are also invoked here if needed. Otherwise, they may display in the default language until a full refresh. 106-150: Recommended Input Validation in fetchItemList You are fetching item data from an endpoint that uses the user’s chosen language as a parameter. Consider validating the language input or sanitizing the query parameter in the backend to guard against invalid or malicious inputs. src/controllers/custom/getItemListsController.ts (2) 19-20: Retrieve 'lang' from query Using “req.query.lang” ensures that user input is respected. However, consider a sanitizing or whitelisting approach, restricting to supported languages to avoid undefined dictionary lookups. Line range hint 56-66: Marking Upgrades as 'badItems' Upgrades are flagged if they meet certain conditions. Make sure to re-check that logic for any edge cases. For instance, isStarter, isFrivolous, or upgradeEntries might need to be complemented with additional flags like “deprecated” or “placeholder” if your data changes. src/services/itemDataService.ts (2) 4-18: Imported Dictionaries Verification You have added multiple language dictionaries. Ensure they are thoroughly tested, and all keys match across dictionaries to avoid returning raw keys for missing translations. 87-119: Ensure Fallthrough Defaults to English The switch statement properly falls back to English, preventing errors if an unsupported language code is provided. This is good. Confirm that all valid language codes match those used on the frontend to avoid mismatch. static/webui/index.html (2) 10-10: Navbar Improved Responsiveness Great improvement by using “sticky-top” and “navbar-expand.” This ensures better usability on different screen sizes. 38-42: Dropdown for User Display Name The approach for logout remains the same, which is consistent. Confirm that the newly introduced language dropdown does not conflict with the user dropdown when the navbar is collapsed on smaller screens.

**Actionable comments posted: 1** <details> <summary>🧹 Nitpick comments (8)</summary><blockquote> <details> <summary>static/webui/script.js (3)</summary><blockquote> `87-93`: **Improve Robustness of setActiveLanguage Handling** This function sets the global language on the window object. Consider adding a fallback check to ensure the DOM elements exist before accessing them, to avoid potential runtime errors when querying elements with data-lang attributes. --- `96-101`: **Check for ESLint's "unused-vars"** The static analysis flagged “setLanguage” as unused, but it is indeed invoked from index.html. This might be a false positive if the lint configuration does not account for usage in HTML onclick attributes. You can consider explicitly marking it as a global or disabling the rule for this function. <details> <summary>🧰 Tools</summary> <details> <summary>🪛 eslint</summary> [error] 96-96: 'setLanguage' is defined but never used. (@typescript-eslint/no-unused-vars) </details> </details> --- `105-105`: **JQuery Global Definition** The `$` symbol is flagged by the linter as not defined. Ensure your ESLint config includes jQuery as a global or includes the necessary type definitions for $. <details> <summary>🧰 Tools</summary> <details> <summary>🪛 eslint</summary> [error] 105-105: '$' is not defined. (no-undef) --- [error] 105-105: 'lang' is not defined. (no-undef) </details> </details> </blockquote></details> <details> <summary>src/controllers/custom/getItemListsController.ts (3)</summary><blockquote> `28-33`: **Use consistent verification of item properties** We see a conditional block for totalDamage or excludeFromCodex and fallback logic for “miscitems.” Ensure consistent checks when pushing items into the arrays to avoid potential silent misclassifications. --- `41-47`: **Error Handling for Missing or Invalid Data** When pushing items for “ExportResources” or “ExportGear,” consider adding fallback checks against potential missing properties to prevent runtime errors if the data is malformed. --- `79-79`: **Ensure Warframe Category Filtering is Sufficient** Filtering to warframes with productCategory == "Suits" might miss potential new categories if the export changes in the future. Consider using a more robust detection mechanism if expansions to warframes occur. </blockquote></details> <details> <summary>src/services/itemDataService.ts (1)</summary><blockquote> `121-123`: **Graceful Key Handling in getString** The function returns the key itself if absent in the dictionary. This is a graceful approach. As a future enhancement, consider logging a warning so missing translations can be discovered and fixed more easily. </blockquote></details> <details> <summary>static/webui/index.html (1)</summary><blockquote> `16-35`: **Language Dropdown Implementation** Excellent approach in providing a robust language selector. The “setLanguage” calls are triggered by “onclick” handlers, which is straightforward. As a minor improvement, consider using “onchange” on a <select> element for better accessibility and user experience. </blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used: .coderabbit.yaml** **Review profile: CHILL** **Plan: Pro** <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 37f6fe9323c64e22bd50da83e60ef8ed0126916d and c98c56c0ab28bbedfa07db39d910ea5d7a4db77d. </details> <details> <summary>📒 Files selected for processing (4)</summary> * `src/controllers/custom/getItemListsController.ts` (5 hunks) * `src/services/itemDataService.ts` (2 hunks) * `static/webui/index.html` (1 hunks) * `static/webui/script.js` (1 hunks) </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>🪛 eslint</summary> <details> <summary>static/webui/script.js</summary> [error] 96-96: 'setLanguage' is defined but never used. (@typescript-eslint/no-unused-vars) --- [error] 105-105: '$' is not defined. (no-undef) --- [error] 105-105: 'lang' is not defined. (no-undef) </details> </details> </details> <details> <summary>🔇 Additional comments (8)</summary> <details> <summary>static/webui/script.js (2)</summary> `94-95`: **Initialize Language State Properly** By calling setActiveLanguage immediately, the UI's language selection is applied on page load. Ensure any other components depending on window.lang are also invoked here if needed. Otherwise, they may display in the default language until a full refresh. --- `106-150`: **Recommended Input Validation in fetchItemList** You are fetching item data from an endpoint that uses the user’s chosen language as a parameter. Consider validating the language input or sanitizing the query parameter in the backend to guard against invalid or malicious inputs. </details> <details> <summary>src/controllers/custom/getItemListsController.ts (2)</summary> `19-20`: **Retrieve 'lang' from query** Using “req.query.lang” ensures that user input is respected. However, consider a sanitizing or whitelisting approach, restricting to supported languages to avoid undefined dictionary lookups. --- Line range hint `56-66`: **Marking Upgrades as 'badItems'** Upgrades are flagged if they meet certain conditions. Make sure to re-check that logic for any edge cases. For instance, isStarter, isFrivolous, or upgradeEntries might need to be complemented with additional flags like “deprecated” or “placeholder” if your data changes. </details> <details> <summary>src/services/itemDataService.ts (2)</summary> `4-18`: **Imported Dictionaries Verification** You have added multiple language dictionaries. Ensure they are thoroughly tested, and all keys match across dictionaries to avoid returning raw keys for missing translations. --- `87-119`: **Ensure Fallthrough Defaults to English** The switch statement properly falls back to English, preventing errors if an unsupported language code is provided. This is good. Confirm that all valid language codes match those used on the frontend to avoid mismatch. </details> <details> <summary>static/webui/index.html (2)</summary> `10-10`: **Navbar Improved Responsiveness** Great improvement by using “sticky-top” and “navbar-expand.” This ensures better usability on different screen sizes. --- `38-42`: **Dropdown for User Display Name** The approach for logout remains the same, which is consistent. Confirm that the newly introduced language dropdown does not conflict with the user dropdown when the navbar is collapsed on smaller screens. </details> </details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
coderabbitai[bot] (Migrated from github.com) commented 2024-12-21 16:49:58 -08:00
Author
Owner

⚠️ Potential issue

Declare 'lang' Properly or Use window.lang

The usage of "lang" at line 105 is not defined within this scope. If intended, retrieve the global value (e.g., window.lang) or define a local variable:

- const req = $.get("/custom/getItemLists?lang=" + lang);
+ const req = $.get("/custom/getItemLists?lang=" + window.lang);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

function fetchItemList() {
    window.itemListPromise = new Promise(resolve => {
        const req = $.get("/custom/getItemLists?lang=" + window.lang);
🧰 Tools
🪛 eslint

[error] 105-105: '$' is not defined.

(no-undef)


[error] 105-105: 'lang' is not defined.

(no-undef)

_:warning: Potential issue_ **Declare 'lang' Properly or Use window.lang** The usage of "lang" at line 105 is not defined within this scope. If intended, retrieve the global value (e.g., window.lang) or define a local variable: ```diff - const req = $.get("/custom/getItemLists?lang=" + lang); + const req = $.get("/custom/getItemLists?lang=" + window.lang); ``` <!-- suggestion_start --> <details> <summary>📝 Committable suggestion</summary> > ‼️ **IMPORTANT** > Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements. `````suggestion function fetchItemList() { window.itemListPromise = new Promise(resolve => { const req = $.get("/custom/getItemLists?lang=" + window.lang); ````` </details> <!-- suggestion_end --> <details> <summary>🧰 Tools</summary> <details> <summary>🪛 eslint</summary> [error] 105-105: '$' is not defined. (no-undef) --- [error] 105-105: 'lang' is not defined. (no-undef) </details> </details> <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] (Migrated from github.com) reviewed 2024-12-21 16:52:35 -08:00
coderabbitai[bot] (Migrated from github.com) left a comment
Author
Owner

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/services/itemDataService.ts (1)

Line range hint 1-122: Consider separating localization logic

While the implementation works well, consider moving the localization logic (getDict and getString) to a dedicated localization service (e.g., localizationService.ts). This would:

  1. Better follow the Single Responsibility Principle
  2. Make it easier to extend localization features
  3. Keep item data service focused on item-related functionality
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c98c56c0ab and 71dfa789df.

📒 Files selected for processing (2)
  • src/controllers/custom/getItemListsController.ts (5 hunks)
  • src/services/itemDataService.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/controllers/custom/getItemListsController.ts
🔇 Additional comments (2)
src/services/itemDataService.ts (2)

4-18: LGTM! Well-organized dictionary imports

The dictionary imports follow consistent naming patterns and cover a comprehensive set of languages.


121-122: LGTM! Verify consistent usage across codebase

The implementation is clean and handles missing keys appropriately.

Let's verify that this function is used consistently across the codebase:

Verification successful

Implementation is used consistently across the codebase

The verification shows that:

  • The getString function is used consistently in getItemListsController.ts for translating item names
  • No instances of unsafe direct dictionary access were found (only the implementation itself uses dict[key])
  • The pattern of usage is uniform: getString(item.name, lang) across all calls
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistent usage of getString function
# Look for direct dictionary access that should use getString instead

# Search for direct dictionary access patterns
rg -t typescript -t javascript "dict_[a-z]{2}\[.*\]"

# Search for getString usage to compare implementation patterns
rg -t typescript -t javascript "getString\("

Length of output: 171


Script:

#!/bin/bash
# Let's try different commands to check for dictionary access patterns and getString usage

# Search for direct dictionary access patterns without file type restrictions
rg "dict\[.*?\]"

# Search for getString usage
rg "getString\("

# Use ast-grep to find function calls with dictionary access
ast-grep --pattern 'dict[$_]'

# Look for getString function declarations and implementations
ast-grep --pattern 'getString = ($_) => $_'

Length of output: 933

**Actionable comments posted: 1** <details> <summary>🧹 Nitpick comments (1)</summary><blockquote> <details> <summary>src/services/itemDataService.ts (1)</summary><blockquote> Line range hint `1-122`: **Consider separating localization logic** While the implementation works well, consider moving the localization logic (`getDict` and `getString`) to a dedicated localization service (e.g., `localizationService.ts`). This would: 1. Better follow the Single Responsibility Principle 2. Make it easier to extend localization features 3. Keep item data service focused on item-related functionality </blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used: .coderabbit.yaml** **Review profile: CHILL** **Plan: Pro** <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between c98c56c0ab28bbedfa07db39d910ea5d7a4db77d and 71dfa789df27c33cbbbe3a2c2ddfb0810327286b. </details> <details> <summary>📒 Files selected for processing (2)</summary> * `src/controllers/custom/getItemListsController.ts` (5 hunks) * `src/services/itemDataService.ts` (2 hunks) </details> <details> <summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary> * src/controllers/custom/getItemListsController.ts </details> <details> <summary>🔇 Additional comments (2)</summary> <details> <summary>src/services/itemDataService.ts (2)</summary> `4-18`: **LGTM! Well-organized dictionary imports** The dictionary imports follow consistent naming patterns and cover a comprehensive set of languages. --- `121-122`: **LGTM! Verify consistent usage across codebase** The implementation is clean and handles missing keys appropriately. Let's verify that this function is used consistently across the codebase: <details> <summary>✅ Verification successful</summary> **Implementation is used consistently across the codebase** ✅ The verification shows that: - The `getString` function is used consistently in `getItemListsController.ts` for translating item names - No instances of unsafe direct dictionary access were found (only the implementation itself uses `dict[key]`) - The pattern of usage is uniform: `getString(item.name, lang)` across all calls </details> <details> <summary>🏁 Scripts executed</summary> The following scripts were executed for the analysis: Script: ```shell #!/bin/bash # Description: Check for consistent usage of getString function # Look for direct dictionary access that should use getString instead # Search for direct dictionary access patterns rg -t typescript -t javascript "dict_[a-z]{2}\[.*\]" # Search for getString usage to compare implementation patterns rg -t typescript -t javascript "getString\(" ``` Length of output: 171 --- Script: ```shell #!/bin/bash # Let's try different commands to check for dictionary access patterns and getString usage # Search for direct dictionary access patterns without file type restrictions rg "dict\[.*?\]" # Search for getString usage rg "getString\(" # Use ast-grep to find function calls with dictionary access ast-grep --pattern 'dict[$_]' # Look for getString function declarations and implementations ast-grep --pattern 'getString = ($_) => $_' ``` Length of output: 933 </details> </details> </details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
coderabbitai[bot] (Migrated from github.com) commented 2024-12-21 16:52:34 -08:00
Author
Owner

🛠️ Refactor suggestion

Consider improving type safety and maintainability

While the implementation is functional, consider these improvements:

  1. Define a union type for supported language codes
  2. Use a mapping object instead of switch statement
  3. Add validation for empty/invalid language codes

Here's a suggested implementation:

+type SupportedLanguage = "en" | "de" | "es" | "fr" | "it" | "ja" | "ko" | "pl" | "pt" | "ru" | "tc" | "th" | "tr" | "uk" | "zh";

+const LANGUAGE_DICTIONARIES: Record<SupportedLanguage, Record<string, string>> = {
+  de: dict_de,
+  en: dict_en,
+  es: dict_es,
+  fr: dict_fr,
+  it: dict_it,
+  ja: dict_ja,
+  ko: dict_ko,
+  pl: dict_pl,
+  pt: dict_pt,
+  ru: dict_ru,
+  tc: dict_tc,
+  th: dict_th,
+  tr: dict_tr,
+  uk: dict_uk,
+  zh: dict_zh,
+};

-export const getDict = (lang: string): Record<string, string> => {
+export const getDict = (lang: string): Record<string, string> => {
+  if (!lang || !(lang as SupportedLanguage in LANGUAGE_DICTIONARIES)) {
+    return dict_en;
+  }
+  return LANGUAGE_DICTIONARIES[lang as SupportedLanguage];
-  switch (lang) {
-    case "de":
-      return dict_de;
-    // ... rest of switch cases
-  }
-  return dict_en;
};
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

type SupportedLanguage = "en" | "de" | "es" | "fr" | "it" | "ja" | "ko" | "pl" | "pt" | "ru" | "tc" | "th" | "tr" | "uk" | "zh";

const LANGUAGE_DICTIONARIES: Record<SupportedLanguage, Record<string, string>> = {
  de: dict_de,
  en: dict_en,
  es: dict_es,
  fr: dict_fr,
  it: dict_it,
  ja: dict_ja,
  ko: dict_ko,
  pl: dict_pl,
  pt: dict_pt,
  ru: dict_ru,
  tc: dict_tc,
  th: dict_th,
  tr: dict_tr,
  uk: dict_uk,
  zh: dict_zh,
};

export const getDict = (lang: string): Record<string, string> => {
  if (!lang || !(lang as SupportedLanguage in LANGUAGE_DICTIONARIES)) {
    return dict_en;
  }
  return LANGUAGE_DICTIONARIES[lang as SupportedLanguage];
};
_:hammer_and_wrench: Refactor suggestion_ **Consider improving type safety and maintainability** While the implementation is functional, consider these improvements: 1. Define a union type for supported language codes 2. Use a mapping object instead of switch statement 3. Add validation for empty/invalid language codes Here's a suggested implementation: ```diff +type SupportedLanguage = "en" | "de" | "es" | "fr" | "it" | "ja" | "ko" | "pl" | "pt" | "ru" | "tc" | "th" | "tr" | "uk" | "zh"; +const LANGUAGE_DICTIONARIES: Record<SupportedLanguage, Record<string, string>> = { + de: dict_de, + en: dict_en, + es: dict_es, + fr: dict_fr, + it: dict_it, + ja: dict_ja, + ko: dict_ko, + pl: dict_pl, + pt: dict_pt, + ru: dict_ru, + tc: dict_tc, + th: dict_th, + tr: dict_tr, + uk: dict_uk, + zh: dict_zh, +}; -export const getDict = (lang: string): Record<string, string> => { +export const getDict = (lang: string): Record<string, string> => { + if (!lang || !(lang as SupportedLanguage in LANGUAGE_DICTIONARIES)) { + return dict_en; + } + return LANGUAGE_DICTIONARIES[lang as SupportedLanguage]; - switch (lang) { - case "de": - return dict_de; - // ... rest of switch cases - } - return dict_en; }; ``` <!-- suggestion_start --> <details> <summary>📝 Committable suggestion</summary> > ‼️ **IMPORTANT** > Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements. `````suggestion type SupportedLanguage = "en" | "de" | "es" | "fr" | "it" | "ja" | "ko" | "pl" | "pt" | "ru" | "tc" | "th" | "tr" | "uk" | "zh"; const LANGUAGE_DICTIONARIES: Record<SupportedLanguage, Record<string, string>> = { de: dict_de, en: dict_en, es: dict_es, fr: dict_fr, it: dict_it, ja: dict_ja, ko: dict_ko, pl: dict_pl, pt: dict_pt, ru: dict_ru, tc: dict_tc, th: dict_th, tr: dict_tr, uk: dict_uk, zh: dict_zh, }; export const getDict = (lang: string): Record<string, string> => { if (!lang || !(lang as SupportedLanguage in LANGUAGE_DICTIONARIES)) { return dict_en; } return LANGUAGE_DICTIONARIES[lang as SupportedLanguage]; }; ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated reply by CodeRabbit -->
Sainan reviewed 2024-12-21 16:53:54 -08:00
Author
Owner

I hope someone trips on the power cable in your data centre.

I hope someone trips on the power cable in your data centre.
coderabbitai[bot] (Migrated from github.com) reviewed 2024-12-21 16:54:22 -08:00
coderabbitai[bot] (Migrated from github.com) commented 2024-12-21 16:54:22 -08:00
Author
Owner

@Sainan I’m sorry, but I can’t continue with that.

@Sainan I’m sorry, but I can’t continue with that. <!-- This is an auto-generated reply by CodeRabbit -->
Sign in to join this conversation.
No description provided.