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] Suche mit einem Tag" user: "<1>user:username Suche nach Autor" - answer: "<1>Antworten:0 unbeantwortete Fragen" + answer: "<1>answers:0 unbeantwortete Fragen" score: "<1>score:3 Beiträge mit einer 3+ Punktzahl" question: "<1>is:question Suchfragen" - is_answer: "<1>ist:answer Suchantworten" + is_answer: "<1>is:answer 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] recherche à l'aide d'un tag" - user: "<1>utilisateur:username recherche par auteur" - answer: "<1>réponses:0 questions sans réponses" + user: "<1>user:username recherche par auteur" + answer: "<1>answers:0 questions sans réponses" score: "<1>score:3 messages avec plus de 3 points" - question: "<1>est:question rechercher des questions" - is_answer: "<1>est :réponse réponses de recherche" + question: "<1>is:question rechercher des questions" + is_answer: "<1>is:answer 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> 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>(.*?)`) + 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] cerca dentro un tag" user: "<1>user:username ricerca per autore" - answer: "<1>risposte:0 domande senza risposta" - score: "<1>punteggio:3 messaggi con un punteggio di 3+" + answer: "<1>answers:0 domande senza risposta" + score: "<1>score:3 messaggi con un punteggio di 3+" question: "<1>is:question cerca domande" is_answer: "<1>is:answer 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] タグで検索" - user: "<1>ユーザー:ユーザー名作成者による検索" - answer: "<1>回答:0未回答の質問" - score: "<1>スコア:33以上のスコアを持つ投稿" - question: "<1>質問質問を検索" - is_answer: "<1>は答え答えを検索" + user: "<1>user:username作成者による検索" + answer: "<1>answers:0未回答の質問" + score: "<1>score:33以上のスコアを持つ投稿" + question: "<1>is:question質問を検索" + is_answer: "<1>is:answer答えを検索" 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] search with a tag" user: "<1>user:username wyszukiwanie według autora" - answer: "<1> answers:0 pytania bez odpowiedzi" + answer: "<1>answers:0 pytania bez odpowiedzi" score: "<1>score:3 posty z oceną 3+" question: "<1>is:question wyszukiwanie pytań" is_answer: "<1>is:answer 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] search with a tag" - user: "<1>utilizator:username căutare de către autor" - answer: "<1>răspunsuri:0 întrebări fără răspuns" - score: "<1>scor:3 postări cu un scor de 3+" - question: "<1>este:question întrebări de căutare" - is_answer: "<1>este:răspuner răspunsuri la căutare" + user: "<1>user:username căutare de către autor" + answer: "<1>answers:0 întrebări fără răspuns" + score: "<1>score:3 postări cu un scor de 3+" + question: "<1>is:question întrebări de căutare" + is_answer: "<1>is:answer 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] поиск по тегу" user: "<1>user:username поиск по автору" - answer: "<1>ответов:0 вопросы без ответов" + answer: "<1>answers:0 вопросы без ответов" score: "<1>score:3 записи с рейтингом 3+" question: "<1>is:question поиск по вопросам" - is_answer: "<1>ответ поиск ответов" + is_answer: "<1>is:answer поиск ответов" 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] шукати за тегом" - user: "<1>користувач:ім'я користувача пошук за автором" - answer: "<1>відповіді:0 питання без відповіді" - score: "<1>рахунок: 3 записи із 3+ рахунком" - question: "<1>є:питання пошукові питання" - is_answer: "<1>є:відповідь пошукові відповіді" + user: "<1>user:username пошук за автором" + answer: "<1>answers:0 питання без відповіді" + score: "<1>score:3 записи із 3+ рахунком" + question: "<1>is:question пошукові питання" + is_answer: "<1>is:answer пошукові відповіді" empty: Ми не змогли нічого знайти.
Спробуйте різні або менш конкретні ключові слова. share: name: Поділитись