Add fiftyone.pipeline.translation base engine#165
Merged
Conversation
Adds a generic translation flow element that reads string based properties from an upstream element and writes translated values under its own element data key. Supports strings, string lists and weighted string lists wrapped in an AspectPropertyValue, keeping the weights unchanged. Resolves the target language from a fixed locale or from the query.translation, query.accept-language and header.accept-language evidence keys in that order, treating English as the base language so no translation is performed when it is the preferred language. Parses YAML translation sources with js-yaml. Adds the package to the build, build-project and update-packages CI lists.
20 tasks
oleksandrlazarenko-pi
approved these changes
Jul 2, 2026
oleksandrlazarenko-pi
approved these changes
Jul 9, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Background
51Degrees on-premise IP Intelligence returns country information as weighted
lists of ISO country codes. Turning those into localized, ordered country
names (Runbook 2) needs a generic translation flow element, mirroring the .NET
FiftyOne.Pipeline.Translationpackage. pipeline-node had no translationelement for this.
Objectives
engines build on.
with the English short-circuit, weighted-list translation that preserves the
weights, and the
Originalmissing-translation behaviour.Key Decisions
fiftyone.pipeline.translation, mirroring the .NETseparate base package, rather than inlining the logic into the IP engines.
FlowElement(not an engine), matching .NET whereTranslationEngineBaseextendsFlowElementBase. It depends only onfiftyone.pipeline.coreandjs-yaml.AspectPropertyValueand the weighted value shape(
{ value, weight, rawWeight }) rather than relying oninstanceof, so itworks regardless of which copy of core produced the value.
js-yaml, keeping the consumerbuilders thin and faithful to the .NET design.
Changes
fiftyone.pipeline.translation:translationEngine.js: the flow element. Reads a source element, resolvesthe language (fixed or from
query.translation,query.accept-language,header.accept-language), translates the configured properties.translator.js: string, string-list, weighted-list andAspectPropertyValuetranslation with weights preserved.languages.js: Accept-Language parsing and locale resolution with theEnglish base-language short-circuit and the two-letter fallback.
translationData.js,missingTranslationBehavior.js,index.js,readme.md,tests/base.test.js.ci/build-package.ps1,ci/build-project.ps1andci/update-packages.ps1.Testing
npm test(jest) infiftyone.pipeline.translation: 8 tests pass, coveringAccept-Language ordering, exact and two-letter locale resolution, the English
short-circuit, preferred-before-lower-priority resolution, weighted-list
weight preservation, the
Originalmiss behaviour and no-value messagepreservation.
Notes
engines there depend on this package.