|
| 1 | +--- |
| 2 | +--- |
| 3 | + |
| 4 | +title: Localización del sitio description: Creación y mantenimiento de páginas |
| 5 | +del sitio en localizaciones que no están en inglés. linkTitle: Localización |
| 6 | +weight: 25 cSpell:ignore: shortcodes default_lang_commit: |
| 7 | +f2a520b85d72db706bff91d879f5bb10fd2e7367 |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +El sitio web de OTel utiliza el |
| 12 | +[framework multilingüe](https://gohugo.io/content-management/multilingual/) de |
| 13 | +Hugo para soportar la localización de páginas. El inglés es el idioma |
| 14 | +predeterminado, con inglés estadounidense como la localización predeterminada |
| 15 | +(implícita). Se admite un número creciente de otras localizaciones, como se |
| 16 | +puede ver en el menú desplegable de idiomas en la barra de navegación superior. |
| 17 | + |
| 18 | +### Resumen |
| 19 | + |
| 20 | +#### ✅ Hacer {#do} |
| 21 | + |
| 22 | +<div class="border-start border-success bg-success-subtle"> |
| 23 | + |
| 24 | +- **Traducir**: |
| 25 | + - El contenido de la página, incluyendo: |
| 26 | + - Campos de texto en diagramas [Mermaid](#images) |
| 27 | + - Comentarios de código extraídos de extractos de código |
| 28 | + - Los valores de los campos de [Front matter][] para `title`, `linkTitle` y |
| 29 | + `description` |
| 30 | + - **Todo** el contenido de la página y el front matter, a menos que se indique |
| 31 | + lo contrario |
| 32 | +- **Preservar** el _contenido_, _significado_ y _estilo_ del texto original |
| 33 | +- **Consultar** a los [maintainers] si tienes dudas o preguntas a través de: |
| 34 | + - Canales de [Slack] `#otel-docs-localization` o `#otel-comms` |
| 35 | + - [Discusión], issue o comentario en un PR |
| 36 | + |
| 37 | +[Discusión]: |
| 38 | + https://github.com/open-telemetry/opentelemetry.io/discussions?discussions_q=is%3Aopen+label%3Ai18n |
| 39 | + |
| 40 | +</div> |
| 41 | + |
| 42 | +#### ❌ No traducir {#do-not} |
| 43 | + |
| 44 | +<div class="border-start border-warning bg-warning-subtle"> |
| 45 | + |
| 46 | +- **No traducir**: |
| 47 | + - **Nombres de archivos o directorios** de recursos en este repositorio |
| 48 | + - [Enlaces](#links), esto incluye los [IDs de encabezados](#headings).[^*] |
| 49 | + - Campos de [Front matter][] distintos a los mencionados en [Hacer](#do). En |
| 50 | + particular, no traduzcas `aliases`. Si tienes dudas, consulta a los |
| 51 | + maintainers. |
| 52 | + - Código |
| 53 | +- Crear **copias de imágenes**, a menos que |
| 54 | + [localices el texto dentro de las imágenes](#images) |
| 55 | +- Añadir o modificar: |
| 56 | + - **Contenido** que altere el significado original |
| 57 | + - Estilo de **presentación**, incluyendo: _formato_, _diseño_ y estilo de |
| 58 | + _diseño_ (por ejemplo, tipografía, uso de mayúsculas y espaciado). |
| 59 | + |
| 60 | +[^*]: Para una posible excepción, consulta [Enlaces](#links). |
| 61 | + |
| 62 | +</div> |
| 63 | + |
| 64 | +### IDs de encabezados {#headings} |
| 65 | + |
| 66 | +Para garantizar que los anclajes de los encabezados sean uniformes en todas las |
| 67 | +localizaciones, al traducir encabezados: |
| 68 | + |
| 69 | +- Conserva el ID explícito del encabezado si lo tiene. La [sintaxis del ID de |
| 70 | + encabezado][] se escribe después del texto del encabezado usando la sintaxis |
| 71 | + `{ #un-id }`. |
| 72 | +- De lo contrario, declara explícitamente un ID de encabezado que corresponda al |
| 73 | + ID autogenerado del encabezado original en inglés. |
| 74 | + |
| 75 | +[Sintaxis del ID de encabezado]: |
| 76 | + https://github.com/yuin/goldmark/blob/master/README.md#headings |
| 77 | + |
| 78 | +### Enlaces {#links} |
| 79 | + |
| 80 | +**No** traduzcas las referencias de enlaces. Esto aplica tanto para enlaces |
| 81 | +externos como para rutas a páginas del sitio web y recursos locales de la |
| 82 | +sección, como [imágenes](#images). |
| 83 | + |
| 84 | +La única excepción son los enlaces a páginas externas (como |
| 85 | +<https://en.wikipedia.org>) que tengan una versión específica para tu idioma. A |
| 86 | +menudo, esto significa reemplazar el `en` en la URL por el código de idioma de |
| 87 | +tu localización. |
| 88 | + |
| 89 | +{{% alert title="Nota" %}} |
| 90 | + |
| 91 | +El repositorio del sitio web de OTel tiene un hook personalizado de renderizado |
| 92 | +de enlaces que Hugo utiliza para convertir rutas absolutas de enlaces que |
| 93 | +refieren a páginas de documentación. **Los enlaces con la forma |
| 94 | +`/docs/una-pagina` se hacen específicos para la localización** al anteponer el |
| 95 | +código de idioma al renderizar el enlace. Por ejemplo, la ruta del ejemplo |
| 96 | +anterior se convierte en `/ja/docs/una-pagina` cuando se renderiza desde una |
| 97 | +página en japonés. |
| 98 | + |
| 99 | +{{% /alert %}} |
| 100 | + |
| 101 | +### Images and diagrams {#images} |
| 102 | + |
| 103 | +Do **not** make copies of image files unless you localize text in the image |
| 104 | +itself[^shared-images]. |
| 105 | + |
| 106 | +**Do** translate text in [Mermaid][] diagrams. |
| 107 | + |
| 108 | +[^shared-images]: |
| 109 | + Hugo is smart about the way that it renders image files that are shared |
| 110 | + across site localizations. That is, Hugo will output a _single_ image file |
| 111 | + and share it across locales. |
| 112 | + |
| 113 | +[Mermaid]: https://mermaid.js.org |
| 114 | + |
| 115 | +### Include files {#includes} |
| 116 | + |
| 117 | +**Do** translate page fragments found under `_includes` directories just as you |
| 118 | +would translate any other page content. |
| 119 | + |
| 120 | +### Shortcodes |
| 121 | + |
| 122 | +{{% alert title="Note" %}} |
| 123 | + |
| 124 | +As of February 2025, we are in the process of migrating from shortcodes to |
| 125 | +[include files](#includes) as a means of supporting shared-page content. |
| 126 | + |
| 127 | +{{% /alert %}} |
| 128 | + |
| 129 | +Some of the base shortcodes contain English text that you might need to localize |
| 130 | +-- this is particularly true of those contained in [layouts/shortcodes/docs]. |
| 131 | + |
| 132 | +If you need to create a localized version of a shortcode, place it under |
| 133 | +`layouts/shortcodes/xx`, where `xx` is your localization's language code. From |
| 134 | +there, use the same relative path as the original base shortcode. |
| 135 | + |
| 136 | +[layouts/shortcodes/docs]: |
| 137 | + https://github.com/open-telemetry/opentelemetry.io/tree/main/layouts/shortcodes/docs |
| 138 | + |
| 139 | +## Keeping track of localized-page drift {#track-changes} |
| 140 | + |
| 141 | +One of the main challenges of maintaining localized pages, is identifying when |
| 142 | +the corresponding English language pages have been updated. This section |
| 143 | +explains how we handle this. |
| 144 | + |
| 145 | +### The `default_lang_commit` front-matter field |
| 146 | + |
| 147 | +When a localized page is written, such as `content/zh/<some-path>/page.md`, this |
| 148 | +translation is based on a specific [`main` branch commit][main] of the |
| 149 | +corresponding English language version of the page at |
| 150 | +`content/en/<some-path>/page.md`. In this repository, every localized page |
| 151 | +identifies the English page commit in the localized page's front matter as |
| 152 | +follows: |
| 153 | + |
| 154 | +```markdown |
| 155 | +--- |
| 156 | +title: Your localized page title |
| 157 | +# ... |
| 158 | +default_lang_commit: <most-recent-commit-hash-of-default-language-page> |
| 159 | +--- |
| 160 | +``` |
| 161 | + |
| 162 | +The front matter above would be in `content/zh/<some-path>/page.md`. The commit |
| 163 | +hash would correspond to the latest commit of `content/en/<some-path>/page.md` |
| 164 | +from the `main` branch. |
| 165 | + |
| 166 | +### Tracking changes to English pages |
| 167 | + |
| 168 | +As updates are made to English language pages, you can keep track of the |
| 169 | +corresponding localized pages that need updating by running the following |
| 170 | +command: |
| 171 | + |
| 172 | +```console |
| 173 | +$ npm run check:i18n |
| 174 | +1 1 content/en/docs/platforms/kubernetes/_index.md - content/zh/docs/platforms/kubernetes/_index.md |
| 175 | +... |
| 176 | +``` |
| 177 | + |
| 178 | +You can restrict the target pages to one or more localizations by providing |
| 179 | +path(s) like this: |
| 180 | + |
| 181 | +```sh |
| 182 | +npm run check:i18n -- content/zh |
| 183 | +``` |
| 184 | + |
| 185 | +### Viewing change details |
| 186 | + |
| 187 | +For any given localized pages that need updating, you can see the diff details |
| 188 | +of the corresponding English language pages by using the `-d` flag and providing |
| 189 | +the paths to your localized pages, or omit the paths to see all. For example: |
| 190 | + |
| 191 | +```console |
| 192 | +$ npm run check:i18n -- -d content/zh/docs/platforms/kubernetes |
| 193 | +diff --git a/content/en/docs/platforms/kubernetes/_index.md b/content/en/docs/platforms/kubernetes/_index.md |
| 194 | +index 3592df5d..c7980653 100644 |
| 195 | +--- a/content/en/docs/platforms/kubernetes/_index.md |
| 196 | ++++ b/content/en/docs/platforms/kubernetes/_index.md |
| 197 | +@@ -1,7 +1,7 @@ |
| 198 | + --- |
| 199 | + title: OpenTelemetry with Kubernetes |
| 200 | + linkTitle: Kubernetes |
| 201 | +-weight: 11 |
| 202 | ++weight: 350 |
| 203 | + description: Using OpenTelemetry with Kubernetes |
| 204 | + --- |
| 205 | +``` |
| 206 | + |
| 207 | +### Adding `default_lang_commit` to new pages |
| 208 | + |
| 209 | +As you create pages for your localization, remember to add `default_lang_commit` |
| 210 | +to the page front matter along with an appropriate commit hash from `main`. |
| 211 | + |
| 212 | +If your page translation is based on an English page in `main` at `<hash>`, then |
| 213 | +run the following command to automatically add `default_lang_commit` to your |
| 214 | +page file's front matter using the commit `<hash>`. You can specify `HEAD` as an |
| 215 | +argument if your pages are now synced with `main` at `HEAD`. For example: |
| 216 | + |
| 217 | +```sh |
| 218 | +npm run check:i18n -- -n -c 1ca30b4d content/ja |
| 219 | +npm run check:i18n -- -n -c HEAD content/zh/docs/concepts |
| 220 | +``` |
| 221 | + |
| 222 | +To list localization page files with missing hash keys, run: |
| 223 | + |
| 224 | +```sh |
| 225 | +npm run check:i18n -- -n |
| 226 | +``` |
| 227 | + |
| 228 | +### Updating `default_lang_commit` for existing pages |
| 229 | + |
| 230 | +As you update your localized pages to match changes made to the corresponding |
| 231 | +English language page, ensure that you also update the `default_lang_commit` |
| 232 | +commit hash. |
| 233 | + |
| 234 | +{{% alert title="Tip" %}} |
| 235 | + |
| 236 | +If your localized page now corresponds to the English language version in `main` |
| 237 | +at `HEAD`, then erase the commit hash value in the front matter, and run the |
| 238 | +**add** command given in the previous section to automatically refresh the |
| 239 | +`default_lang_commit` field value. |
| 240 | + |
| 241 | +{{% /alert %}} |
| 242 | + |
| 243 | +If you have batch updated all of your localization pages that had drifted, you |
| 244 | +can update the commit hash of these files using the `-c` flag followed by a |
| 245 | +commit hash or 'HEAD' to use `main@HEAD`. |
| 246 | + |
| 247 | +```sh |
| 248 | +npm run check:i18n -- -c <hash> <PATH-TO-YOUR-NEW-FILES> |
| 249 | +npm run check:i18n -- -c HEAD <PATH-TO-YOUR-NEW-FILES> |
| 250 | +``` |
| 251 | + |
| 252 | +{{% alert title="Important" %}} |
| 253 | + |
| 254 | +When you use `HEAD` as a hash specifier, the script will use the hash of `main` |
| 255 | +at HEAD in your **local environment**. Make sure that you fetch and pull `main`, |
| 256 | +if you want HEAD to correspond to `main` in GitHub. |
| 257 | + |
| 258 | +{{% /alert %}} |
| 259 | + |
| 260 | +### Drift status |
| 261 | + |
| 262 | +Run `npm run fix:i18n:status` to add a front-matter field `drifted_from_default` |
| 263 | +to those target localization pages that have drifted. This field will soon be |
| 264 | +used to display a banner at the top of pages that have drifted relative to their |
| 265 | +English counterparts. |
| 266 | + |
| 267 | +### Script help |
| 268 | + |
| 269 | +For more details about the script, run `npm run check:i18n -- -h`. |
| 270 | + |
| 271 | +## New localizations |
| 272 | + |
| 273 | +To start a new localization for the OpenTelemetry website, |
| 274 | +[raise an issue](https://github.com/open-telemetry/opentelemetry.io/issues/) to |
| 275 | +share your interest to contribute. Tag all other individuals that are willing to |
| 276 | +write and review translations in the language you want to add. **You need at |
| 277 | +least two potential contributors**, ideally three. Include the following task |
| 278 | +list in your issue as well: |
| 279 | + |
| 280 | +```markdown |
| 281 | +- [ ] Contributors for the new language: @GITHUB_HANDLE1, @GITHUB_HANDLE2, ... |
| 282 | +- [ ] Localize site homepage to YOUR_LANGUAGE_NAME |
| 283 | +- [ ] Create an issue label for `lang:LANG_ID` |
| 284 | +- [ ] Create org-level group for `LANG_ID` approvers |
| 285 | +- [ ] Update components owners for `content/LANG_ID` |
| 286 | +- [ ] Set up spell checking, if a cSpell dictionary is available |
| 287 | +``` |
| 288 | + |
| 289 | +Notes: |
| 290 | + |
| 291 | +- For `LANG_ID`, use an official |
| 292 | + [ISO 639-1 code](https://en.wikipedia.org/wiki/ISO_639-1) for the language you |
| 293 | + want to add. |
| 294 | +- Look for |
| 295 | + [cSpell dictionaries](https://github.com/streetsidesoftware/cspell-dicts) |
| 296 | + available as NPM packages |
| 297 | + [@cspell/dict-LANG_ID](https://www.npmjs.com/search?q=%40cspell%2Fdict). If a |
| 298 | + dictionary isn't available for your dialect or region, choose the closest |
| 299 | + region. For an example of how to set this up, see [PR #5386]. |
| 300 | + |
| 301 | +After you created that issue and have the required amount of contributors, |
| 302 | +maintainers will ask you to provide a pull request with a translation of the |
| 303 | +[index page](https://github.com/open-telemetry/opentelemetry.io/blob/main/content/en/_index.md). |
| 304 | +Make sure that maintainers are allowed to edit your PR, since they will add |
| 305 | +additional changes to your PR that are required to get your localization project |
| 306 | +started. |
| 307 | + |
| 308 | +With your first PR merged maintainers will take care of setting up the issue |
| 309 | +label, the org-level group and the component owners. |
| 310 | + |
| 311 | +{{% alert title="Important" color="warning" %}} |
| 312 | + |
| 313 | +You don't have to be an existing contributor to the OpenTelemetry project, to |
| 314 | +start a new localization. However you will not be added as a member of the |
| 315 | +[OpenTelemetry GitHub organization](https://github.com/open-telemetry/) or as a |
| 316 | +member of the approvers group for your localization. You will need to satisfy |
| 317 | +the requirements for becoming an established member and approver as outlined in |
| 318 | +the |
| 319 | +[membership guidelines](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md). |
| 320 | + |
| 321 | +When starting the localization project, maintainers will treat your reviews as |
| 322 | +if you are an approver already. |
| 323 | + |
| 324 | +{{% /alert %}} |
| 325 | + |
| 326 | +## English-language maintainer guidance |
| 327 | + |
| 328 | +### When link checking fails for non-English pages |
| 329 | + |
| 330 | +English is the default language of the OpenTelemetry website. After you add, |
| 331 | +edit, or reorganized English language documentation, link checking may fail for |
| 332 | +non-English pages. When this happens: |
| 333 | + |
| 334 | +<!-- markdownlint-disable blanks-around-fences --> |
| 335 | + |
| 336 | +- Do **not** fix the broken links. Each non-English page is associated with a |
| 337 | + specific commit of the corresponding English page, as identified by the git |
| 338 | + commit hash value of the `default_lang_commit` front matter key. |
| 339 | +- Configure the link checker to ignore the non-English pages by adding the |
| 340 | + following to the page's front matter, or to the closest common ancestor file, |
| 341 | + when more than one page has link errors: |
| 342 | + ```yaml |
| 343 | + htmltest: |
| 344 | + # TODO: remove the IgnoreDirs once broken links are fixed |
| 345 | + IgnoreDirs: |
| 346 | + - path-regex/to/non-en/directory/contain/files/to/ignore |
| 347 | + - path-2-etc |
| 348 | + ``` |
| 349 | +- Run `npm run check:links` and include any updates to the `.htmltest.yml` |
| 350 | + config file with your PR. |
| 351 | + |
| 352 | +<!-- markdownlint-enable blanks-around-fences --> |
| 353 | + |
| 354 | +[front matter]: https://gohugo.io/content-management/front-matter/ |
| 355 | +[main]: https://github.com/open-telemetry/opentelemetry.io/commits/main/ |
| 356 | +[maintainers]: https://github.com/orgs/open-telemetry/teams/docs-maintainers |
| 357 | +[multilingual framework]: https://gohugo.io/content-management/multilingual/ |
| 358 | +[PR #5386]: https://github.com/open-telemetry/opentelemetry.io/pull/5386/files |
| 359 | +[slack]: https://slack.cncf.io/ |
0 commit comments