Repository navigation
fix(i18n): keep search operators untranslated in search tips - #1671
Merged
LinkinStars merged 1 commit intoNov 18, 2026
Merged
Conversation
The search parser matches only the English tokens user:, answers:, score:, is:question and is:answer. Several locales translated these tokens inside the advanced search tips, so the examples shown in the UI do not work when typed into the search field. Restore the literal tokens in de_DE, fr_FR, it_IT, ja_JP, pl_PL, ro_RO, ru_RU and uk_UA. The surrounding translated text is unchanged. Add a test that checks the code span of every locale's tips against the operators the parser understands, so the same mistake is caught by go test next time.
Author
|
@neermilov cc |
Member
|
Thanks for the fix! The i18n and search parser tests passed, including validation that every locale’s complete search-tip examples use supported syntax. |
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.
The advanced search tips show examples meant to be typed into the search box. In some locales the operator inside the code span is translated together with the description, so the examples do not work. For example, the Russian site shows
ответов:0andответinstead ofanswers:0andis:answer.The search parser (internal/service/search_parser) matches only the English tokens
user:,answers:,score:,is:questionandis:answer. A translated token is treated as plain text, so searching with the displayed example does not apply the filter.Restore the literal tokens in de_DE, fr_FR, it_IT, ja_JP, pl_PL, ro_RO, ru_RU and uk_UA. The translated descriptions are unchanged.
Before:


After:
A test in i18n/i18n_test.go checks the code span of every locale against the operators the parser understands. It fails on the previous locale files and passes with this change.
Checked all locales: ko_KR and tr_TR use translated placeholders but keep the correct English prefixes, so they were left alone.
Verification:
go test ./i18n/passes.