Skip to content

[Bug]:En lang no longer has this. 'no_sales_to_display' => 'No Sales to display', #4794

Closed

Description

@odiea

🐛 Bug Description

Go into Sales . Go to daily sales with empty sales table. Table should display 'No Sales to display'
not 'no_sales_to_display'

📋 Steps to Reproduce

Go into Sales . Go to daily sales with empty sales table. Table should display 'No Sales to display'
not 'no_sales_to_display'

✅ Expected Behavior

Go into Sales . Go to daily sales with empty sales table. Table should display 'No Sales to display'
not 'no_sales_to_display'

📦 OpenSourcePOS Version

OpenSourcePOS 3.4.3

🔧 PHP Version

PHP 8.3

🌐 Browser(s)

Chrome

🖥️ Server Operating System

Win 10

🗄️ Database

Mysql

🌍 Web Server

Apache

📊 System Information Report

No error

📜 Relevant Log Output

No error

📸 Screenshots

Yes this is showing on the Dev demo

✓ Confirmation

  • I certify that this is an unmodified copy of OpenSourcePOS
  • I have searched existing issues to ensure this bug has not already been reported
  • I have provided all the information requested above

Activity

  1. added a commit that references this issue on Oct 31, 2026
    93ab049
  2. objecttothis commented on Nov 1, 2026

    @objecttothis
    Member

    Claude Issue Checker Agent (cc @objecttothis)

    Investigated against current master.

    Status: Still present (fix not yet merged).

    app/Language/en/Sales.php on master has no no_sales_to_display key — a repo-wide code search for no_sales_to_display returns zero matches anywhere in the codebase, even though bootstrap_tables_locale.php dynamically builds the lookup key Sales.no_sales_to_display for the empty daily-sales table, so it falls back to rendering the literal key name instead of a translated message, exactly as reported.

    There is an open, unmerged PR addressing this directly: #4795 "fix(i18n): add missing no_sales_to_display key", which adds the key to en/Sales.php (plus corresponding entries across other locale files). As of this check it is still open (merged: false), so the bug remains reproducible on master.

  3. added a commit that references this issue on Nov 4, 2026
    9a304c0
  4. BudsieBuds commented on Nov 4, 2026

    @BudsieBuds
    Member

    @coderabbitai Was this issue resolved and closed rightfully by the linked PR/commits? Please verify all requirements were met and flag any missing parts or regressions.

  5. coderabbitai commented on Nov 4, 2026

    @coderabbitai
    Contributor
    Analysis chain

    Script executed:

    #!/bin/bash
    set -euo pipefail
    gh issue view 4794 --repo opensourcepos/opensourcepos --json title,body,state,closedAt,url,comments
    gh api repos/opensourcepos/opensourcepos/issues/4794/timeline --paginate --jq '.[] | {event,created_at,commit_id,source,reason}'
    gh pr view 4795 --repo opensourcepos/opensourcepos --json title,body,state,mergedAt,mergeCommit,baseRefName,headRefName,url,files,commits

    Length of output: 36465


    Script executed:

    #!/bin/bash
    set -euo pipefail
    git status --short
    git branch --show-current
    git rev-parse HEAD
    fd -H '^AGENTS\.md$' .
    fd '^bootstrap_tables_locale\.php$' .
    ast-grep outline app/Language/en/Sales.php
    ast-grep outline app/Libraries/MY_Language.php
    ast-grep outline app/Config/Services.php --match language
    rg -n -C3 'no_sales_to_display' .

    Length of output: 31617


    Script executed:

    #!/bin/bash
    set -euo pipefail
    cat AGENTS.md
    gh pr view 4793 --repo opensourcepos/opensourcepos --json state,mergedAt,mergeCommit,baseRefName,url,statusCheckRollup --jq '{state,mergedAt,mergeCommit,baseRefName,url,checks:[.statusCheckRollup[]? | {name,conclusion,status}]}'
    gh api repos/opensourcepos/opensourcepos/branches/master --jq '{name,sha:.commit.sha}'
    git show -s --format='%H%n%P%n%s' HEAD
    ast-grep outline app/Views/partial/bootstrap_tables_locale.php
    ast-grep outline app/Config/Services.php --items all
    fd '^LanguageFilesTest\.php$' .
    ast-grep outline tests/LanguageFilesTest.php
    cat -n app/Views/partial/bootstrap_tables_locale.php
    cat -n app/Libraries/MY_Language.php
    rg -n -C5 'function language|MY_Language' app/Config/Services.php
    rg -n -C5 'no_sales_to_display|function test|Sales|fallback|lang\(' tests/LanguageFilesTest.php
    fd '^Sales\.php$' .
    rg -n -C4 'bootstrap_tables_locale|function manage|sales/manage' app --glob '*.php' --glob '!Language/**' | head -180
    python - <<'PY'
    from pathlib import Path
    import subprocess,re,collections
    key=re.compile(r"^\s*'no_sales_to_display'\s*=>\s*('(?:\\.|[^'\\])*')\s*,",re.M)
    files=sorted(Path('app/Language').glob('*/Sales.php'))
    counts=collections.Counter()
    problems=[]
    changed=[]
    preserved=0
    parent=subprocess.check_output(['git','rev-parse','HEAD^1'],text=True).strip()
    for p in files:
        text=p.read_text()
        matches=key.findall(text)
        if len(matches)!=1:
            problems.append((str(p),len(matches)))
            continue
        value=matches[0]
        counts['empty' if value=="''" else 'English' if p.parent.name=='en' else 'translated']+=1
        keys=re.findall(r"^\s*'([^']+)'\s*=>",text,re.M)
        i=keys.index('no_sales_to_display')
        if i and keys[i-1]>keys[i] or i+1<len(keys) and keys[i]>keys[i+1]:
            problems.append((str(p),'key out of order'))
        oldpath=str(p).replace('/hr/','/hr-HR/')
        old=subprocess.run(['git','show',f'{parent}:{oldpath}'],capture_output=True,text=True)
        prev=key.findall(old.stdout)
        if prev and prev[0] not in ("''","'No Sales to display.'"):
            if prev[0]==value: preserved+=1
            else: changed.append((str(p),prev[0],value))
    print('Catalog count:',len(files))
    print('Values:',dict(counts))
    print('Missing, duplicate, or ordering problems:',problems)
    print('Existing non-English translations preserved:',preserved)
    print('Changed existing translations:',changed)
    print('English-key delta:')
    subprocess.run(['git','diff',f'{parent}..HEAD','--','app/Language/en/Sales.php'])
    PY

    Length of output: 42645


    @BudsieBuds Yes. Closing #4794 was justified by the fix merged into master through #4793. The fix did not come from #4795, which remains open and unmerged.

    What I verified

    • Closure and merge: #4793 merged on November 4, 2026, at 14:23:50 UTC. The issue timeline links the closure to commit 9a304c0. That commit is also the current master HEAD.
    • Correct message: app/Language/en/Sales.php, Line 127 now defines:
      'no_sales_to_display' => 'No Sales to display.',
      This is the only change to the English Sales catalog in the closing commit.
    • Correct lookup: The daily-sales view includes bootstrap_tables_locale.php. Its formatNoMatches callback constructs Sales.no_sales_to_display for the sales controller at Lines 23–26. The restored key matches that lookup.
    • Locale coverage: All 46 Sales catalogs contain the key exactly once and in alphabetical order. They contain one English source value, 33 non-English values, and 12 empty fallback values.
    • Fallback behavior: MY_Language::getLine() explicitly falls back to en for empty values at Lines 30–35. This includes the empty en-GB entry. I applied the supplied localization guidance and confirmed it against the source.

    I found no missing functional requirement or regression in the empty-sales message path. The earlier “still present” comment predates the merge.

    Remaining caveats

    1. Regression-test strength: The new tests/LanguageFilesTest.php checks catalog structure and key parity. Those checks alone would not prevent this key from being removed from every catalog again. A focused assertion for Sales.no_sales_to_display, or a rendered empty-table test, would provide stronger protection.
    2. Deployment remains unverified: The PR’s build, lint, and database test checks passed. However, a staging deployment check failed. I did not run the application or verify the live demo, so this confirms the repository fix—not deployment to the demo or inclusion in a released version.
    3. Duplicate PR: #4795 remains open even though #4793 supplies the fix. It can be closed as superseded.

    The issue can remain closed. The test improvement and deployment check are follow-up items, not evidence that the source fix is incomplete.


    Learnings used
    Learnt from: CR
    Repo: opensourcepos/opensourcepos PR: 0
    File: AGENTS.md:0-0
    Timestamp: 2026-10-31T13:57:12.261Z
    Learning: Applies to {app/Language/**,app/Plugins/*/Language/**} : Source excerpt:
    # Agent Instructions
    
    ## Localization
    
    - Never copy English text from a neighboring key as a value for a non-English language file, even if that neighboring key is already untranslated — evaluate each key independently
    
    Learnt from: CR
    Repo: opensourcepos/opensourcepos PR: 0
    File: AGENTS.md:0-0
    Timestamp: 2026-10-31T13:57:12.261Z
    Learning: Applies to {app/Language/**,app/Plugins/*/Language/**} : Source excerpt:
    # Agent Instructions
    
    ## Localization
    
    - Non-English files must use an empty string (`''`) as the value when no translation is provided — CodeIgniter automatically falls back to the default (`en`) language. This applies only when a translation genuinely isn't available yet.
    
    Learnt from: CR
    Repo: opensourcepos/opensourcepos PR: 0
    File: AGENTS.md:0-0
    Timestamp: 2026-10-31T13:57:12.261Z
    Learning: Applies to {app/Language/**,app/Plugins/*/Language/**} : Source excerpt:
    # Agent Instructions
    
    ## Localization
    
    - **New keys must be inserted in alphabetical order** within the language array
    
    Learnt from: CR
    Repo: opensourcepos/opensourcepos PR: 0
    File: AGENTS.md:0-0
    Timestamp: 2026-10-31T13:57:12.261Z
    Learning: Applies to {app/Language/**,app/Plugins/*/Language/**} : Source excerpt:
    # Agent Instructions
    
    ## Localization
    
    - When adding new keys to language files, add the key to all `app/Language/*/` variants
    
    Learnt from: objecttothis
    Repo: opensourcepos/opensourcepos PR: 4450
    File: app/Language/de-DE/Sales.php:76-81
    Timestamp: 2026-04-03T08:54:53.158Z
    Learning: In opensourcepos, non-English language files intentionally use empty string values (`""`) for untranslated keys. The custom `app/Libraries/MY_Language.php` class overrides CI4's `Language::getLine()` to fall back to the English translation whenever `$output === NULL || $output === ""`, so empty strings are a valid and deliberate pattern — they should NOT be flagged as missing translations or suggested for removal.
    
    Learnt from: objecttothis
    Repo: opensourcepos/opensourcepos PR: 4727
    File: app/Views/partial/header.php:20-20
    Timestamp: 2026-10-10T22:13:01.070Z
    Learning: OSPOS uses the custom PHP CodeIgniter language service MY_Language, registered by Config\Services::language() in app/Config/Services.php. MY_Language::getLine() in app/Libraries/MY_Language.php falls back to the English translation when the selected translation is null or an empty string, then formats the translation with the supplied arguments. Empty locale strings therefore do not imply missing rendered text when the English translation is populated.
    
    Learnt from: CR
    Repo: opensourcepos/opensourcepos PR: 0
    File: AGENTS.md:0-0
    Timestamp: 2026-10-31T13:57:12.261Z
    Learning: Applies to {app/Language/**,app/Plugins/*/Language/**} : Source excerpt:
    # Agent Instructions
    
    ## Localization
    
    - Only `app/Language/en/` and `app/Language/en-GB/` should contain English strings
    

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions