Skip to content

Fix language validation to check translated values - #10

Open
valko1 wants to merge 1 commit into
fless-lab:masterfrom
valko1:fix/language-validation
Open

valko1 wants to merge 1 commit into
fless-lab:masterfrom
valko1:fix/language-validation

Conversation

@valko1

@valko1 valko1 commented Nov 4, 2026

Copy link
Copy Markdown

Summary

Fix incorrect missing-translation warnings in scripts/validate_all.py.

Problem

Language configuration files use the following mapping structure:

native_identifier -> python_identifier

However, the validator incorrectly checks whether Python keywords and built-in function names exist as dictionary keys, rather than values.

Consequently, valid translations are incorrectly reported as missing.

Root Cause

The original implementation:

if python_keyword not in lang_data[category]:

Checks dictionary keys instead of translated values.

The corrected implementation:

translated_values = set(lang_data[category].values())

if python_keyword not in translated_values:

Correctly identifies whether a Python identifier has a corresponding native-language translation.

Changes

  • Fix missing-translation detection by checking dictionary values.
  • Preserve validation of invalid mappings and duplicate translations.
  • Improve code formatting and indentation.
  • Maintain compatibility with existing language configuration files.

Testing

Environment: Windows 11 ARM64, Python 3.14.

Validation command:

py .\scripts\validate_all.py

Results

Metric Before After
Languages validated 8 7
Validation errors 0 0
Warnings 773 1

The difference in language count is expected because Bulgarian is maintained in a separate feature branch.

Remaining warning:

zh.json: Missing builtins translation: id

This warning identifies an actual missing translation in the Chinese language configuration.

Additional Checks

  • Python syntax compilation: PASSED.
  • Git whitespace validation (git diff --check): PASSED.
  • All seven existing language files processed successfully.

Scope

This fix is language-independent and does not modify any language configuration files.

It corrects the validator's logic while preserving its existing validation behaviour.

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.

1 participant