diff --git a/i18n/de_DE.yaml b/i18n/de_DE.yaml
index 90a88ff0f..e16ca9c33 100644
--- a/i18n/de_DE.yaml
+++ b/i18n/de_DE.yaml
@@ -1554,10 +1554,10 @@ ui:
title: Erweiterte Suchtipps
tag: "<1>[tag]1> Suche mit einem Tag"
user: "<1>user:username1> Suche nach Autor"
- answer: "<1>Antworten:01> unbeantwortete Fragen"
+ answer: "<1>answers:01> unbeantwortete Fragen"
score: "<1>score:31> Beiträge mit einer 3+ Punktzahl"
question: "<1>is:question1> Suchfragen"
- is_answer: "<1>ist:answer1> Suchantworten"
+ is_answer: "<1>is:answer1> Suchantworten"
empty: Wir konnten nichts finden.
Versuche es mit anderen oder weniger spezifischen Keywords.
share:
name: Teilen
diff --git a/i18n/fr_FR.yaml b/i18n/fr_FR.yaml
index a80fe88b5..7fd4e21ae 100644
--- a/i18n/fr_FR.yaml
+++ b/i18n/fr_FR.yaml
@@ -1544,11 +1544,11 @@ ui:
tips:
title: Astuces de recherche avancée
tag: "<1>[tag]1> recherche à l'aide d'un tag"
- user: "<1>utilisateur:username1> recherche par auteur"
- answer: "<1>réponses:01> questions sans réponses"
+ user: "<1>user:username1> recherche par auteur"
+ answer: "<1>answers:01> questions sans réponses"
score: "<1>score:31> messages avec plus de 3 points"
- question: "<1>est:question1> rechercher des questions"
- is_answer: "<1>est :réponse1> réponses de recherche"
+ question: "<1>is:question1> rechercher des questions"
+ is_answer: "<1>is:answer1> réponses de recherche"
empty: Nous n'avons rien trouvé.
Essayez des mots-clés différents ou moins spécifiques.
share:
name: Partager
diff --git a/i18n/i18n_test.go b/i18n/i18n_test.go
new file mode 100644
index 000000000..8e711120e
--- /dev/null
+++ b/i18n/i18n_test.go
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package i18n
+
+import (
+ "io/fs"
+ "regexp"
+ "strings"
+ "testing"
+
+ "gopkg.in/yaml.v3"
+)
+
+type searchTips struct {
+ UI struct {
+ Search struct {
+ Tips struct {
+ Tag string `yaml:"tag"`
+ User string `yaml:"user"`
+ Answer string `yaml:"answer"`
+ Score string `yaml:"score"`
+ Question string `yaml:"question"`
+ IsAnswer string `yaml:"is_answer"`
+ } `yaml:"tips"`
+ } `yaml:"search"`
+ } `yaml:"ui"`
+}
+
+// TestSearchTipsUseParserOperators guards the examples shown on the search
+// page. They are meant to be typed into the search box, but the parser
+// (internal/service/search_parser) matches only the English operators, so a
+// translated operator inside the <1>1> code span produces a useless example.
+func TestSearchTipsUseParserOperators(t *testing.T) {
+ files, err := fs.Glob(I18n, "*.yaml")
+ if err != nil {
+ t.Fatal(err)
+ }
+ codeSpan := regexp.MustCompile(`<1>(.*?)1>`)
+ tag := regexp.MustCompile(`^\[.+\]$`)
+
+ for _, file := range files {
+ if file == "i18n.yaml" {
+ continue
+ }
+ data, err := I18n.ReadFile(file)
+ if err != nil {
+ t.Fatalf("%s: %v", file, err)
+ }
+ var tr searchTips
+ if err = yaml.Unmarshal(data, &tr); err != nil {
+ t.Fatalf("%s: %v", file, err)
+ }
+ tips := tr.UI.Search.Tips
+ cases := []struct {
+ key string
+ value string
+ valid func(string) bool
+ }{
+ {"tag", tips.Tag, tag.MatchString},
+ {"user", tips.User, func(v string) bool { return strings.HasPrefix(v, "user:") }},
+ {"answer", tips.Answer, func(v string) bool { return strings.HasPrefix(v, "answers:") }},
+ {"score", tips.Score, func(v string) bool { return strings.HasPrefix(v, "score:") }},
+ {"question", tips.Question, func(v string) bool { return v == "is:question" }},
+ {"is_answer", tips.IsAnswer, func(v string) bool { return v == "is:answer" }},
+ }
+ for _, c := range cases {
+ m := codeSpan.FindStringSubmatch(c.value)
+ if m == nil {
+ t.Errorf("%s: tips.%s has no <1> code span: %q", file, c.key, c.value)
+ continue
+ }
+ if !c.valid(m[1]) {
+ t.Errorf("%s: tips.%s code span %q is not an operator the search parser understands", file, c.key, m[1])
+ }
+ }
+ }
+}
diff --git a/i18n/it_IT.yaml b/i18n/it_IT.yaml
index 59d66da37..871a2f242 100644
--- a/i18n/it_IT.yaml
+++ b/i18n/it_IT.yaml
@@ -1545,8 +1545,8 @@ ui:
title: Suggerimenti per ricerca avanzata
tag: "<1>[tag]1> cerca dentro un tag"
user: "<1>user:username1> ricerca per autore"
- answer: "<1>risposte:01> domande senza risposta"
- score: "<1>punteggio:31> messaggi con un punteggio di 3+"
+ answer: "<1>answers:01> domande senza risposta"
+ score: "<1>score:31> messaggi con un punteggio di 3+"
question: "<1>is:question1> cerca domande"
is_answer: "<1>is:answer1> cerca risposte"
empty: Non siamo riusciti a trovare nulla.
Prova parole chiave diverse o meno specifiche.
diff --git a/i18n/ja_JP.yaml b/i18n/ja_JP.yaml
index 6d7843624..c7d308054 100644
--- a/i18n/ja_JP.yaml
+++ b/i18n/ja_JP.yaml
@@ -1545,11 +1545,11 @@ ui:
tips:
title: 詳細検索のヒント
tag: "<1>[tag]1> タグで検索"
- user: "<1>ユーザー:ユーザー名1>作成者による検索"
- answer: "<1>回答:01>未回答の質問"
- score: "<1>スコア:31>3以上のスコアを持つ投稿"
- question: "<1>質問1>質問を検索"
- is_answer: "<1>は答え1>答えを検索"
+ user: "<1>user:username1>作成者による検索"
+ answer: "<1>answers:01>未回答の質問"
+ score: "<1>score:31>3以上のスコアを持つ投稿"
+ question: "<1>is:question1>質問を検索"
+ is_answer: "<1>is:answer1>答えを検索"
empty: 何も見つかりませんでした。
別のキーワードまたはそれ以下の特定のキーワードをお試しください。
share:
name: シェア
diff --git a/i18n/pl_PL.yaml b/i18n/pl_PL.yaml
index 8b7b8a12c..fb613a376 100644
--- a/i18n/pl_PL.yaml
+++ b/i18n/pl_PL.yaml
@@ -1545,7 +1545,7 @@ ui:
title: Porady dotyczące wyszukiwania zaawansowanego
tag: "<1>[tag]1> search with a tag"
user: "<1>user:username1> wyszukiwanie według autora"
- answer: "<1> answers:0 1> pytania bez odpowiedzi"
+ answer: "<1>answers:01> pytania bez odpowiedzi"
score: "<1>score:31> posty z oceną 3+"
question: "<1>is:question1> wyszukiwanie pytań"
is_answer: "<1>is:answer1> wyszukiwanie odpowiedzi"
diff --git a/i18n/ro_RO.yaml b/i18n/ro_RO.yaml
index 5b5f3489d..504474ecb 100644
--- a/i18n/ro_RO.yaml
+++ b/i18n/ro_RO.yaml
@@ -1544,11 +1544,11 @@ ui:
tips:
title: Sfaturi de căutare avansate
tag: "<1>[tag]1> search with a tag"
- user: "<1>utilizator:username1> căutare de către autor"
- answer: "<1>răspunsuri:01> întrebări fără răspuns"
- score: "<1>scor:31> postări cu un scor de 3+"
- question: "<1>este:question1> întrebări de căutare"
- is_answer: "<1>este:răspuner1> răspunsuri la căutare"
+ user: "<1>user:username1> căutare de către autor"
+ answer: "<1>answers:01> întrebări fără răspuns"
+ score: "<1>score:31> postări cu un scor de 3+"
+ question: "<1>is:question1> întrebări de căutare"
+ is_answer: "<1>is:answer1> răspunsuri la căutare"
empty: Nu am putut găsi nimic.
Încearcă cuvinte cheie diferite sau mai puţin specifice.
share:
name: Distribuiți
diff --git a/i18n/ru_RU.yaml b/i18n/ru_RU.yaml
index e716faa95..45e072118 100644
--- a/i18n/ru_RU.yaml
+++ b/i18n/ru_RU.yaml
@@ -1545,10 +1545,10 @@ ui:
title: Советы по расширенному поиску
tag: "<1>[tag]1> поиск по тегу"
user: "<1>user:username1> поиск по автору"
- answer: "<1>ответов:01> вопросы без ответов"
+ answer: "<1>answers:01> вопросы без ответов"
score: "<1>score:31> записи с рейтингом 3+"
question: "<1>is:question1> поиск по вопросам"
- is_answer: "<1>ответ1> поиск ответов"
+ is_answer: "<1>is:answer1> поиск ответов"
empty: Мы ничего не смогли найти.
Попробуйте другие или менее специфичные ключевые слова.
share:
name: Поделиться
diff --git a/i18n/uk_UA.yaml b/i18n/uk_UA.yaml
index 1b7db0339..ecf46ae57 100644
--- a/i18n/uk_UA.yaml
+++ b/i18n/uk_UA.yaml
@@ -1544,11 +1544,11 @@ ui:
tips:
title: Підказки щодо розширеного пошуку
tag: "<1>[tag]1> шукати за тегом"
- user: "<1>користувач:ім'я користувача1> пошук за автором"
- answer: "<1>відповіді:01> питання без відповіді"
- score: "<1>рахунок: 31> записи із 3+ рахунком"
- question: "<1>є:питання1> пошукові питання"
- is_answer: "<1>є:відповідь1> пошукові відповіді"
+ user: "<1>user:username1> пошук за автором"
+ answer: "<1>answers:01> питання без відповіді"
+ score: "<1>score:31> записи із 3+ рахунком"
+ question: "<1>is:question1> пошукові питання"
+ is_answer: "<1>is:answer1> пошукові відповіді"
empty: Ми не змогли нічого знайти.
Спробуйте різні або менш конкретні ключові слова.
share:
name: Поділитись