Repository navigation
Pass better string ID to LLM Prompt for XLIFF and Gettext - #4383
Merged
Merged
Conversation
Collaborator
Author
|
I thought about putting this on the entity model, but this code is only used by the LLM prompt, so ended up adding it to the OpenAI existing code. In case, we'd need a clear name ( |
mathjazz
reviewed
Aug 10, 2026
mathjazz
left a comment
Collaborator
There was a problem hiding this comment.
Looks good! Left a couple of comments.
| ) | ||
|
|
||
|
|
||
| def get_llm_string_id(entity: Entity) -> str | None: |
Collaborator
There was a problem hiding this comment.
Since this file is service-specific, shall we move this function outside of it, e.g. utils.py?
| # the section part. | ||
| if section_key and key[: len(section_key)] == section_key: | ||
| key = key[len(section_key) :] | ||
| if entity.resource.format == Resource.Format.GETTEXT: |
Collaborator
There was a problem hiding this comment.
Could we skip the ID when it equals entity.string, regardless of format? It's also the case for at least some XCODE/XLIFF files.
Collaborator
Author
There was a problem hiding this comment.
Makes sense, didn't think of those.
mathjazz
approved these changes
Aug 10, 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.
Fixes #4381