|
| 1 | +--- |
| 2 | +title: Localización del sitio |
| 3 | +description: |
| 4 | + Creación y mantenimiento de páginas del sitio en localizaciones no inglesas. |
| 5 | +linkTitle: Localización |
| 6 | +weight: 25 |
| 7 | +cSpell:ignore: shortcodes |
| 8 | +default_lang_commit: 56dcd5a47eba51a1a2bed49db83a460a1a8d8a06 |
| 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 | +## Guía de traducción |
| 19 | + |
| 20 | +Al traducir páginas del sitio web desde el inglés, recomendamos seguir la guía |
| 21 | +ofrecida en esta sección. |
| 22 | + |
| 23 | +### Resumen / TL;DR {#summary} |
| 24 | + |
| 25 | +Traducir: |
| 26 | + |
| 27 | +- Los campos de [Front matter][] `title`, `linkTitle` y `description`. |
| 28 | +- El contenido de la página, incluidos los campos de texto en los |
| 29 | + [diagramas](#images) de Mermaid. |
| 30 | + |
| 31 | +**No** traducir: |
| 32 | + |
| 33 | +- Traducir: |
| 34 | + - Nombres de **archivos o directorios** de recursos en este repositorio. |
| 35 | + - [Enlaces](#links), esto incluye los [IDs de encabezado](#headings).[^*] |
| 36 | + - Campos de [Front matter][] distintos a los mencionados en la sección |
| 37 | + "Traducir" anterior. En particular, no traduzcas `aliases`. En caso de duda, |
| 38 | + consulta con los mantenedores. |
| 39 | +- Crear **copias de imágenes**, a menos que |
| 40 | + [localices el texto dentro de las imágenes](#images). |
| 41 | + |
| 42 | +[^*]: Para una posible excepción, consulta [Enlaces](#links). |
| 43 | + |
| 44 | +### Heading IDs {#headings} |
| 45 | + |
| 46 | +To ensure that heading anchor targets are uniform across localizations, when |
| 47 | +translating headings: |
| 48 | + |
| 49 | +- Preserve the heading's explicit ID if it has one. [Heading ID syntax][] is |
| 50 | + written after the heading text using syntax like `{ #some-id }`. |
| 51 | +- Otherwise, explicitly declare a heading ID corresponding to the autogenerated |
| 52 | + ID of the original English heading. |
| 53 | + |
| 54 | +[Heading ID syntax]: |
| 55 | + https://github.com/yuin/goldmark/blob/master/README.md#headings |
| 56 | + |
| 57 | +### Links {#links} |
| 58 | + |
| 59 | +Do **not** translate link references. This holds true for external links, and |
| 60 | +paths to website pages and section-local resources such as [images](#images). |
| 61 | + |
| 62 | +The only exception is for links to external pages (such as |
| 63 | +<https://en.wikipedia.org>) that have a version specific to your local. Often |
| 64 | +this means replacing the `en` in the URL by your locale's language code. |
| 65 | + |
| 66 | +{{% alert title="Note" %}} |
| 67 | + |
| 68 | +The OTel website repository has a custom render-link hook that Hugo uses to |
| 69 | +convert absolute link paths referring to documentation pages. **Links of the |
| 70 | +form `/docs/some-page` are made locale specific** by prefixing the path with the |
| 71 | +page language code when rendering the link. For example, the previous sample |
| 72 | +path would become `/ja/docs/some-page` when rendered from a Japanese page. |
| 73 | + |
| 74 | +{{% /alert %}} |
| 75 | + |
| 76 | +### Images and diagrams {#images} |
| 77 | + |
| 78 | +Do **not** make copies of image files unless you localize text in the image |
| 79 | +itself[^shared-images]. |
| 80 | + |
| 81 | +**Do** translate text in [Mermaid][] diagrams. |
| 82 | + |
| 83 | +[^shared-images]: |
| 84 | + Hugo is smart about the way that it renders image files that are shared |
| 85 | + across site localizations. That is, Hugo will output a _single_ image file |
| 86 | + and share it across locales. |
| 87 | + |
| 88 | +[Mermaid]: https://mermaid.js.org |
| 89 | + |
| 90 | +### Include files {#includes} |
| 91 | + |
| 92 | +**Do** translate page fragments found under `_includes` directories just as you |
| 93 | +would translate any other page content. |
| 94 | + |
| 95 | +### Shortcodes |
| 96 | + |
| 97 | +{{% alert title="Note" %}} |
| 98 | + |
| 99 | +As of February 2025, we are in the process of migrating from shortcodes to |
| 100 | +[include files](#includes) as a means of supporting shared-page content. |
| 101 | + |
| 102 | +{{% /alert %}} |
| 103 | + |
| 104 | +Some of the base shortcodes contain English text that you might need to localize |
| 105 | +-- this is particularly true of those contained in [layouts/shortcodes/docs]. |
| 106 | + |
| 107 | +If you need to create a localized version of a shortcode, place it under |
| 108 | +`layouts/shortcodes/xx`, where `xx` is your localization's language code. From |
| 109 | +there, use the same relative path as the original base shortcode. |
| 110 | + |
| 111 | +[layouts/shortcodes/docs]: |
| 112 | + https://github.com/open-telemetry/opentelemetry.io/tree/main/layouts/shortcodes/docs |
| 113 | + |
| 114 | +## Keeping track of localized-page drift {#track-changes} |
| 115 | + |
| 116 | +One of the main challenges of maintaining localized pages, is identifying when |
| 117 | +the corresponding English language pages have been updated. This section |
| 118 | +explains how we handle this. |
| 119 | + |
| 120 | +### The `default_lang_commit` front-matter field |
| 121 | + |
| 122 | +When a localized page is written, such as `content/zh/<some-path>/page.md`, this |
| 123 | +translation is based on a specific [`main` branch commit][main] of the |
| 124 | +corresponding English language version of the page at |
| 125 | +`content/en/<some-path>/page.md`. In this repository, every localized page |
| 126 | +identifies the English page commit in the localized page's front matter as |
| 127 | +follows: |
| 128 | + |
| 129 | +```markdown |
| 130 | +--- |
| 131 | +title: Your localized page title |
| 132 | +# ... |
| 133 | +default_lang_commit: <most-recent-commit-hash-of-default-language-page> |
| 134 | +--- |
| 135 | +``` |
| 136 | + |
| 137 | +The front matter above would be in `content/zh/<some-path>/page.md`. The commit |
| 138 | +hash would correspond to the latest commit of `content/en/<some-path>/page.md` |
| 139 | +from the `main` branch. |
| 140 | + |
| 141 | +### Tracking changes to English pages |
| 142 | + |
| 143 | +As updates are made to English language pages, you can keep track of the |
| 144 | +corresponding localized pages that need updating by running the following |
| 145 | +command: |
| 146 | + |
| 147 | +```console |
| 148 | +$ npm run check:i18n |
| 149 | +1 1 content/en/docs/platforms/kubernetes/_index.md - content/zh/docs/platforms/kubernetes/_index.md |
| 150 | +... |
| 151 | +``` |
| 152 | + |
| 153 | +You can restrict the target pages to one or more localizations by providing |
| 154 | +path(s) like this: |
| 155 | + |
| 156 | +```sh |
| 157 | +npm run check:i18n -- content/zh |
| 158 | +``` |
| 159 | + |
| 160 | +### Viewing change details |
| 161 | + |
| 162 | +For any given localized pages that need updating, you can see the diff details |
| 163 | +of the corresponding English language pages by using the `-d` flag and providing |
| 164 | +the paths to your localized pages, or omit the paths to see all. For example: |
| 165 | + |
| 166 | +```console |
| 167 | +$ npm run check:i18n -- -d content/zh/docs/platforms/kubernetes |
| 168 | +diff --git a/content/en/docs/platforms/kubernetes/_index.md b/content/en/docs/platforms/kubernetes/_index.md |
| 169 | +index 3592df5d..c7980653 100644 |
| 170 | +--- a/content/en/docs/platforms/kubernetes/_index.md |
| 171 | ++++ b/content/en/docs/platforms/kubernetes/_index.md |
| 172 | +@@ -1,7 +1,7 @@ |
| 173 | + --- |
| 174 | + title: OpenTelemetry with Kubernetes |
| 175 | + linkTitle: Kubernetes |
| 176 | +-weight: 11 |
| 177 | ++weight: 350 |
| 178 | + description: Using OpenTelemetry with Kubernetes |
| 179 | + --- |
| 180 | +``` |
| 181 | + |
| 182 | +### Adding `default_lang_commit` to new pages |
| 183 | + |
| 184 | +As you create pages for your localization, remember to add `default_lang_commit` |
| 185 | +to the page front matter along with an appropriate commit hash from `main`. |
| 186 | + |
| 187 | +If your page translation is based on an English page in `main` at `<hash>`, then |
| 188 | +run the following command to automatically add `default_lang_commit` to your |
| 189 | +page file's front matter using the commit `<hash>`. You can specify `HEAD` as an |
| 190 | +argument if your pages are now synced with `main` at `HEAD`. For example: |
| 191 | + |
| 192 | +```sh |
| 193 | +npm run check:i18n -- -n -c 1ca30b4d content/ja |
| 194 | +npm run check:i18n -- -n -c HEAD content/zh/docs/concepts |
| 195 | +``` |
| 196 | + |
| 197 | +To list localization page files with missing hash keys, run: |
| 198 | + |
| 199 | +```sh |
| 200 | +npm run check:i18n -- -n |
| 201 | +``` |
| 202 | + |
| 203 | +### Updating `default_lang_commit` for existing pages |
| 204 | + |
| 205 | +As you update your localized pages to match changes made to the corresponding |
| 206 | +English language page, ensure that you also update the `default_lang_commit` |
| 207 | +commit hash. |
| 208 | + |
| 209 | +{{% alert title="Tip" %}} |
| 210 | + |
| 211 | +If your localized page now corresponds to the English language version in `main` |
| 212 | +at `HEAD`, then erase the commit hash value in the front matter, and run the |
| 213 | +**add** command given in the previous section to automatically refresh the |
| 214 | +`default_lang_commit` field value. |
| 215 | + |
| 216 | +{{% /alert %}} |
| 217 | + |
| 218 | +If you have batch updated all of your localization pages that had drifted, you |
| 219 | +can update the commit hash of these files using the `-c` flag followed by a |
| 220 | +commit hash or 'HEAD' to use `main@HEAD`. |
| 221 | + |
| 222 | +```sh |
| 223 | +npm run check:i18n -- -c <hash> <PATH-TO-YOUR-NEW-FILES> |
| 224 | +npm run check:i18n -- -c HEAD <PATH-TO-YOUR-NEW-FILES> |
| 225 | +``` |
| 226 | + |
| 227 | +{{% alert title="Important" %}} |
| 228 | + |
| 229 | +When you use `HEAD` as a hash specifier, the script will use the hash of `main` |
| 230 | +at HEAD in your **local environment**. Make sure that you fetch and pull `main`, |
| 231 | +if you want HEAD to correspond to `main` in GitHub. |
| 232 | + |
| 233 | +{{% /alert %}} |
| 234 | + |
| 235 | +### Drift status |
| 236 | + |
| 237 | +Run `npm run fix:i18n:status` to add a front-matter field `drifted_from_default` |
| 238 | +to those target localization pages that have drifted. This field will soon be |
| 239 | +used to display a banner at the top of pages that have drifted relative to their |
| 240 | +English counterparts. |
| 241 | + |
| 242 | +### Script help |
| 243 | + |
| 244 | +For more details about the script, run `npm run check:i18n -- -h`. |
| 245 | + |
| 246 | +## New localizations |
| 247 | + |
| 248 | +To start a new localization for the OpenTelemetry website, |
| 249 | +[raise an issue](https://github.com/open-telemetry/opentelemetry.io/issues/) to |
| 250 | +share your interest to contribute. Tag all other individuals that are willing to |
| 251 | +write and review translations in the language you want to add. **You need at |
| 252 | +least two potential contributors**, ideally three. Include the following task |
| 253 | +list in your issue as well: |
| 254 | + |
| 255 | +```markdown |
| 256 | +- [ ] Contributors for the new language: @GITHUB_HANDLE1, @GITHUB_HANDLE2, ... |
| 257 | +- [ ] Localize site homepage to YOUR_LANGUAGE_NAME |
| 258 | +- [ ] Create an issue label for `lang:LANG_ID` |
| 259 | +- [ ] Create org-level group for `LANG_ID` approvers |
| 260 | +- [ ] Update components owners for `content/LANG_ID` |
| 261 | +- [ ] Set up spell checking, if a cSpell dictionary is available |
| 262 | +``` |
| 263 | + |
| 264 | +Notes: |
| 265 | + |
| 266 | +- For `LANG_ID`, use an official |
| 267 | + [ISO 639-1 code](https://en.wikipedia.org/wiki/ISO_639-1) for the language you |
| 268 | + want to add. |
| 269 | +- Look for |
| 270 | + [cSpell dictionaries](https://github.com/streetsidesoftware/cspell-dicts) |
| 271 | + available as NPM packages |
| 272 | + [@cspell/dict-LANG_ID](https://www.npmjs.com/search?q=%40cspell%2Fdict). If a |
| 273 | + dictionary isn't available for your dialect or region, choose the closest |
| 274 | + region. For an example of how to set this up, see [PR #5386]. |
| 275 | + |
| 276 | +After you created that issue and have the required amount of contributors, |
| 277 | +maintainers will ask you to provide a pull request with a translation of the |
| 278 | +[index page](https://github.com/open-telemetry/opentelemetry.io/blob/main/content/en/_index.md). |
| 279 | +Make sure that maintainers are allowed to edit your PR, since they will add |
| 280 | +additional changes to your PR that are required to get your localization project |
| 281 | +started. |
| 282 | + |
| 283 | +With your first PR merged maintainers will take care of setting up the issue |
| 284 | +label, the org-level group and the component owners. |
| 285 | + |
| 286 | +{{% alert title="Important" color="warning" %}} |
| 287 | + |
| 288 | +You don't have to be an existing contributor to the OpenTelemetry project, to |
| 289 | +start a new localization. However you will not be added as a member of the |
| 290 | +[OpenTelemetry GitHub organization](https://github.com/open-telemetry/) or as a |
| 291 | +member of the approvers group for your localization. You will need to satisfy |
| 292 | +the requirements for becoming an established member and approver as outlined in |
| 293 | +the |
| 294 | +[membership guidelines](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md). |
| 295 | + |
| 296 | +When starting the localization project, maintainers will treat your reviews as |
| 297 | +if you are an approver already. |
| 298 | + |
| 299 | +{{% /alert %}} |
| 300 | + |
| 301 | +## English-language maintainer guidance |
| 302 | + |
| 303 | +### When link checking fails for non-English pages |
| 304 | + |
| 305 | +English is the default language of the OpenTelemetry website. After you add, |
| 306 | +edit, or reorganized English language documentation, link checking may fail for |
| 307 | +non-English pages. When this happens: |
| 308 | + |
| 309 | +<!-- markdownlint-disable blanks-around-fences --> |
| 310 | + |
| 311 | +- Do **not** fix the broken links. Each non-English page is associated with a |
| 312 | + specific commit of the corresponding English page, as identified by the git |
| 313 | + commit hash value of the `default_lang_commit` front matter key. |
| 314 | +- Configure the link checker to ignore the non-English pages by adding the |
| 315 | + following to the page's front matter, or to the closest common ancestor file, |
| 316 | + when more than one page has link errors: |
| 317 | + ```yaml |
| 318 | + htmltest: |
| 319 | + # TODO: remove the IgnoreDirs once broken links are fixed |
| 320 | + IgnoreDirs: |
| 321 | + - path-regex/to/non-en/directory/contain/files/to/ignore |
| 322 | + - path-2-etc |
| 323 | + ``` |
| 324 | +- Run `npm run check:links` and include any updates to the `.htmltest.yml` |
| 325 | + config file with your PR. |
| 326 | + |
| 327 | +<!-- markdownlint-enable blanks-around-fences --> |
| 328 | + |
| 329 | +[front matter]: https://gohugo.io/content-management/front-matter/ |
| 330 | +[main]: https://github.com/open-telemetry/opentelemetry.io/commits/main/ |
| 331 | +[multilingual framework]: https://gohugo.io/content-management/multilingual/ |
| 332 | +[PR #5386]: https://github.com/open-telemetry/opentelemetry.io/pull/5386/files |
0 commit comments