-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[i18n] Support localization of page-not-translated banner (#6339)
- Loading branch information
Showing
13 changed files
with
127 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
title: # Bogus entry for markdownlint | ||
_build: { list: never, render: never } | ||
--- | ||
|
||
<i class="fa-solid fa-circle-info" style="margin-left: -1.5rem"></i> You are | ||
viewing the **English version** of this page because it has not yet been | ||
translated. Interested in helping out? See [Contributing](/docs/contributing/). |
This file contains 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
File renamed without changes.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
title: # Bogus entry for markdownlint | ||
_build: { list: never, render: never } | ||
default_lang_commit: 8d115a9df96c52dbbb3f96c05a843390d90a9800 | ||
--- | ||
|
||
<i class="fa-solid fa-circle-info" style="margin-left: -1.5rem"></i> Você está | ||
visualizando a versão em **versão em inglês** desta página porque ela ainda não | ||
foi traduzida. Possui interesse em ajudar? Veja | ||
[como contribuir](/docs/contributing/). |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,40 @@ | ||
{{ $pageProseLang := partial "i18n/lang.html" . -}} | ||
{{ $siteLang := .Site.Language -}} | ||
|
||
{{ if ne $siteLang $pageProseLang -}} | ||
|
||
<div class="pageinfo pageinfo-secondary"> | ||
<p class="ps-4"> | ||
<i class="fa-solid fa-circle-info" style="margin-left: -1.5rem"></i> | ||
You are viewing the <strong>English version</strong> of this page because it | ||
has not yet been translated. Interested in helping out? See | ||
<a href="/docs/contributing/">Contributing</a>. | ||
</p> | ||
</div> | ||
|
||
{{- end -}} | ||
{{/* | ||
|
||
The disable_translation_not_found_msg param isn't currently used and I suspect | ||
that we won't need it, but I'll wait until the following feature is implemented | ||
before removing the code: | ||
|
||
https://github.com/open-telemetry/opentelemetry.io/issues/6340 | ||
|
||
*/ -}} | ||
|
||
{{ if and | ||
(ne $siteLang $pageProseLang) | ||
(not (.Param "disable_translation_not_found_msg")) | ||
-}} | ||
{{ with partial "_inline/ot-page-not-found-banner.html" . -}} | ||
<div class="pageinfo pageinfo-secondary"> | ||
<div class="ps-4"> | ||
{{ . }} | ||
</div> | ||
</div> | ||
{{ end -}} | ||
{{ end -}} | ||
|
||
{{ define "partials/_inline/ot-page-not-found-banner.html" }} | ||
{{ $path := "page-not-translated-msg.md" -}} | ||
{{ $args := (dict | ||
"path" $path | ||
"page" .Page) -}} | ||
{{ $page := partial "func/find-include.html" $args -}} | ||
{{ with $page -}} | ||
{{ .Content }} | ||
{{ else -}} | ||
{{ $lang := .Page.Language.Lang -}} | ||
{{ warnf "_inline/ot-page-not-found-banner: '%s' not found from page %s (%s)" $path .Page.Path $lang -}} | ||
{{ end -}} | ||
{{ end -}} | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{{/* | ||
Args: .path .page | ||
|
||
Looks for the page specified by .path, starting from .page, moving up the | ||
.Parent relation if necessary. If .path isn't explicitly absolute or relative, | ||
"_includes/" is prepended to it. | ||
|
||
*/ -}} | ||
|
||
{{ $path := .path -}} | ||
{{ if not (or | ||
(strings.HasPrefix $path "/" ) | ||
(strings.HasPrefix $path ".")) | ||
-}} | ||
{{ $path = printf "_includes/%s" $path -}} | ||
{{ end -}} | ||
|
||
{{ $result := partial "func/_find-include.html" (dict "path" $path "page" .page) -}} | ||
{{ return $result -}} | ||
|
||
{{ define "partials/func/_find-include.html" -}} | ||
{{ $result := "" -}} | ||
{{ $page_to_include := .page.GetPage .path -}} | ||
|
||
{{ with $page_to_include -}} | ||
{{ $result = . }} | ||
{{ else -}} | ||
{{ $parent := .page.Parent -}} | ||
{{ if $parent -}} | ||
{{ $result = partial "func/_find-include.html" (dict "path" .path "page" $parent) -}} | ||
{{end -}} | ||
{{ end -}} | ||
|
||
{{ return $result -}} | ||
{{ end -}} |
This file contains 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