Skip to content

FIX: Select RandomTranslationConverter languages in the same order as its identifier - #3784

Merged
Roman Lutz (romanlutz) merged 1 commit into
microsoft:mainfrom
Shizoqua:fix/random-translation-language-order
Nov 4, 2026
Merged

Roman Lutz (romanlutz) merged 1 commit into
microsoft:mainfrom
Shizoqua:fix/random-translation-language-order

Conversation

@Shizoqua

Copy link
Copy Markdown
Contributor

Description

Fixes #3717.

RandomTranslationConverter._build_identifier already sorts the language pool case-insensitively, but convert_word_async picked from self.languages in the order the caller passed it. With the same seed, ["Spanish", "French"] and ["French", "Spanish"] had equal identifier hashes but chose different languages, so the identity did not describe the seeded behavior.

self.languages is now stored in that same sorted order at construction, for both custom and default pools. Selection and identity now agree, and identifier hashes are unchanged. One side effect worth noting: for a given seed, the language picked for each word can differ from before this change whenever the pool was not already in sorted order.

Tests and Documentation

Added test_random_translation_converter_language_order_does_not_change_seeded_choices to tests/unit/converter/test_random_translation_converter.py. With a configured root seed, two converters whose language lists differ only in order now send the same request to the target and have the same identifier hash. On main the hashes match but the requests differ.

No docs or notebooks changed, so JupyText was not needed.

@romanlutz
Roman Lutz (romanlutz) added this pull request to the merge queue Nov 4, 2026
Merged via the queue into microsoft:main with commit cf45a61 Nov 4, 2026
66 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.

Translation language order changes seeded behavior without changing converter identity

2 participants