Skip to content

feat: translation-quality API + 3-way capability merge - #100

Merged
tillkamppeter merged 3 commits into
OpenPrinting:masterfrom
Souptik-De:task-a-translation-quality-v2
Aug 22, 2026
Merged

feat: translation-quality API + 3-way capability merge#100
tillkamppeter merged 3 commits into
OpenPrinting:masterfrom
Souptik-De:task-a-translation-quality-v2

Conversation

@Souptik-De

@Souptik-De Souptik-De commented Aug 20, 2026

Copy link
Copy Markdown

Summary

This PR adds a way for callers to find out how good a translation actually is.
When a program asks for a human-readable name for a printer option, choice, or group,
it now gets back both the translated string AND a quality tag telling where that
translation came from:

  • Exact match : the requested locale (e.g. "de_DE") has its own translation.
  • Base language match : the region-specific locale (e.g. "de_DE") didn't have a
    translation, but the base language ("de") did.
  • English fallback :neither the locale nor its base language had a translation,
    so it fell back to the English string.
  • No translation : no translation was found anywhere; the raw key name is returned.

Previously the frontend would silently return the raw key name when a translation was
missing, and callers had no way to know whether the string they got was actually
translated or just the raw key echoed back.

Changes

  • New public enum cpdb_translation_quality_t with four values:
    CPDB_TR_EXACT, CPDB_TR_LANG, CPDB_TR_FALLBACK_EN, CPDB_TR_NONE.
  • Three new public functions that return both the translation and its quality:
    • cpdbGetOptionTranslationWithQuality()
    • cpdbGetChoiceTranslationWithQuality()
    • cpdbGetGroupTranslationWithQuality()
  • The existing cpdbGetAllCapabilities() now fetches capabilities for the requested
    locale, then the base language (if the locale has a region), then English, and merges
    them with per-field quality tags so callers know exactly where each string came from.

@tillkamppeter

Copy link
Copy Markdown
Member

libcpdb_frontend_la version bumped to 4:0:1 for new API

Note that a version bump is only needed if the new API is breaking any program made for the previous API. If you only add functions and data structures but you do not remove anything existing or incompatibly modify something existing, you do not need to bump.

@Souptik-De

Souptik-De commented Aug 22, 2026

Copy link
Copy Markdown
Author

Note that a version bump is only needed if the new API is breaking any program made for the previous API. If you only add functions and data structures but you do not remove anything existing or incompatibly modify something existing, you do not need to bump.

You're right, this is purely additive. Fixing the version-info to just bump revision instead.

libcpdb_frontend_la version bumped to 4:0:1 for new API

Note that a version bump is only needed if the new API is breaking any program made for the previous API. If you only add functions and data structures but you do not remove anything existing or incompatibly modify something existing, you do not need to bump.

okay , got it done, please check.

@Souptik-De
Souptik-De marked this pull request as ready for review August 22, 2026 15:24
@tillkamppeter
tillkamppeter merged commit a39b622 into OpenPrinting:master Aug 22, 2026
7 checks passed
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