Skip to content

Commit e851eb6

Browse files
authored
[i18n/infra] Introduce include feature with fallback (open-telemetry#6309)
1 parent 7903722 commit e851eb6

File tree

11 files changed

+80
-27
lines changed

11 files changed

+80
-27
lines changed

.cspell.yml

+2
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,5 @@ dictionaries:
5858
words: # Valid words across all locales
5959
- Docsy
6060
- htmltest
61+
# Hugo
62+
- warnf
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: # Bogus entry for markdownlint
3+
_build: { list: never, render: never }
4+
---
5+
6+
{{% alert-md title=Warning color=warning %}}
7+
8+
Client instrumentation for the browser is **experimental** and mostly
9+
**unspecified**. If you are interested in helping out, get in touch with the
10+
[Client Instrumentation SIG][sig].
11+
12+
[sig]:
13+
https://docs.google.com/document/d/16Vsdh-DM72AfMg_FIt9yT9ExEWF4A_vRbQ3jRNBe09w
14+
15+
{{% /alert-md %}}

content/en/docs/languages/js/_index.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ weight: 20
1010

1111
{{% docs/languages/index-intro js /%}}
1212

13-
{{% alert title="Warning" color="warning" %}}
14-
{{% param notes.browser-instrumentation %}} {{% /alert %}}
13+
{{% include browser-instrumentation-warning.md %}}
1514

1615
## Version Support
1716

content/en/docs/languages/js/getting-started/browser.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ description: Learn how to add OpenTelemetry to your browser app
55
weight: 20
66
---
77

8-
{{% alert title="Warning" color="warning" %}}
9-
{{% param notes.browser-instrumentation %}} {{% /alert %}}
8+
{{% include browser-instrumentation-warning.md %}}
109

1110
While this guide uses the example application presented below, the steps to
1211
instrument your own application should be similar.

content/en/docs/languages/js/instrumentation.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,7 @@ above, you have a `TracerProvider` setup for you already. You can continue with
335335

336336
#### Browser
337337

338-
{{% alert title="Warning" color="warning" %}}
339-
{{% param notes.browser-instrumentation %}} {{% /alert %}}
338+
{{% include browser-instrumentation-warning.md %}}
340339

341340
First, ensure you've got the right packages:
342341

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: # Bogus entry for markdownlint
3+
_build: { list: never, render: never }
4+
default_lang_commit: 0dac041dedfe5877f45e36065c1c6fb07490b243
5+
---
6+
7+
{{% alert-md title=Aviso color=warning %}}
8+
9+
A instrumentação do cliente para o navegador é **experimental** e, em grande
10+
parte, **não está especificada**. Caso possua interesse em auxiliar, entre em
11+
contato com o [SIG de Instrumentação do Cliente][sig].
12+
13+
[sig]:
14+
https://docs.google.com/document/d/16Vsdh-DM72AfMg_FIt9yT9ExEWF4A_vRbQ3jRNBe09w
15+
16+
{{% /alert-md %}}

content/pt/docs/languages/js/getting-started/browser.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ weight: 20
66
default_lang_commit: 7cb1bd39726fc03698164ee17fe9087afdac054c
77
---
88

9-
{{% alert title="Aviso" color="warning" %}}
10-
{{% param notes.browser-instrumentation %}} {{% /alert %}}
9+
{{% include browser-instrumentation-warning.md %}}
1110

1211
Embora este guia utilize o exemplo de aplicação apresentada abaixo, as etapas
1312
para instrumentar a sua própria aplicação devem ser similares.

hugo.yaml

+1-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# cSpell:ignore docsy goldmark linkify netlify wordmark noopener
1+
# cSpell:ignore bluesky docsy goldmark linkify netlify wordmark noopener
22
baseURL: https://opentelemetry.io
33
title: OpenTelemetry
44
disableKinds: [taxonomy]
@@ -37,14 +37,6 @@ languages:
3737
languageCode: pt-BR
3838
params:
3939
description: Site do Projeto OpenTelemetry
40-
notes:
41-
browser-instrumentation: |
42-
A instrumentação do cliente para o navegador é **experimental** e,
43-
em grande parte, **não está especificada**. Caso possua interesse em
44-
auxiliar, entre em contato com o [SIG de Instrumentação do
45-
Cliente][sig].
46-
47-
[sig]: https://docs.google.com/document/d/16Vsdh-DM72AfMg_FIt9yT9ExEWF4A_vRbQ3jRNBe09w
4840
zh:
4941
languageName: 中文 (Chinese)
5042
languageCode: zh-cn
@@ -235,12 +227,6 @@ params:
235227
docker-compose-v2: |
236228
`docker-compose` is deprecated. For details, see
237229
[Migrate to Compose V2](https://docs.docker.com/compose/migrate/).
238-
browser-instrumentation: |
239-
Client instrumentation for the browser is **experimental** and mostly **unspecified**.
240-
If you are interested in helping out, get in touch with the
241-
[Client Instrumentation SIG][sig].
242-
243-
[sig]: https://docs.google.com/document/d/16Vsdh-DM72AfMg_FIt9yT9ExEWF4A_vRbQ3jRNBe09w
244230
245231
security:
246232
funcs: # cspell:disable-line

layouts/_default/_markup/render-link.html

+1-4
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,4 @@
9494
{{- .Text | safeHTML -}}
9595
</a>
9696

97-
{{- /*
98-
cSpell:ignore warnf
99-
This comment ensures that all trailing whitespace is trimmed.
100-
*/ -}}
97+
{{- /* Trim trailing whitespace */ -}}

layouts/shortcodes/alert-md.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{/* Temporary, from Docsy */ -}}
2+
3+
{{ $color := .Get "color" | default "primary" -}}
4+
5+
<div class="alert alert-{{ $color }}" role="alert">
6+
{{- with .Get "title" -}}
7+
<div class="h4 alert-heading" role="heading">
8+
{{- . | safeHTML -}}
9+
</div>
10+
{{/* Do **not** remove this comment! It ends the previous HTML block; see https://spec.commonmark.org/0.30/#html-blocks, 7. */}}
11+
{{- end -}}
12+
{{ .Inner -}}
13+
</div>
14+
{{/* */ -}}

layouts/shortcodes/include.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{{/* Use to include Markdown snippets. Note that the included content can have
2+
calls to shortcodes. */ -}}
3+
4+
{{ $path := .Get 0 -}}
5+
{{ if not (or
6+
(strings.HasPrefix $path "/" )
7+
(strings.HasPrefix $path "."))
8+
-}}
9+
{{ $path = printf "_includes/%s" $path -}}
10+
{{ end -}}
11+
12+
{{ template "getPage" (dict "ctx" . "path" $path "page" .Page) -}}
13+
14+
{{ define "getPage" -}}
15+
{{ $page_to_include := .page.GetPage .path -}}
16+
{{ with $page_to_include -}}
17+
{{ .Content -}}
18+
{{ else -}}
19+
{{ $parent := .page.Parent -}}
20+
{{ if $parent -}}
21+
{{ template "getPage" (dict "ctx" .ctx "path" .path "page" $parent) -}}
22+
{{ else -}}
23+
{{ warnf "File not found: %s in page: %s" .path .ctx.Page.Path -}}
24+
**ERROR**: File not found: {{ .path }}.
25+
{{end -}}
26+
{{ end -}}
27+
{{ end -}}

0 commit comments

Comments
 (0)