Repository navigation
feat: Update translations for multiple languages - #4498
Conversation
📝 WalkthroughWalkthroughLocalization updates across multiple language files, standardizing month-key naming from "mayl" to "may" in calendar translations and updating Spanish error message phrasing for invalid stock locations. Files also normalized with trailing newlines. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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.
Actionable comments posted: 2
🧹 Nitpick comments (3)
app/Language/ml/Calendar.php (1)
1-49: Consider adding a trailing newline.PSR-12 recommends that PHP files should end with a single blank line. Consider adding a newline after the closing
];on line 49.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/Language/ml/Calendar.php` around lines 1 - 49, Add a single trailing newline at end of file so it ends with one blank line after the closing array delimiter (the final "];" in the returned array for Malayalam calendar translations such as "december" => "ഡിസംബർ"), complying with PSR-12.app/Language/nb/Calendar.php (1)
1-49: Consider adding a trailing newline.PSR-12 recommends that PHP files should end with a single blank line. Consider adding a newline after the closing
];on line 49.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/Language/nb/Calendar.php` around lines 1 - 49, The PHP translation array in Calendar.php ends with the closing token "];" but lacks the recommended trailing newline; update the file that contains the return array (keys like "su","sunday","january", and "december") to add a single blank line/newline character after the final "];" so the file ends with one trailing newline per PSR-12.app/Language/ka/Calendar.php (1)
1-49: Consider adding a trailing newline.PSR-12 recommends that PHP files should end with a single blank line. Consider adding a newline after the closing
];on line 49.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/Language/ka/Calendar.php` around lines 1 - 49, The file ends with the array return ending `];` but lacks a trailing newline; edit the file containing the return array (the Calendar translation array that returns the associative array ending with `];`) and add a single blank line/newline after the closing `];` so the file ends with one newline as per PSR-12.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/Language/es-ES/Items.php`:
- Line 29: Update the translation value for the "csv_import_invalid_location"
key to use more natural Spanish phrasing: replace the current sentence "Solo
ubicaciones de stock válidas son permitidas." with "Solo se permiten ubicaciones
de stock válidas." so the entry "csv_import_invalid_location" reads with the
suggested wording.
In `@app/Language/lo/Calendar.php`:
- Line 41: The locale calendar array has a typo: the month key "mayl" should be
"may", which breaks lookups in Calendar.php; update the associative array key
from "mayl" to "may" (preserving the same value) so functions that read the
month name (e.g., the calendar array in Calendar.php) can correctly retrieve
May.
---
Nitpick comments:
In `@app/Language/ka/Calendar.php`:
- Around line 1-49: The file ends with the array return ending `];` but lacks a
trailing newline; edit the file containing the return array (the Calendar
translation array that returns the associative array ending with `];`) and add a
single blank line/newline after the closing `];` so the file ends with one
newline as per PSR-12.
In `@app/Language/ml/Calendar.php`:
- Around line 1-49: Add a single trailing newline at end of file so it ends with
one blank line after the closing array delimiter (the final "];" in the returned
array for Malayalam calendar translations such as "december" => "ഡിസംബർ"),
complying with PSR-12.
In `@app/Language/nb/Calendar.php`:
- Around line 1-49: The PHP translation array in Calendar.php ends with the
closing token "];" but lacks the recommended trailing newline; update the file
that contains the return array (keys like "su","sunday","january", and
"december") to add a single blank line/newline character after the final "];" so
the file ends with one trailing newline per PSR-12.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 0f22c4a8-867e-4c71-a8b0-97c6d984a892
📒 Files selected for processing (45)
app/Language/ar-EG/Calendar.phpapp/Language/de-DE/Calendar.phpapp/Language/de-DE/Common.phpapp/Language/de-DE/Employees.phpapp/Language/de-DE/Items.phpapp/Language/de-DE/Reports.phpapp/Language/de-DE/Sales.phpapp/Language/es-ES/Calendar.phpapp/Language/es-ES/Employees.phpapp/Language/es-ES/Items.phpapp/Language/es-ES/Reports.phpapp/Language/es-ES/Sales.phpapp/Language/es-MX/Calendar.phpapp/Language/fr/Common.phpapp/Language/fr/Employees.phpapp/Language/fr/Items.phpapp/Language/fr/Reports.phpapp/Language/fr/Sales.phpapp/Language/he/Calendar.phpapp/Language/it/Common.phpapp/Language/it/Employees.phpapp/Language/it/Items.phpapp/Language/it/Reports.phpapp/Language/it/Sales.phpapp/Language/ka/Calendar.phpapp/Language/km/Sales.phpapp/Language/lo/Calendar.phpapp/Language/ml/Calendar.phpapp/Language/ml/Sales.phpapp/Language/nb/Calendar.phpapp/Language/nl-NL/Calendar.phpapp/Language/nl-NL/Common.phpapp/Language/nl-NL/Employees.phpapp/Language/nl-NL/Items.phpapp/Language/nl-NL/Reports.phpapp/Language/nl-NL/Sales.phpapp/Language/pt-BR/Common.phpapp/Language/pt-BR/Employees.phpapp/Language/pt-BR/Items.phpapp/Language/pt-BR/Reports.phpapp/Language/pt-BR/Sales.phpapp/Language/ta/Sales.phpapp/Language/tl/Calendar.phpapp/Language/ur/Calendar.phpapp/Language/ur/Sales.php
objecttothis
left a comment
There was a problem hiding this comment.
Looks good. Two things to note
- Refactor all these arrays to stop using
"and use'instead. In PHP when"is used the parser is called for string interpolation, but I believe the way we use string interpolation does not require the parser to be called. - We need to push these up to weblate so that it doesn't overwrite the translations.
- Fix typo 'mayl' to 'may' in Calendar.php for lo, ka, ml, nb locales - Improve Spanish translation in Items.php for csv_import_invalid_location - Add trailing newlines to Calendar.php files (ka, ml, nb, lo) per PSR-12
d21bcee to
3406614
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/Language/ka/Calendar.php`:
- Line 41: The Calendar localization array uses the duplicate key "may" for the
long month entry which overwrites the short "may" key; change the long-month
array key from "may" to "mayl" so it matches the repository convention and
avoids key collisions (update the key in the Calendar.php locale array where the
long-May value is defined, leaving the short "may" entry intact).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a30104f8-9485-48f9-b26b-7cdf04e977fe
📒 Files selected for processing (5)
app/Language/es-ES/Items.phpapp/Language/ka/Calendar.phpapp/Language/lo/Calendar.phpapp/Language/ml/Calendar.phpapp/Language/nb/Calendar.php
✅ Files skipped from review due to trivial changes (1)
- app/Language/es-ES/Items.php
🚧 Files skipped from review as they are similar to previous changes (3)
- app/Language/lo/Calendar.php
- app/Language/nb/Calendar.php
- app/Language/ml/Calendar.php
| "march" => "", | ||
| "april" => "", | ||
| "mayl" => "", | ||
| "may" => "", |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== Detect duplicate keys in app/Language/ka/Calendar.php =="
python - <<'PY'
import re, collections, pathlib
p = pathlib.Path("app/Language/ka/Calendar.php")
text = p.read_text(encoding="utf-8")
keys = re.findall(r'"([^"]+)"\s*=>', text)
dups = [k for k, c in collections.Counter(keys).items() if c > 1]
print("duplicate_keys:", dups)
PY
echo
echo "== Locate English Calendar.php and compare key sets =="
python - <<'PY'
import re, pathlib
def extract_keys(path):
t = pathlib.Path(path).read_text(encoding="utf-8")
return re.findall(r'"([^"]+)"\s*=>', t)
candidates = list(pathlib.Path("app/Language").rglob("Calendar.php"))
en = None
for c in candidates:
s = str(c).lower().replace("\\", "/")
if "/en/" in s or "/en-us/" in s or s.endswith("/en/calendar.php"):
en = c
break
ka = pathlib.Path("app/Language/ka/Calendar.php")
if en is None:
print("english_calendar_not_found")
else:
en_keys = set(extract_keys(en))
ka_keys = set(extract_keys(ka))
print("english_file:", en)
print("missing_in_ka:", sorted(en_keys - ka_keys))
print("extra_in_ka:", sorted(ka_keys - en_keys))
PY
echo
echo "== Search repository for mayl conventions/usages =="
rg -nP '"mayl"\s*=>' app/Language --iglob '*Calendar.php' || true
rg -nP '\bmayl\b' app || trueRepository: opensourcepos/opensourcepos
Length of output: 5376
Change line 41 from "may" to "mayl" to match the repository-wide localization convention.
Line 41 currently uses "may", which conflicts with the short month key "may" at line 29. In PHP arrays, duplicate keys are overwritten by the later declaration, causing the long-form month name to be lost. Every other language file in the repository (40+ locales) consistently uses "mayl" for the long May form. Align this file with the established pattern.
Fix
- "may" => "",
+ "mayl" => "",📝 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.
| "may" => "", | |
| "mayl" => "", |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@app/Language/ka/Calendar.php` at line 41, The Calendar localization array
uses the duplicate key "may" for the long month entry which overwrites the short
"may" key; change the long-month array key from "may" to "mayl" so it matches
the repository convention and avoids key collisions (update the key in the
Calendar.php locale array where the long-May value is defined, leaving the short
"may" entry intact).
Summary
Changes
Test Plan
Summary by CodeRabbit