Skip to content

feat: Update translations for multiple languages - #4498

Merged
jekkos merged 1 commit into
masterfrom
opensourcepos-translation-sync
Apr 20, 2026
Merged

jekkos merged 1 commit into
masterfrom
opensourcepos-translation-sync

Conversation

@jekkos

@jekkos jekkos commented Apr 15, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Added Calendar.php translations for multiple languages (ar-EG, de-DE, es-ES, es-MX, fr, he, it, km, lo, ml, nb, nl-NL, pt-BR, ta, tl, ur)
  • Fixed translation issues in Common.php, Employees.php, Items.php, Reports.php, Sales.php for de-DE, es-ES, fr, it, nl-NL, pt-BR
  • Removed English fallbacks from non-English translations to activate proper CI4 language fallback mechanism

Changes

  • 45 files changed across 16+ locales
  • Added new Calendar translations where missing
  • Corrected existing translations with proper context

Test Plan

  • Verify PHP syntax is valid (no parse errors)
  • Language files load correctly in the application
  • Empty values fallback to English as expected

Summary by CodeRabbit

  • Documentation
    • Corrected calendar month key mappings across multiple language files (Georgian, Lao, Malayalam, Norwegian).
    • Improved Spanish error message wording for stock location validation clarity.

@coderabbitai

coderabbitai Bot commented Apr 15, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Localization 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

Cohort / File(s) Summary
Calendar Month-Key Updates
app/Language/ka/Calendar.php, app/Language/lo/Calendar.php, app/Language/ml/Calendar.php, app/Language/nb/Calendar.php
Standardized month key from "mayl" to "may" across multiple language locales (Georgian, Lao, Malayalam, Norwegian). Trailing newlines added to all files.
Spanish Translation Update
app/Language/es-ES/Items.php
Rephrased error message for invalid stock locations from "Ubicación(es) de stock inválida(s) encontrada(s)..." to "Se encontraron ubicaciones de stock no válidas...". Message purpose and placeholder remain unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 With whiskers twitched and nose held high,
We hopped through translations spring to spring,
Fixed "mayl" to "may," made May-time bright,
Spanish phrases dance and sing,
Newlines neat—translation's delight! 🌷✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: updating translations across multiple language files. It is concise, specific, and clearly indicates the primary purpose of the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch opensourcepos-translation-sync

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 905b58c and 1e7de2a.

📒 Files selected for processing (45)
  • app/Language/ar-EG/Calendar.php
  • app/Language/de-DE/Calendar.php
  • app/Language/de-DE/Common.php
  • app/Language/de-DE/Employees.php
  • app/Language/de-DE/Items.php
  • app/Language/de-DE/Reports.php
  • app/Language/de-DE/Sales.php
  • app/Language/es-ES/Calendar.php
  • app/Language/es-ES/Employees.php
  • app/Language/es-ES/Items.php
  • app/Language/es-ES/Reports.php
  • app/Language/es-ES/Sales.php
  • app/Language/es-MX/Calendar.php
  • app/Language/fr/Common.php
  • app/Language/fr/Employees.php
  • app/Language/fr/Items.php
  • app/Language/fr/Reports.php
  • app/Language/fr/Sales.php
  • app/Language/he/Calendar.php
  • app/Language/it/Common.php
  • app/Language/it/Employees.php
  • app/Language/it/Items.php
  • app/Language/it/Reports.php
  • app/Language/it/Sales.php
  • app/Language/ka/Calendar.php
  • app/Language/km/Sales.php
  • app/Language/lo/Calendar.php
  • app/Language/ml/Calendar.php
  • app/Language/ml/Sales.php
  • app/Language/nb/Calendar.php
  • app/Language/nl-NL/Calendar.php
  • app/Language/nl-NL/Common.php
  • app/Language/nl-NL/Employees.php
  • app/Language/nl-NL/Items.php
  • app/Language/nl-NL/Reports.php
  • app/Language/nl-NL/Sales.php
  • app/Language/pt-BR/Common.php
  • app/Language/pt-BR/Employees.php
  • app/Language/pt-BR/Items.php
  • app/Language/pt-BR/Reports.php
  • app/Language/pt-BR/Sales.php
  • app/Language/ta/Sales.php
  • app/Language/tl/Calendar.php
  • app/Language/ur/Calendar.php
  • app/Language/ur/Sales.php

Comment thread app/Language/es-ES/Items.php Resolved
Comment thread app/Language/lo/Calendar.php Resolved
@jekkos
jekkos requested a review from objecttothis April 15, 2026 11:48
objecttothis
objecttothis previously approved these changes Apr 15, 2026

@objecttothis objecttothis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between d21bcee and 3406614.

📒 Files selected for processing (5)
  • app/Language/es-ES/Items.php
  • app/Language/ka/Calendar.php
  • app/Language/lo/Calendar.php
  • app/Language/ml/Calendar.php
  • app/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" => "",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 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 || true

Repository: 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.

Suggested change
"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).

@jekkos
jekkos merged commit ff7a8d2 into master Apr 20, 2026
13 checks passed
@jekkos
jekkos deleted the opensourcepos-translation-sync branch April 20, 2026 06:49
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