Skip to content

chore(i18n): replace untranslated English values in non-English catalogs with empty strings - #4791

Closed
rhmatzeka wants to merge 1 commit into
opensourcepos:masterfrom
rhmatzeka:fix/empty-untranslated-english-values
Closed

rhmatzeka wants to merge 1 commit into
opensourcepos:masterfrom
rhmatzeka:fix/empty-untranslated-english-values

Conversation

@rhmatzeka

@rhmatzeka rhmatzeka commented Oct 30, 2026 •

Copy link
Copy Markdown

Refs #4783

This replaces English values that were copied into non-English language catalogs with ''. MY_Language::getLine() falls back to the English catalog when a value is '', so the UI still shows the same English text, but Weblate now lists these strings as untranslated instead of done.

What counts as "confirmed English"

The issue warns that identical spelling alone is not enough, so I did not touch every value that matches English (5,698 matches across 44 locales). Only these were changed:

  1. Multi-word phrases (two or more words) identical to the English value, in any locale. Examples: Show Suspended Sales, Are you sure you want to edit the selected Gift Card(s)?, Rewards Package.
  2. Single Latin-script words identical to English in non-Latin-script locales (ar, bg, ckb, el, fa, he, hy, ka, km, lo, ml, ru, ta, th, uk, ur, zh-Hans, zh-Hant). Examples: Supplier in bg, Reports in ta.

Left as they are:

  • Single words in Latin-script locales. Total, Status, Email, April and similar are valid in many of these languages, so a native speaker should decide.
  • Short acronym terms such as SMTP Server, SMTP Port, Sale ID, CSV Export and Send SMS (145 entries). They are often kept as-is.
  • All-caps abbreviations (ID, VIP, HSN, UPI), brands (MailChimp, OSPOS), and values with no words (0, © 2010 - {0}).
  • en and en-GB, and every key.

As a spot check in a locale I speak, id (Indonesian): only system_info => 'System Info' changed. April, Total, Status, Logo and Email are correct Indonesian and stay. Untranslated single words such as Protocol and none are left for Weblate under rule (2) above, which is why this PR says "Refs" rather than "Closes".

Changes

204 files, 4,146 values. Lines are only modified, with no keys added or removed (4,146 insertions, 4,146 deletions).

Locale Values Locale Values Locale Values
ta 863 tl 761 bg 709
lo 694 da 333 zh-Hans 162
de-CH 53 hr-HR 43 hu 40
ml 39 ur 38 hy 37
ka 32 zh-Hant 31 it 30
nb 28 el 21 km 21
cs 19 pl 17 he 16
pt-BR 16 ro 16 de-DE 15
fa 13 nl-NL 13 nl-BE 12
tr 12 uk 12 bs 11
fr 6 th 6 es-ES 3
es-MX 3 ru 3 sv 3
sw-KE 3 sw-TZ 3 ar-EG 2
ar-LB 2 vi 2 az 1
ckb 1 id 1

Verification

  • php -l passes on all 204 changed files. This is what tests/LanguageFilesTest.php checks: each file parses and returns an array.
  • Before and after each file: the same keys in the same order, the same trailing newline and line endings, and no existing '' placeholder touched.
  • No file under app/Language/en/ or app/Language/en-GB/ changed.

The values were selected with a small script using the rules above. I'm happy to share it, or to narrow the rules if you'd rather keep any category (for example, the Tagalog loanwords).

Summary by CodeRabbit

  • Localization
    • Many labels, prompts, validation messages, and status messages now appear blank in a range of language options, including Bulgarian, Danish, Lao, Tamil, Tagalog, and Chinese.
    • Some configuration, sales shortcut, reporting, date-picker, and other interface text has also been cleared in Arabic, European languages, and additional locales.
    • Existing translations and values not changed in this update remain as they were.

…ogs with empty strings

Empty strings fall back to the English catalog (MY_Language::getLine), so these entries render the same English text while showing up as untranslated in Weblate.

Only values that are clearly untranslated are touched: multi-word phrases identical to the English value in any locale, and single Latin-script words identical to English in non-Latin-script locales. Single words in Latin-script locales, short acronym terms (SMTP Server, Sale ID), brands and placeholders are left for translators. Keys and English catalogs are unchanged.

Refs opensourcepos#4783
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

Selected English fallback strings were cleared from non-English translation catalogs. The changes affect configuration, shared interface, sales, inventory, reporting, and other catalog entries across multiple locales. The translation keys and array structures remain unchanged.

Changes: Non-English catalog updates

Layer / File(s) Summary
Shared interface and configuration catalogs
app/Language/*/{Common,Config,Datepicker,Bootstrap_tables,Enum,Module}.php
Selected common, configuration, datepicker, bootstrap-table, enum, and module values were cleared across locales.
Sales catalogs
app/Language/*/Sales.php
Selected shortcut labels and other sales-interface values were cleared.
People, messaging, and attribute catalogs
app/Language/*/{Attributes,Cashups,Customers,Employees,Login,Messages}.php
Selected attribute, cash-up, customer, employee, login, and message values were cleared.
Inventory, transaction, and report catalogs
app/Language/*/{Expenses,Expenses_categories,Giftcards,Item_kits,Items,Receivings,Reports,Suppliers,Taxes}.php
Selected expense, gift-card, item, receiving, report, supplier, and tax values were cleared.

Priority: Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Other

Possibly related issues

  • Issue 4783 describes the same catalog cleanup: confirmed English values in non-English catalogs become empty while keys and English fallback behavior are preserved.

Suggested reviewers: objecttothis

Merge Risk: Minimal · up to d411e

Cleared entries retain their previous English display text through fallback. No actionable merge risk was identified.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: replacing untranslated English values with empty strings across non-English language catalogs.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 50 files. (154 skipped: 154 over the file limit.)

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@BudsieBuds

Copy link
Copy Markdown
Member

@coderabbitai Has this PR been fully superseded by the recent changes on master for issue #4783, or does anything unique remain that still needs to be merged?

@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

Analysis chain

Script executed:

#!/bin/bash
set -euo pipefail
gh api repos/opensourcepos/opensourcepos/pulls/4791 --jq '{number,state,title,body,head:{sha:.head.sha,ref:.head.ref},base:{sha:.base.sha,ref:.base.ref},merged_at}'
gh api repos/opensourcepos/opensourcepos/issues/4783 --jq '{number,state,title,body,closed_at}'
gh api repos/opensourcepos/opensourcepos/issues/4783/comments --paginate --jq '.[] | {user:.user.login,body,created_at}'
gh api repos/opensourcepos/opensourcepos/commits/master --jq '{sha,commit:{message:.commit.message,date:.commit.committer.date}}'
git status --short
git rev-parse HEAD
git branch -r
git log -15 --format='%h %s'

Length of output: 38445


Script executed:

#!/bin/bash
set -euo pipefail
git fetch --no-tags origin master
git rev-parse origin/master
gh pr view 4793 --repo opensourcepos/opensourcepos --json title,mergedAt,mergeCommit,url
git diff --stat 90495a508f01dbe72638816281ed904a46d04408 d411e838596951832f51d812e6f0cf5be6d57d68 | tail -3
python - <<'PY'
import subprocess,re,collections,json
base='90495a508f01dbe72638816281ed904a46d04408'
head='d411e838596951832f51d812e6f0cf5be6d57d68'
master=subprocess.check_output(['git','rev-parse','origin/master'],text=True).strip()
def git(*a):return subprocess.check_output(['git',*a],text=True)
pattern=re.compile(r"""^\s*'((?:\\.|[^'\\])*)'\s*=>\s*(['"])((?:\\.|(?!\2).)*)\2,?\s*$""",re.M)
def parse(ref,path):
    text=git('show',ref+':'+path)
    matches=list(pattern.finditer(text))
    declarations=re.findall(r"^\s*'((?:\\.|[^'\\])*)'\s*=>",text,re.M)
    if len(declarations)!=len(matches):raise ValueError(('Incomplete parse',ref,path,len(declarations),len(matches)))
    result={m[1]:m[3] for m in matches}
    if len(result)!=len(matches):raise ValueError(('Duplicate keys',ref,path))
    return result
paths=git('diff','--name-only',base,head).splitlines()
master_paths=set(git('ls-tree','-r','--name-only',master,'--','app/Language').splitlines())
counts=collections.Counter(); missing=[]; different=[]; removed=[]; locales=collections.Counter()
for p in paths:
    old,new=parse(base,p),parse(head,p)
    if list(old)!=list(new):raise ValueError(('Keys changed',p))
    target=p if p in master_paths else p.replace('/hr-HR/','/hr/')
    if target not in master_paths:raise ValueError(('Missing catalog',p))
    current=parse(master,target)
    for k,v in new.items():
        if v==old[k]:continue
        counts['total_changes']+=1
        if v!='':raise ValueError(('Unexpected change',p,k))
        if k not in current:
            counts['removed_key']+=1;removed.append((p,k,old[k]))
        elif current[k]==v:
            counts['already_empty']+=1;locales[target.split('/')[2]]+=1
        elif current[k]==old[k]:
            counts['still_original']+=1;missing.append((target,k,current[k]))
        else:
            counts['different_nonempty']+=1;different.append((target,k,old[k],current[k]))
print('MASTER',master)
print('FILES',len(paths))
print('CLASSIFICATION',json.dumps(counts))
print('REMOVED_KEY_COUNTS',json.dumps(collections.Counter(k for p,k,v in removed)))
print('STILL_ORIGINAL',json.dumps(missing,ensure_ascii=False))
print('DIFFERENT_NONEMPTY',json.dumps(different,ensure_ascii=False))
print('LOCALE_COUNTS',json.dumps(locales,sort_keys=True))
PY
git diff --name-status 90495a508f01dbe72638816281ed904a46d04408 origin/master -- app/Language | tail -8
fd '^AGENTS\.md$' -H -E .git
git show origin/master:AGENTS.md | sed -n '1,160p'

Length of output: 3911


Script executed:

#!/bin/bash
set -euo pipefail
python - <<'PY'
import subprocess,re,collections,json,difflib
base='90495a508f01dbe72638816281ed904a46d04408';head='d411e838596951832f51d812e6f0cf5be6d57d68';master='9a304c01831303709964abb8f5bc219af807f081'
def git(*a):return subprocess.check_output(['git',*a],text=True)
pat=re.compile(r"""^\s*'((?:\\.|[^'\\])*)'\s*=>\s*(['"])((?:\\.|(?!\2).)*)\2,?\s*$""",re.M)
duplicates=[]
def parse(ref,path):
 text=git('show',ref+':'+path);matches=list(pat.finditer(text))
 declared=re.findall(r"^\s*'((?:\\.|[^'\\])*)'\s*=>",text,re.M)
 if len(declared)!=len(matches):raise ValueError(('Incomplete parse',ref,path,len(declared),len(matches)))
 rows=[(m[1],m[3]) for m in matches]
 dup=[k for k,n in collections.Counter(k for k,v in rows).items() if n>1]
 if dup:duplicates.append((ref,path,dup))
 return rows
paths=git('diff','--name-only',base,head).splitlines()
mp=set(git('ls-tree','-r','--name-only',master,'--','app/Language').splitlines())
counts=collections.Counter();removed=[];remaining=[];different=[]
for p in paths:
 old,new=parse(base,p),parse(head,p)
 if [k for k,v in old]!=[k for k,v in new]:raise ValueError(('Key order changed',p))
 target=p if p in mp else p.replace('/hr-HR/','/hr/')
 if target not in mp:raise ValueError(('Missing file',p))
 current=dict(parse(master,target))
 for (k,ov),(_,nv) in zip(old,new):
  if ov==nv:continue
  if nv!='':raise ValueError(('Unexpected new value',p,k,nv))
  counts['total_changes']+=1
  if k not in current:counts['removed_key']+=1;removed.append((p,k,ov))
  elif current[k]=='':counts['already_empty']+=1
  elif current[k]==ov:counts['still_original']+=1;remaining.append((target,k,ov))
  else:counts['different_nonempty']+=1;different.append((target,k,ov,current[k]))
print('FILES',len(paths));print('COUNTS',json.dumps(counts))
print('REMOVED_BY_KEY',json.dumps(collections.Counter(k for p,k,v in removed)))
print('STILL_ORIGINAL',json.dumps(remaining,ensure_ascii=False))
print('DIFFERENT_NONEMPTY',json.dumps(different,ensure_ascii=False))
print('DUPLICATE_DIAGNOSTICS',json.dumps(duplicates))
PY
fd '^AGENTS\.md$' -H -E .git || true
git show origin/master:AGENTS.md | sed -n '1,160p'
git show origin/master:app/Views/partial/footer.php | head -65
git show origin/master:app/Views/login.php | head -65

Length of output: 18880


@BudsieBuds Yes. Current master fully supersedes this PR’s cleanup. Nothing unique remains that needs to be merged.

I compared all 4,146 changed entries across 204 files in #4791 against master at 9a304c0, merged through #4793 on November 4.

Entries Current state on master
4,129 Already set to '', as proposed here.
15 The Common.website key was removed. The footer now contains the website directly.
2 Replaced with localized translations instead of ''.

The two localized entries are Messages.phone_number_required:

  • de-CH: Telefon ist erforderlich
  • hr: Broj telefona je obavezan

The comparison accounts for the hr-HR → hr locale rename. No changed entry still contains its original English value.

I recommend closing #4791 as superseded by #4793, without merging or cherry-picking it. Any remaining acceptance-criteria concerns for #4783 are separate follow-up work; this PR does not resolve them. This comparison verifies overlap, not runtime fallback behavior.

You are interacting with an AI system.

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