-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: adapt to the japanese languange #1311
base: dev
Are you sure you want to change the base?
Conversation
📝 Walkthrough📝 WalkthroughWalkthroughThe pull request introduces several changes to enhance localization support for the Japanese language in the application. The Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant App
participant LocaleService
User->>App: Select Japanese language
App->>LocaleService: Request translations for "ja"
LocaleService-->>App: Provide translations
App-->>User: Display content in Japanese
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
✅ Deploy Preview for staging-dacade ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Outside diff range and nitpick comments (1)
next-i18next.config.js (1)
Line range hint
1-11
: Consider adding JSDoc comments for configurationWhile the configuration is working, it would be helpful to add JSDoc comments explaining the purpose of each configuration option and any specific requirements for adding new locales.
Add documentation like this:
// eslint-disable-next-line @typescript-eslint/no-var-requires const path = require("path"); +/** + * next-i18next configuration + * @see https://next.i18next.com/overview/configuration + * @type {import('next-i18next').UserConfig} + */ module.exports = { i18n: { locales: ["en", "bg", "es", "hr", "ko", "zh", "ja"], defaultLocale: "en", }, localePath: path.resolve("./public/locales"), };
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (3)
next-i18next.config.js
(1 hunks)src/constants/languages.ts
(1 hunks)src/constants/locales.ts
(1 hunks)
src/constants/locales.ts
Outdated
@@ -1,3 +1,3 @@ | |||
export const LOCALES = ["en", "bg", "es", "hr", "ko", "zh"]; | |||
export const LOCALES = ["en", "bg", "es", "hr", "ko", "zh", "jp"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Critical: Incorrect Japanese locale code used across multiple files
The incorrect locale code "jp" for Japanese is consistently used across three files. This needs to be changed to the ISO 639-1 standard "ja":
src/constants/locales.ts
:
-export const LOCALES = ["en", "bg", "es", "hr", "ko", "zh", "jp"];
+export const LOCALES = ["en", "bg", "es", "hr", "ko", "zh", "ja"];
next-i18next.config.js
:
- locales: ["en", "bg", "es", "hr", "ko", "zh", "jp"],
+ locales: ["en", "bg", "es", "hr", "ko", "zh", "ja"],
src/constants/languages.ts
:
- jp: "Japanese",
+ ja: "Japanese",
🔗 Analysis chain
Critical: Use correct ISO language code for Japanese
The locale code "jp" is incorrect for Japanese. According to ISO 639-1 standards, the correct language code for Japanese is "ja". While "jp" is the country code (ISO 3166-1), for language localization we should use the language code "ja".
Apply this fix:
-export const LOCALES = ["en", "bg", "es", "hr", "ko", "zh", "jp"];
+export const LOCALES = ["en", "bg", "es", "hr", "ko", "zh", "ja"];
This change should also be reflected in:
- next-i18next.config.js
- src/constants/languages.ts
Let's verify the usage of this locale code across the codebase:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any hardcoded usage of 'jp' locale
# to ensure we catch all instances that need updating
echo "Checking for 'jp' locale usage..."
rg -l '"jp"' --type ts --type js --type json
echo "Checking for Japanese language configuration..."
rg -l 'Japanese' --type ts --type js --type json
Length of output: 358
Script:
#!/bin/bash
# Let's check the actual content of these files to confirm the usage
echo "Content of next-i18next.config.js:"
cat next-i18next.config.js
echo -e "\nContent of src/constants/languages.ts:"
cat src/constants/languages.ts
Length of output: 673
src/constants/languages.ts
Outdated
@@ -5,4 +5,5 @@ export const languages: { [key: string]: string } = { | |||
hr: "Croatian", | |||
ko: "Korean", | |||
zh: "Chinese", | |||
jp: "Japanese", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Update Japanese locale code from 'jp' to 'ja' across configuration files
The incorrect ISO code 'jp' is indeed used in multiple files. Here are all the locations that need to be updated:
src/constants/languages.ts
: Changejp: "Japanese"
toja: "日本語"
next-i18next.config.js
: Update locale array to useja
instead ofjp
src/constants/locales.ts
: Update locale array to useja
instead ofjp
Additionally, ensure the locale files under public/locales/
are named correctly using the 'ja' code instead of 'jp'.
🔗 Analysis chain
Update Japanese language entry to use correct ISO code and native name
There are two issues with the Japanese language entry:
-
The language code 'jp' is incorrect. According to ISO 639-1 standards, the correct code for Japanese is 'ja'. Note that 'jp' is often confused with Japanese but actually refers to the country code (Japan), not the language code.
-
For consistency with entries like "Español", consider using the native name "日本語" (Nihongo) instead of "Japanese".
Apply this change:
- jp: "Japanese",
+ ja: "日本語",
This change will require corresponding updates in other files where the locale code is used (e.g., next-i18next.config.js and locales.ts).
Let's verify other files that need to be updated:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for 'jp' locale usage across the codebase
rg -l '\bjp\b' --type ts --type js --type json
Length of output: 123
Script:
#!/bin/bash
# Check the content of these files to see how 'jp' is used
echo "=== next-i18next.config.js ==="
cat next-i18next.config.js
echo -e "\n=== src/constants/locales.ts ==="
cat src/constants/locales.ts
Length of output: 564
next-i18next.config.js
Outdated
@@ -3,7 +3,7 @@ const path = require("path"); | |||
|
|||
module.exports = { | |||
i18n: { | |||
locales: ["en", "bg", "es", "hr", "ko", "zh"], | |||
locales: ["en", "bg", "es", "hr", "ko", "zh", "jp"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Critical: Incorrect ISO language code needs to be updated in multiple files
The incorrect "jp" language code is consistently used across three files that need to be updated:
next-i18next.config.js
: Change "jp" to "ja" in locales arraysrc/constants/locales.ts
: Change "jp" to "ja" in LOCALES arraysrc/constants/languages.ts
: Change "jp" to "ja" in languages object key
Apply this fix across all files:
- "jp": "Japanese"
+ "ja": "Japanese"
The ISO 639-1 language code "ja" must be used for Japanese localization to work correctly.
🔗 Analysis chain
Critical: Incorrect ISO language code for Japanese
The locale code "jp" is incorrect. The ISO 639-1 language code for Japanese is "ja". While "jp" is the country code for Japan, "ja" is the correct language code that should be used for internationalization.
Apply this fix:
- locales: ["en", "bg", "es", "hr", "ko", "zh", "jp"],
+ locales: ["en", "bg", "es", "hr", "ko", "zh", "ja"],
Let's verify the usage of this incorrect code across other files:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for usage of incorrect 'jp' locale code across the codebase
# Expected: Should find instances where we need to update 'jp' to 'ja'
echo "Checking for 'jp' usage in language/locale related files..."
rg -l "jp" --type ts --type js src/constants/
Length of output: 232
Script:
#!/bin/bash
# Let's check the actual content of these files to see how 'jp' is used
echo "Content of src/constants/locales.ts:"
cat src/constants/locales.ts
echo -e "\nContent of src/constants/languages.ts:"
cat src/constants/languages.ts
Length of output: 510
public/locales/jp/common.json
Outdated
@@ -0,0 +1,455 @@ | |||
{ | |||
"app.name": "ダケード", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the file name doesn't match the language code
Submit a pull request
Replace any ":question:" below with information about your pull request.
Pull Request Details
Provide details about your pull request and what it adds, fixes, or changes.
❓
Breaking Changes
Describe what features are broken by this pull request and why, if any.
❓
Issues Fixed
Enter the issue numbers resolved by this pull request below, if any.
Other Relevant Information
Provide any other important details below.