From 408c6bcbf5e5c58583c1ce6d43e30b344f9eb242 Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Wed, 5 Mar 2025 15:18:34 -0500 Subject: [PATCH 1/2] [i18n] Display a page-may-be-outdated banner Signed-off-by: Patrice Chalin --- content/ja/docs/collector/_index.md | 1 + content/ja/docs/demo/architecture.md | 1 + content/ja/docs/demo/feature-flags.md | 1 + layouts/docs/td-content-after-header.html | 66 +++++++++++++++++------ layouts/partials/i18n/fallback-page.html | 2 +- scripts/check-i18n.sh | 2 +- 6 files changed, 56 insertions(+), 17 deletions(-) diff --git a/content/ja/docs/collector/_index.md b/content/ja/docs/collector/_index.md index ee649938e3b0..15ec61d0619a 100644 --- a/content/ja/docs/collector/_index.md +++ b/content/ja/docs/collector/_index.md @@ -5,6 +5,7 @@ cascade: vers: 0.120.0 weight: 270 default_lang_commit: cd90ab77550fb2e92ca37cb3c753ec2d8bb7d8dc +drifted_from_default: true --- ![Jaeger、OTLP、Prometheusを統合したOpenTelemetryコレクターのダイアグラム](img/otel-collector.svg) diff --git a/content/ja/docs/demo/architecture.md b/content/ja/docs/demo/architecture.md index 49e7b8e64e2b..473f4217a35b 100644 --- a/content/ja/docs/demo/architecture.md +++ b/content/ja/docs/demo/architecture.md @@ -4,6 +4,7 @@ linkTitle: アーキテクチャ aliases: [current_architecture] body_class: otel-mermaid-max-width default_lang_commit: fd7da211d5bc37ca93112a494aaf6a94445e2e28 +drifted_from_default: true --- **OpenTelemetryデモ** は、異なるプログラミング言語で書かれた複数のマイクロサービスから構成されており、gRPCとHTTPを使って相互に通信を行います。 diff --git a/content/ja/docs/demo/feature-flags.md b/content/ja/docs/demo/feature-flags.md index 771cf542da60..0c676121e532 100644 --- a/content/ja/docs/demo/feature-flags.md +++ b/content/ja/docs/demo/feature-flags.md @@ -5,6 +5,7 @@ aliases: - services/feature-flag - services/featureflagservice default_lang_commit: 24146bd1368e4c6082c7d6077efd29dba0d51055 +drifted_from_default: true cSpell:ignore: loadgenerator OLJCESPC7Z --- diff --git a/layouts/docs/td-content-after-header.html b/layouts/docs/td-content-after-header.html index 9e386e8c8e88..3fac0bf2389f 100644 --- a/layouts/docs/td-content-after-header.html +++ b/layouts/docs/td-content-after-header.html @@ -1,29 +1,66 @@ {{ $pageProseLang := partial "i18n/lang.html" . -}} {{ $siteLang := .Site.Language -}} -{{/* +{{ if ne .Language.Lang "en" -}} + {{ if .Params.drifted_from_default -}} + {{ with partial "_inline/ot-page-drifted-banner.html" . -}} + {{ . -}} + {{ end -}} + {{ else if ne $siteLang $pageProseLang -}} + {{ with partial "_inline/ot-page-not-found-banner.html" . -}} +
+
+ {{ . }} +
+
+ {{ end -}} + {{ else if false -}} + {{ with partial "_inline/ot-page-drifted-banner.html" . -}} + {{ . -}} + {{ end -}} + {{ end -}} +{{ 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 +{{ define "partials/_inline/ot-page-drifted-banner.html" }} + {{/* Assumption: .Params.drifted_from_default */ -}} -*/ -}} + {{ $resultsArray := where .Translations "Lang" "en" -}} + {{ $defaultLangPage := index $resultsArray 0 -}} -{{ if and - (ne $siteLang $pageProseLang) - (not (.Param "disable_translation_not_found_msg")) --}} - {{ with partial "_inline/ot-page-not-found-banner.html" . -}}
- {{ . }} +

+ + The content of this page may be outdated and some links may be invalid. + + {{- if and $defaultLangPage .Params.default_lang_commit }} + A newer version of this page exists in + English. +

+ More information ... +

+ To see the changes to the English page since this page was last updated: visit + {{ $compareUrl := printf "%s/compare/%s..%s" + .Site.Params.github_repo .Params.default_lang_commit $defaultLangPage.GitInfo.Hash -}} + + GitHub compare + {{ substr .Params.default_lang_commit 0 8 }}..{{ $defaultLangPage.GitInfo.AbbreviatedHash -}} + + and search for + {{ $defLangPath := strings.TrimPrefix (add hugo.WorkingDir "/") $defaultLangPage.File.Filename -}} + {{ $defLangPath }}. +

+
+ {{ else if not $defaultLangPage }} + This page no longer has a corresponding English page. + {{ end -}} +

-
- {{ end -}} + {{ end -}} + {{ define "partials/_inline/ot-page-not-found-banner.html" }} {{ $path := "page-not-translated-msg.md" -}} {{ $args := (dict @@ -37,4 +74,3 @@ {{ warnf "_inline/ot-page-not-found-banner: '%s' not found from page %s (%s)" $path .Page.Path $lang -}} {{ end -}} {{ end -}} - diff --git a/layouts/partials/i18n/fallback-page.html b/layouts/partials/i18n/fallback-page.html index 315aaaa01925..73e3f931885b 100644 --- a/layouts/partials/i18n/fallback-page.html +++ b/layouts/partials/i18n/fallback-page.html @@ -2,7 +2,7 @@ Returns the fallback page of this page, if it has one. A fallback page is a page in the default site language that has been mounted under this locale as a - fallback when this locale is missing a translation. + fallback when this locale is missing a page translation. */ -}} diff --git a/scripts/check-i18n.sh b/scripts/check-i18n.sh index a17313a73a3e..7128831c14ff 100755 --- a/scripts/check-i18n.sh +++ b/scripts/check-i18n.sh @@ -317,7 +317,7 @@ function main() { if [[ ! -e "$EN_VERSION" ]]; then ((FILE_PROCESSED_COUNT++)) if [[ -z $FLAG_QUIET ]]; then - echo -e "File not found:\t$EN_VERSION - $f - $DEFAULT_LANG was removed or renamed" + echo -e "File not found:\t$f - $DEFAULT_LANG page was removed or renamed" fi set_file_drifted_status "$f" "file not found" continue From eb1da9fbb3421cb655ca65ab6c6a6aeb74f754b3 Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Wed, 5 Mar 2025 15:44:44 -0500 Subject: [PATCH 2/2] Don't link-check page-diff compares --- layouts/docs/td-content-after-header.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/docs/td-content-after-header.html b/layouts/docs/td-content-after-header.html index 3fac0bf2389f..74db6da003ac 100644 --- a/layouts/docs/td-content-after-header.html +++ b/layouts/docs/td-content-after-header.html @@ -43,7 +43,7 @@ To see the changes to the English page since this page was last updated: visit {{ $compareUrl := printf "%s/compare/%s..%s" .Site.Params.github_repo .Params.default_lang_commit $defaultLangPage.GitInfo.Hash -}} - + GitHub compare {{ substr .Params.default_lang_commit 0 8 }}..{{ $defaultLangPage.GitInfo.AbbreviatedHash -}}