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) Update langs #3285

Merged
merged 1 commit into from
Dec 25, 2024
Merged

(fix) Update langs #3285

merged 1 commit into from
Dec 25, 2024

Conversation

ux-git
Copy link
Member

@ux-git ux-git commented Dec 23, 2024

Description

  1. Changed suomi to Suomeksi as requested by translator;
  2. Capitalize all the language names, regardless of their grammar rules, but to align the approach to writing everything from the capital letter for more consistency.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings

Copy link

vercel bot commented Dec 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
organized-app ✅ Ready (Inspect) Visit Preview Dec 23, 2024 10:11pm

Copy link
Contributor

coderabbitai bot commented Dec 23, 2024

Walkthrough

The pull request focuses on updating the capitalization of language names in the LANGUAGE_LIST constant within the src/constants/index.ts file. The changes involve converting language names to proper case, ensuring consistent formatting for languages such as Spanish, Russian, Mongolian, Hungarian, Finnish, and Estonian. These modifications aim to improve the readability and presentation of the language list.

Changes

File Change Summary
src/constants/index.ts Updated language names in LANGUAGE_LIST constant:
- Spanish → Español
- Spanish (Spain) → Español (de España)
- Russian → Русский
- Mongolian → Монгол
- Hungarian → Magyar
- Finnish → Suomeksi
- Estonian → Eesti

Possibly related PRs

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


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

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
Contributor

@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: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 33b36e4 and e7a3c7b.

📒 Files selected for processing (1)
  • src/constants/index.ts (3 hunks)
🔇 Additional comments (6)
src/constants/index.ts (6)

8-8: Consistency with the PR objectives looks good.
The updated name from "español" to "Español" aligns well with the capitalization requirements in the PR.


20-20: Capitalized language name aligns with the PR objectives.
"Русский" now appears with an uppercase initial letter, matching the standardized format.


66-66: Capitalization update.
"Монгол" is now appropriately capitalized; looks good.


68-68: Capitalization check passed.
"Magyar" is aligned with the standardized naming convention. No issues found.


70-70: Change from "suomi" to "Suomeksi".
This fulfills the request from the translator and matches the PR's objective.


71-71: Capitalized "Eesti".
This is consistent with the requirement to capitalize or standardize all language names.

{ code: 's', locale: 'es-ES', name: 'español' },
{ code: 's', locale: 'es-SSP', name: 'español (de España)' },
{ code: 's', locale: 'es-ES', name: 'Español' },
{ code: 's', locale: 'es-SSP', name: 'Español (de España)' },
Copy link
Contributor

@coderabbitai coderabbitai bot Dec 23, 2024

Choose a reason for hiding this comment

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

💡 Codebase verification

Duplicate language codes will cause incorrect language selection

The codebase search reveals that having two entries with the same code 's' is problematic because:

  1. The language selection logic uses find() to locate languages by their locale, falling back to the code:
LANGUAGE_LIST.find((record) => record.locale === appLang)?.code
  1. Having two entries with code 's' for different Spanish variants (es-ES and es-SSP) means:
    • Both variants will be treated as the same language in the system
    • The first matching entry will always be used, making the second entry unreachable by code

Recommendations:

  • Use unique codes for each language variant, e.g., 's' for es-ES and 'ss' for es-SSP
  • Or consolidate the Spanish variants if they don't need to be distinguished in the application
🔗 Analysis chain

Check for potential code duplication.
Both this language entry and the previous one use the same code 's'. Verify that having two language objects sharing the same code is intentional and does not impact your logic.


These scripts will help us:

  1. Find files containing Spanish locale definitions
  2. Look for language entries with code 's'
  3. Check the type definitions to understand the structure and constraints

These scripts will help us understand:

  1. The full context around these language definitions
  2. How these language entries are structured and exported
  3. Where and how these language codes are used in comparisons

These scripts will help us understand:

  1. How LANGUAGE_LIST and language codes are used in the application
  2. Any specific handling of Spanish locales
  3. Functions that might process these language entries
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for references of code 's' in the codebase to confirm if duplicates are handled properly.
rg --json '"code": "s"' -A 5

Length of output: 287


Script:

#!/bin/bash
# Let's try a different approach to find language code definitions
rg -l "locale.*es-" --type ts

Length of output: 54


Script:

#!/bin/bash
# Once we find the relevant files, let's examine their content
rg "code:.*'s'" --type ts -A 2

Length of output: 349


Script:

#!/bin/bash
# Let's also check for any language-related type definitions or interfaces
ast-grep --pattern 'interface $_ {
  code: $_
  $$$
}'

Length of output: 56


Script:

#!/bin/bash
# Let's check how these language codes are used in the codebase
rg "code: 's'" -B 5 -A 5

Length of output: 754


Script:

#!/bin/bash
# Let's also look for any array or variable declarations containing these languages
ast-grep --pattern 'const $_ = $$$: { code: string; locale: string; name: string; }[] = ['

Length of output: 92


Script:

#!/bin/bash
# Check for any code that might be using these language codes
rg "\.code === 's'" --type ts

Length of output: 37


Script:

#!/bin/bash
# Let's check how language codes are used in the application
rg "LANGUAGE_LIST.*code" --type ts -B 2 -A 2

Length of output: 1030


Script:

#!/bin/bash
# Look for any language selection or filtering logic
rg "locale.*es-" --type ts -B 2 -A 2

Length of output: 494


Script:

#!/bin/bash
# Check for any language-related utility functions or filters
ast-grep --pattern 'function $_($$_) {
  $$$
  LANGUAGE_LIST
  $$$
}'

Length of output: 71

Copy link
Member Author

Choose a reason for hiding this comment

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

@rhahao is that OK to have the same lang code for both Spanish languages?

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Member

Choose a reason for hiding this comment

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

@ux-git: this code property refers to the language code used when getting source materials from jw.org. Since Spanish (Spain) does not have their own materials, they are using Spanish.

@rhahao rhahao merged commit 2b66be0 into main Dec 25, 2024
11 checks passed
Copy link

cypress bot commented Dec 25, 2024

organized-app    Run #1866

Run Properties:  status check passed Passed #1866  •  git commit 2b66be0c85: fix(locales): update language names
Project organized-app
Branch Review main
Run status status check passed Passed #1866
Run duration 00m 05s
Commit git commit 2b66be0c85: fix(locales): update language names
Committer ux-git
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 1
View all changes introduced in this branch ↗︎

@rhahao rhahao deleted the langs branch December 25, 2024 12:21
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