-
-
Notifications
You must be signed in to change notification settings - Fork 362
Support translations keys + default for new keys #3812
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
Conversation
📝 WalkthroughWalkthroughThis PR adds comprehensive localization support for application settings across 21 languages. It introduces language-specific translation files containing documentation and details for each setting, and updates Vue form components to consume these translations through a new translation composable. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes The changes are highly homogeneous: 21 language files follow an identical structure (data-only arrays), and 9 Vue components apply the same translation pattern. Logic density is minimal—mostly data declarations and straightforward composable wiring. While spanning many files, the repetitive nature and consistent patterns reduce cognitive load per file. Poem
Pre-merge checks❌ Failed checks (1 warning)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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: 6
🧹 Nitpick comments (1)
resources/js/composables/useTranslation.ts (1)
13-19: Consider adding defensive null checks for robustness.While the current implementation works when the config object has the expected shape, adding optional chaining or validation could prevent potential runtime errors if the config object is malformed.
Consider this defensive approach:
function tDoc(config: { key: string; documentation: string }): string { - return t("all_settings.documentation." + config.key, config.documentation); + return t("all_settings.documentation." + config.key, config.documentation ?? ""); } function tDetails(config: { key: string; details: string }): string { - return t("all_settings.details." + config.key, config.details); + return t("all_settings.details." + config.key, config.details ?? ""); }Or strengthen the TypeScript types to ensure non-null values at compile time.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (31)
lang/ar/all_settings.php(1 hunks)lang/cz/all_settings.php(1 hunks)lang/de/all_settings.php(1 hunks)lang/el/all_settings.php(1 hunks)lang/en/all_settings.php(1 hunks)lang/es/all_settings.php(1 hunks)lang/fa/all_settings.php(1 hunks)lang/fr/all_settings.php(1 hunks)lang/hu/all_settings.php(1 hunks)lang/it/all_settings.php(1 hunks)lang/ja/all_settings.php(1 hunks)lang/nl/all_settings.php(1 hunks)lang/no/all_settings.php(1 hunks)lang/pl/all_settings.php(1 hunks)lang/pt/all_settings.php(1 hunks)lang/ru/all_settings.php(1 hunks)lang/sk/all_settings.php(1 hunks)lang/sv/all_settings.php(1 hunks)lang/vi/all_settings.php(1 hunks)lang/zh_CN/all_settings.php(1 hunks)lang/zh_TW/all_settings.php(1 hunks)resources/js/components/forms/settings/BoolField.vue(2 hunks)resources/js/components/forms/settings/NumberField.vue(2 hunks)resources/js/components/forms/settings/OldField.vue(2 hunks)resources/js/components/forms/settings/SelectField.vue(2 hunks)resources/js/components/forms/settings/SelectLang.vue(2 hunks)resources/js/components/forms/settings/SelectOptionsField.vue(3 hunks)resources/js/components/forms/settings/SliderField.vue(3 hunks)resources/js/components/forms/settings/StringField.vue(3 hunks)resources/js/components/forms/settings/ZipSliderField.vue(2 hunks)resources/js/composables/useTranslation.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: ildyria
Repo: LycheeOrg/Lychee PR: 3641
File: lang/no/settings.php:9-9
Timestamp: 2025-08-22T06:11:18.329Z
Learning: For lang/* translation files in the Lychee project: only review PHP-related issues (syntax, structure, etc.), not translation content, grammar, or language-related nitpicks. The maintainer ildyria has explicitly requested this approach.
Learnt from: ildyria
Repo: LycheeOrg/Lychee PR: 3637
File: lang/nl/renamer.php:10-94
Timestamp: 2025-08-20T20:35:04.474Z
Learning: In Lychee, translation files are initially created with English strings as placeholders, and actual translations are handled through Weblate (a web-based translation management system). This means finding English text in non-English locale files (like lang/nl/, lang/de/, etc.) is expected and part of their translation workflow, not an issue to flag.
Learnt from: ildyria
Repo: LycheeOrg/Lychee PR: 3654
File: lang/cz/gallery.php:210-210
Timestamp: 2025-08-27T08:48:27.520Z
Learning: For this Lychee project, the maintainer prefers to keep language strings in English across all locale files rather than translating them to local languages.
Learnt from: ildyria
Repo: LycheeOrg/Lychee PR: 3654
File: lang/pl/gallery.php:210-210
Timestamp: 2025-08-27T08:48:32.956Z
Learning: The user ildyria does not prioritize strict localization consistency for new menu items in language files, as indicated by their "Lang = don't care" response when suggested to translate 'Import from Server' to Polish in lang/pl/gallery.php.
📚 Learning: 2025-08-22T06:11:18.329Z
Learnt from: ildyria
Repo: LycheeOrg/Lychee PR: 3641
File: lang/no/settings.php:9-9
Timestamp: 2025-08-22T06:11:18.329Z
Learning: For lang/* translation files in the Lychee project: only review PHP-related issues (syntax, structure, etc.), not translation content, grammar, or language-related nitpicks. The maintainer ildyria has explicitly requested this approach.
Applied to files:
lang/es/all_settings.phplang/sv/all_settings.phplang/fa/all_settings.phplang/it/all_settings.phplang/el/all_settings.php
📚 Learning: 2025-08-20T20:35:04.474Z
Learnt from: ildyria
Repo: LycheeOrg/Lychee PR: 3637
File: lang/nl/renamer.php:10-94
Timestamp: 2025-08-20T20:35:04.474Z
Learning: In Lychee, translation files are initially created with English strings as placeholders, and actual translations are handled through Weblate (a web-based translation management system). This means finding English text in non-English locale files (like lang/nl/, lang/de/, etc.) is expected and part of their translation workflow, not an issue to flag.
Applied to files:
lang/fa/all_settings.phplang/el/all_settings.php
📚 Learning: 2025-08-27T08:48:27.520Z
Learnt from: ildyria
Repo: LycheeOrg/Lychee PR: 3654
File: lang/cz/gallery.php:210-210
Timestamp: 2025-08-27T08:48:27.520Z
Learning: For this Lychee project, the maintainer prefers to keep language strings in English across all locale files rather than translating them to local languages.
Applied to files:
lang/el/all_settings.php
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (18)
- GitHub Check: 3️⃣ PHP dist / 8.4 - sqlite
- GitHub Check: 3️⃣ PHP dist / 8.4 - mariadb
- GitHub Check: 3️⃣ PHP dist / 8.4 - postgresql
- GitHub Check: 3️⃣ PHP dist / 8.3 - sqlite
- GitHub Check: 3️⃣ PHP dist / 8.3 - mariadb
- GitHub Check: 3️⃣ PHP dist / 8.3 - postgresql
- GitHub Check: 2️⃣ PHP tests / 8.3 - sqlite -- Webshop
- GitHub Check: 2️⃣ PHP tests / 8.3 - sqlite -- ImageProcessing
- GitHub Check: 2️⃣ PHP tests / 8.3 - sqlite -- Feature_v2
- GitHub Check: 2️⃣ PHP tests / 8.3 - sqlite -- Unit
- GitHub Check: 2️⃣ PHP tests / 8.3 - mariadb -- Feature_v2
- GitHub Check: 2️⃣ PHP tests / 8.3 - postgresql -- Webshop
- GitHub Check: 2️⃣ PHP tests / 8.3 - postgresql -- Feature_v2
- GitHub Check: 2️⃣ PHP tests / 8.3 - mariadb -- Webshop
- GitHub Check: 2️⃣ PHP tests / 8.3 - postgresql -- ImageProcessing
- GitHub Check: 2️⃣ PHP tests / 8.3 - mariadb -- ImageProcessing
- GitHub Check: 2️⃣ PHP tests / 8.3 - postgresql -- Unit
- GitHub Check: 2️⃣ PHP tests / 8.3 - mariadb -- Unit
🔇 Additional comments (24)
lang/ar/all_settings.php (1)
1-602: PHP structure and syntax look correctFile cleanly returns a nested array with balanced brackets, valid commas, and properly quoted strings under
documentationanddetails. No PHP-level issues found.lang/sv/all_settings.php (1)
1-602: Valid PHP array resourceThe file correctly declares
<?phpand returns a well-formed associative array withdocumentationanddetails. Array/quote syntax is consistent; no PHP errors apparent.lang/de/all_settings.php (1)
1-602: Well-formed localization array
lang/de/all_settings.phpis a syntactically correct PHP file returning the expected nested array; keys and values are structurally consistent, with no detectable PHP errors.lang/ja/all_settings.php (1)
1-602: PHP syntax/structure OKThe Japanese all_settings resource cleanly returns a nested associative array; bracket, comma, and quoting usage are correct. No PHP-level problems found.
lang/en/all_settings.php (1)
1-602: Base English catalog is structurally sound
lang/en/all_settings.phpis a valid PHP file returning the expecteddocumentationanddetailsarrays. Array layout, commas, and quoting are correct; no syntax or structural issues detected.lang/zh_TW/all_settings.php (1)
1-602: Array and file structure are validThis translation file is well‑formed PHP: single top‑level
returnarray with'documentation'and'details'sub‑arrays, all keys and values correctly comma‑separated and brackets properly closed. No PHP syntax or structural issues from what I can see.lang/sk/all_settings.php (1)
1-602: Syntactically correct localization arrayThe Slovak
all_settingsfile is structurally consistent with the other locales: valid<?phpheader, a single returned array, and two associative sub‑arrays for'documentation'and'details'with proper PHP syntax. No structural problems identified.lang/no/all_settings.php (1)
1-602: Norwegianall_settingsfile is structurally soundThis file follows the expected pattern (
returning an array with'documentation'and'details'), and the PHP syntax (quotes, commas, brackets) is correct throughout. No PHP‑level issues from this diff.lang/es/all_settings.php (1)
1-602: Spanishall_settingslocalization: PHP looks correctThe file is a clean, syntactically valid PHP array with the expected
'documentation'and'details'sections. Bracing and comma usage are consistent; I don’t see any structural or PHP‑level problems here.lang/nl/all_settings.php (1)
1-602: PHP structure and key consistency verified—no issues found.The file is syntactically valid. Verification confirms
metrics_logged_in_users_enabedis used consistently across the entire codebase (tests, migrations, controllers, middleware, and all language files). The key naming matches the established configuration system, so the translation file is correct as-is.lang/ru/all_settings.php (1)
1-602: LGTM! PHP structure is correct.The file structure is valid with proper array declaration and consistent key-value pairs. English content in this Russian locale file is expected per the Weblate translation workflow.
Based on learnings
lang/it/all_settings.php (1)
1-602: LGTM! PHP structure is correct.The file structure is valid with proper array declaration and consistent key-value pairs. English content in this Italian locale file is expected per the Weblate translation workflow.
Based on learnings
resources/js/components/forms/settings/SelectField.vue (1)
23-25: LGTM! Translation integration is correct.The translation composable is properly imported and used with the correct fallback pattern (
props.label ?? tDoc(props.config)), maintaining backward compatibility.resources/js/components/forms/settings/SelectOptionsField.vue (1)
47-49: LGTM! Translation integration is correct.Both
tDocandtDetailshelpers are properly integrated with correct fallback patterns, maintaining backward compatibility while enabling localized documentation and details rendering.resources/js/components/forms/settings/ZipSliderField.vue (1)
21-23: LGTM! Translation integration is correct.The translation composable is properly integrated, replacing direct access to
props.config.documentationwith the localizedtDoc(props.config)helper.resources/js/components/forms/settings/SelectLang.vue (1)
16-18: LGTM! Translation integration is correct.The translation composable is properly imported and used with the correct fallback pattern, enabling localized labels while maintaining backward compatibility.
resources/js/components/forms/settings/OldField.vue (1)
25-27: LGTM! Translation integration is correct.Both
tDocandtDetailshelpers are properly integrated, replacing direct access toprops.config.documentationandprops.config.detailswith localized versions.resources/js/components/forms/settings/BoolField.vue (1)
26-28: LGTM! Translation integration is correct.Both
tDocandtDetailshelpers are properly integrated with correct fallback patterns, enabling localized documentation and details while maintaining backward compatibility.resources/js/components/forms/settings/SliderField.vue (1)
28-30: LGTM! Translation integration implemented correctly.The translation composable is properly imported and used to provide localized documentation and details. This follows the consistent pattern across all settings components.
lang/fa/all_settings.php (1)
1-602: PHP structure looks correct.The file follows proper PHP syntax with correct array structure. The translation content (English placeholders) is expected and will be handled via Weblate.
Based on learnings
lang/zh_CN/all_settings.php (1)
1-602: PHP structure looks correct.The file follows proper PHP syntax with correct array structure. English placeholders are expected and will be translated via Weblate.
Based on learnings
resources/js/components/forms/settings/StringField.vue (1)
38-40: LGTM! Translation integration properly implemented.The component correctly uses the translation helpers to provide localized content while maintaining backward compatibility with optional label and details props.
resources/js/components/forms/settings/NumberField.vue (1)
33-35: LGTM! Translation helpers correctly integrated.The component properly uses tDoc and tDetails for localized content rendering.
lang/pl/all_settings.php (1)
1-602: PHP structure looks correct.The file has proper PHP syntax and array structure. English placeholder content is expected and will be translated through Weblate.
Based on learnings
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
Summary by CodeRabbit