You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
translation, but the base language ("de") did.
so it fell back to the English string.
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
cpdb_translation_quality_twith four values:CPDB_TR_EXACT,CPDB_TR_LANG,CPDB_TR_FALLBACK_EN,CPDB_TR_NONE.cpdbGetOptionTranslationWithQuality()cpdbGetChoiceTranslationWithQuality()cpdbGetGroupTranslationWithQuality()cpdbGetAllCapabilities()now fetches capabilities for the requestedlocale, 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.