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

fix: hide other language #11455

Merged
merged 6 commits into from
Mar 6, 2025
Merged

fix: hide other language #11455

merged 6 commits into from
Mar 6, 2025

Conversation

Jarsen136
Copy link
Contributor

@Jarsen136 Jarsen136 commented Mar 4, 2025

Thank you for your contribution to the Koda - Generative Art Marketplace.

👇 __ Let's make a quick check before the contribution.

PR Type

  • Bugfix

Needs Design check

Needs QA check

  • @kodadot/qa-guild please review

Context

Screenshot 📸

  • My fix has changed something on UI; a screenshot is best to understand changes for others.
image image

Summary by CodeRabbit

  • Refactor
    • Removed language selection features from mobile navigation, wallet, and profile menus to streamline the interface.
    • Enforced a fixed English locale across the application.
  • Bug Fixes
    • Eliminated potential confusion by removing unused language components and functionality.
  • Tests
    • Removed end-to-end tests related to language selection.
  • Chores
    • Cleaned up unused language management code and associated dependencies.

@Jarsen136 Jarsen136 requested a review from a team as a code owner March 4, 2025 22:10
@Jarsen136 Jarsen136 requested review from preschian and hassnian and removed request for a team March 4, 2025 22:10
Copy link

coderabbitai bot commented Mar 4, 2025

Walkthrough

This pull request removes the dynamic language selection functionality throughout the application. The changes include the removal of language selection components and related event handlers in the navigation, wallet asset menu, and profile dropdown. The dedicated language management store has been deleted, and the locale-setting method in the preferences store now forces a fixed English locale. Additionally, end-to-end tests for language switching have been removed.

Changes

File(s) Change Summary
components/Navbar.vue
components/common/ConnectWallet/WalletAssetMenu.vue
components/navbar/ProfileDropdown.vue
Removed language selection UI elements, associated event handlers, and cleaned up import statements for language-related components.
stores/lang.ts Deleted the Pinia store for language management (useLangStore).
stores/preferences.ts Removed userLocale property, langsFlags constant, getUserLocale getter, and setUserLocale method, eliminating locale management functionality.
tests/e2e/language.spec.ts Removed end-to-end tests that verified language switching and translation functionalities.
components/navbar/MobileLanguageOption.vue Deleted the component responsible for rendering mobile language options.
i18n/locales/*.json Deleted multiple localization files for various languages (e.g., bn.json, cn.json, cz.json, de.json, es.json, fr.json, etc.), removing all translations for those languages.
plugins/i18n.ts Modified the locale setting to statically set the locale to 'en', removing dynamic locale assignment based on user preferences.

Sequence Diagram(s)

sequenceDiagram
  participant U as User
  participant C as Component
  participant P as Preferences Store
  participant I as $i18n

  U->>C: Initiate locale change (previously via language UI)
  C->>P: Call setUserLocale(userLang)
  P->>P: Override userLang to "en"
  P->>I: Set $i18n.locale.value to "en"
  P->>P: Update state.userLocale to "en"
Loading

Suggested reviewers

  • preschian
  • vikiival

Poem

I hopped through lines of code today,
Trimming language paths along my way.
No dropdown hops or looping spree,
"En" is the only choice for me!
With whiskers twitching, I celebrate anew –
A clearer path for bugs to bid adieu.
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between c8d6a05 and 1781faa.

📒 Files selected for processing (28)
  • components/Navbar.vue (0 hunks)
  • components/common/ConnectWallet/WalletAssetMenu.vue (1 hunks)
  • components/navbar/MobileLanguageOption.vue (0 hunks)
  • components/navbar/ProfileDropdown.vue (1 hunks)
  • i18n/locales/all_lang.json (1 hunks)
  • i18n/locales/bn.json (0 hunks)
  • i18n/locales/cn.json (0 hunks)
  • i18n/locales/cz.json (0 hunks)
  • i18n/locales/de.json (0 hunks)
  • i18n/locales/es.json (0 hunks)
  • i18n/locales/fr.json (0 hunks)
  • i18n/locales/id.json (0 hunks)
  • i18n/locales/it.json (0 hunks)
  • i18n/locales/jp.json (0 hunks)
  • i18n/locales/ko.json (0 hunks)
  • i18n/locales/nl.json (0 hunks)
  • i18n/locales/pl.json (0 hunks)
  • i18n/locales/pt.json (0 hunks)
  • i18n/locales/ru.json (0 hunks)
  • i18n/locales/sk.json (0 hunks)
  • i18n/locales/tu.json (0 hunks)
  • i18n/locales/ua.json (0 hunks)
  • i18n/locales/ur.json (0 hunks)
  • i18n/locales/vt.json (0 hunks)
  • plugins/i18n.ts (1 hunks)
  • stores/lang.ts (0 hunks)
  • stores/preferences.ts (0 hunks)
  • tests/e2e/language.spec.ts (0 hunks)
💤 Files with no reviewable changes (24)
  • i18n/locales/ur.json
  • components/Navbar.vue
  • i18n/locales/ko.json
  • i18n/locales/vt.json
  • i18n/locales/it.json
  • i18n/locales/tu.json
  • i18n/locales/cn.json
  • i18n/locales/ua.json
  • i18n/locales/fr.json
  • i18n/locales/bn.json
  • i18n/locales/es.json
  • i18n/locales/cz.json
  • i18n/locales/id.json
  • i18n/locales/pl.json
  • stores/lang.ts
  • i18n/locales/pt.json
  • i18n/locales/jp.json
  • i18n/locales/nl.json
  • i18n/locales/sk.json
  • stores/preferences.ts
  • i18n/locales/de.json
  • components/navbar/MobileLanguageOption.vue
  • i18n/locales/ru.json
  • tests/e2e/language.spec.ts
✅ Files skipped from review due to trivial changes (1)
  • i18n/locales/all_lang.json

🪧 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 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

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.

Copy link

netlify bot commented Mar 4, 2025

Deploy Preview for koda-canary ready!

Name Link
🔨 Latest commit 1781faa
🔍 Latest deploy log https://app.netlify.com/sites/koda-canary/deploys/67c975aabc312900080700d8
😎 Deploy Preview https://deploy-preview-11455--koda-canary.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Jarsen136 Jarsen136 enabled auto-merge March 4, 2025 22:11
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.

Actionable comments posted: 0

🧹 Nitpick comments (3)
stores/preferences.ts (1)

46-72: Consider removing unused language definitions

The langsFlags array is still present even though language selection has been disabled. Since the application now only supports English, this array is no longer being used for its original purpose.

Consider removing or deprecating this array to avoid confusion and maintain code cleanliness:

-export const langsFlags = [
-  {
-    value: 'en',
-    flag: '🇬🇧',
-    label: 'English',
-  },
-  {
-    value: 'de',
-    flag: '🇩🇪',
-    label: 'Deutsch',
-  },
-  {
-    value: 'es',
-    flag: '🇪🇸',
-    label: 'Español',
-  },
-  {
-    value: 'fr',
-    flag: '🇫🇷',
-    label: 'Français',
-  },
-  {
-    value: 'hi',
-    flag: '🇮🇳',
-    label: 'हिंदी',
-  },
-]

If there's a future plan to re-enable multi-language support, you might want to add a TODO comment instead.

components/common/ConnectWallet/WalletAssetMenu.vue (2)

96-98: Remove unused language selector CSS

The CSS for the language selector still exists even though the component has been removed from the template.

Remove the unused CSS for better code maintainability:

.wallet-asset-footer {
  border-top: 1px solid grey;
  justify-content: space-between;

  @apply bulma-mobile:justify-center;

-  .language-selector {
-    @apply bulma-mobile:my-8 bulma-mobile:mx-0;
-  }

  & > * {
    @apply cursor-pointer flex gap-1;

    &:hover {
      @apply text-text-color;
    }
  }

109-111: Remove unnecessary dropdown styling

The deep selector style for dropdown menu is likely related to the removed language selector and may no longer be needed.

Consider removing this CSS rule if it was specifically for positioning the language dropdown:

-  /* manually center dropdown menu, because no props "position" to center it */
-  :deep(.o-drop__menu) {
-    @apply bulma-tablet:translate-x-[50px]
-  }

Verify this doesn't affect other dropdowns before removing.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c8d6a05 and 245f4a5.

📒 Files selected for processing (6)
  • components/Navbar.vue (0 hunks)
  • components/common/ConnectWallet/WalletAssetMenu.vue (1 hunks)
  • components/navbar/ProfileDropdown.vue (1 hunks)
  • stores/lang.ts (0 hunks)
  • stores/preferences.ts (1 hunks)
  • tests/e2e/language.spec.ts (0 hunks)
💤 Files with no reviewable changes (3)
  • components/Navbar.vue
  • tests/e2e/language.spec.ts
  • stores/lang.ts
⏰ Context from checks skipped due to timeout of 90000ms (16)
  • GitHub Check: Redirect rules
  • GitHub Check: Header rules
  • GitHub Check: Pages changed
  • GitHub Check: shard (10, 10)
  • GitHub Check: shard (3, 10)
  • GitHub Check: build-cf
  • GitHub Check: runner / eslint
  • GitHub Check: shard (9, 10)
  • GitHub Check: shard (6, 10)
  • GitHub Check: shard (8, 10)
  • GitHub Check: shard (4, 10)
  • GitHub Check: shard (7, 10)
  • GitHub Check: shard (5, 10)
  • GitHub Check: shard (1, 10)
  • GitHub Check: build
  • GitHub Check: shard (2, 10)
🔇 Additional comments (4)
stores/preferences.ts (1)

271-272: Language selection locked to English

The modifications to the setUserLocale method now force the locale to 'en' (English) regardless of what the user selects, effectively disabling multi-language support across the application.

This change aligns with the PR objective to "fix: hide other language" and ensures consistency throughout the codebase by removing the language selection feature.

components/common/ConnectWallet/WalletAssetMenu.vue (1)

43-43: Import cleanup for removed language selector

The import statement has been updated to only include NeoIcon, removing unused imports for the removed language selection dropdown.

components/navbar/ProfileDropdown.vue (2)

55-55: Import cleanup for removed language icon

The import statement has been updated to remove NeoIcon since it was previously used for the language selector that has now been removed.


1-80:

❓ Verification inconclusive

Verify user profile dropdown functionality

The language selector functionality has been removed from the profile dropdown. Ensure that all remaining dropdown functionality (color mode switcher and cookies settings) continues to work as expected.


🏁 Script executed:

#!/bin/bash
# Description: Check if there are any remaining language selection related code in other components

# Look for any remaining language selection related code
echo "Checking for any remaining language selection UI components:"
rg -i "language(.*)selector" --type vue

# Check for any remaining language icon references
echo "Checking for any remaining language icon references:"
rg -i "globe(.*)icon" --type vue

# Check for any remaining language selection related methods
echo "Checking for any remaining language toggle methods:"
rg -i "toggle(.*)language" --type vue

echo "Checking for language selection in navbar components:"
rg -i "language" components/navbar/

Length of output: 712


Below is a new shell script to re-run the verification using a file glob instead of the unrecognized Vue file type. This should help confirm that no language selection-related references remain in the code:

#!/bin/bash
echo "Checking for any remaining language selection UI components in .vue files:"
rg -i "language(.*)selector" -g "*.vue"

echo "Checking for any remaining language icon references in .vue files:"
rg -i "globe(.*)icon" -g "*.vue"

echo "Checking for any remaining language selection related methods in .vue files:"
rg -i "toggle(.*)language" -g "*.vue"

echo "Checking for language selection within navbar components in .vue files:"
rg -i "language" -g "*.vue" components/navbar/

Dropdown Functionality Verification: Language Selection Removal Confirmed

  • Confirm that no language selector code remains in any Vue component.
  • Verify manually that the remaining dropdown items—the Color Mode switcher and the Cookies settings button—are functioning as expected.

@hassnian
Copy link
Contributor

hassnian commented Mar 5, 2025

shouldn't we also remove the other translation files ?

@Jarsen136
Copy link
Contributor Author

shouldn't we also remove the other translation files ?

It's doable to delete the other translation files, but we may need them in the future. wdyt

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.

Actionable comments posted: 0

🧹 Nitpick comments (2)
stores/preferences.ts (2)

269-275: Use more descriptive unused parameter name and consider refactoring for clarity.

The parameter has been renamed from locale: string to _: string to indicate it's unused, which is a good practice. However, a more descriptive name like _locale: string would better preserve the semantic meaning while still indicating it's unused.

Consider applying these changes for improved clarity:

-    setUserLocale(_: string) {
+    setUserLocale(_locale: string) {
      const { $i18n } = useNuxtApp()
      // only supports en for now
      const locale = 'en'
      $i18n.locale.value = locale
      this.userLocale = locale
    },

Additionally, since this appears to be a temporary solution based on the comment "only supports en for now", it might be helpful to add a more explicit TODO comment if there are plans to restore multi-language support in the future.


46-72: Consider removing unused language configuration.

The langsFlags array is still present in the code, even though the language selection functionality has been removed from the application as indicated in the PR summary. This could be confusing for future developers and might lead to inconsistent behavior if language selection is partially restored.

If other languages are no longer supported, consider removing this array entirely or adding a clear comment explaining why it's being preserved:

-export const langsFlags = [
-  {
-    value: 'en',
-    flag: '🇬🇧',
-    label: 'English',
-  },
-  {
-    value: 'de',
-    flag: '🇩🇪',
-    label: 'Deutsch',
-  },
-  {
-    value: 'es',
-    flag: '🇪🇸',
-    label: 'Español',
-  },
-  {
-    value: 'fr',
-    flag: '🇫🇷',
-    label: 'Français',
-  },
-  {
-    value: 'hi',
-    flag: '🇮🇳',
-    label: 'हिंदी',
-  },
-]
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1195726 and 709301b.

📒 Files selected for processing (1)
  • stores/preferences.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (15)
  • GitHub Check: Redirect rules
  • GitHub Check: Header rules
  • GitHub Check: Pages changed
  • GitHub Check: shard (6, 10)
  • GitHub Check: shard (8, 10)
  • GitHub Check: shard (7, 10)
  • GitHub Check: shard (10, 10)
  • GitHub Check: shard (9, 10)
  • GitHub Check: build-cf
  • GitHub Check: shard (4, 10)
  • GitHub Check: build
  • GitHub Check: shard (5, 10)
  • GitHub Check: shard (1, 10)
  • GitHub Check: shard (2, 10)
  • GitHub Check: shard (3, 10)
🔇 Additional comments (2)
stores/preferences.ts (2)

273-274: Implementation matches the suggested fix from the previous review.

The implementation of setting both $i18n.locale.value and this.userLocale to the same value matches the suggestion from Sonar mentioned in the previous review.


272-274:

❓ Verification inconclusive

Verify all translation-related files have been properly addressed.

As mentioned in the PR comments, there was a question about "removal of other translation files." This change only affects the runtime behavior by forcing the English locale, but doesn't address the existence of other translation files in the repository that might no longer be used.


🏁 Script executed:

#!/bin/bash
# Description: Look for potentially unused translation files in the repository

# Find locale/translation files with two-letter language codes
echo "Searching for translation files..."
fd -e json 'en\.json|de\.json|fr\.json|es\.json|hi\.json' --type f

# Look for imports of i18n or translation-related code
echo "Checking for i18n imports across the codebase..."
rg 'import.*i18n' -l

# Look for uses of translation functions in the codebase
echo "Checking for translation function usage..."
rg '\$t\(' -l

Length of output: 12500


Translation Files Status Review

The changes in stores/preferences.ts now force the runtime locale to English, but our investigation confirms that multiple translation files (e.g., i18n/locales/en.json, i18n/locales/de.json, i18n/locales/es.json, i18n/locales/fr.json, i18n/locales/hi.json) are still present and that translation function calls (e.g., $t() remain in widespread use across many components.

  • The forced locale change affects runtime behavior only.
  • Translation files for various languages are still part of the repository.
  • Numerous components continue to rely on translation functions.

Action: Please confirm whether the retention of these translation files is intentional or if a cleanup/removal process should be initiated in a subsequent change.

@hassnian
Copy link
Contributor

hassnian commented Mar 6, 2025

shouldn't we also remove the other translation files ?

It's doable to delete the other translation files, but we may need them in the future. wdyt

I'd delete them we can always go back to this pr and recover them, @preschian wdyt

@preschian
Copy link
Member

shouldn't we also remove the other translation files ?

It's doable to delete the other translation files, but we may need them in the future. wdyt

I'd delete them we can always go back to this pr and recover them, @preschian wdyt

Oh, this one is okay for me. We can revert it once we need to in the future

Copy link

sonarqubecloud bot commented Mar 6, 2025

@Jarsen136
Copy link
Contributor Author

Updated

@Jarsen136 Jarsen136 added this pull request to the merge queue Mar 6, 2025
Merged via the queue into kodadot:main with commit 51d0c16 Mar 6, 2025
27 checks passed
@Jarsen136 Jarsen136 deleted the issue-11454 branch March 6, 2025 11:38
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.

Other languages on Koda
3 participants