mirror of https://github.com/vapor/docs.git
Update Search Index Script for new languages (#854)
This commit is contained in:
parent
eae2c9b388
commit
ceca45e819
|
|
@ -69,7 +69,7 @@ You can check it out by running `mkdocs serve` in the terminal. Once you are sat
|
|||
|
||||
> NOTE: If a file isn't translated, it will just default to the default language file. So you don't have to translate everything all at once.
|
||||
|
||||
Finally, you should add the new language to the [issue template](https://github.com/vapor/docs/blob/main/.github/workflows/translation-issue-template.md) to ensure that any future changes are applied to the new translation.
|
||||
Finally, you should add the new language to the [issue template](https://github.com/vapor/docs/blob/main/.github/workflows/translation-issue-template.md) to ensure that any future changes are applied to the new translation and to the [search index script](https://github.com/vapor/docs/blob/main/fixSearchIndex.swift) to ensure search works correctly.
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -37,13 +37,22 @@ let searchIndex = try JSONDecoder().decode(SearchIndex.self, from: indexData)
|
|||
var newSearchIndex = searchIndex
|
||||
var searchIndexDocs = [SearchIndexDocs]()
|
||||
|
||||
let knownLanguages = [
|
||||
"en",
|
||||
"de",
|
||||
"es",
|
||||
"fr",
|
||||
"it",
|
||||
"ko",
|
||||
"nl",
|
||||
"pl",
|
||||
"zh",
|
||||
].map { "\($0)/" }
|
||||
|
||||
|
||||
for doc in newSearchIndex.docs {
|
||||
if !doc.location.starts(with: "en/")
|
||||
&& !doc.location.starts(with: "zh/")
|
||||
&& !doc.location.starts(with: "de/")
|
||||
&& !doc.location.starts(with: "fr/")
|
||||
&& !doc.location.starts(with: "nl/") {
|
||||
searchIndexDocs.append(doc)
|
||||
if !knownLanguages.contains(where: { doc.location.starts(with: $0) }) {
|
||||
searchIndexDocs.append(doc)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue