Skip to content

Commit

Permalink
Merge branch 'main' into create-pull-request/patch
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Jan 18, 2024
2 parents 306197f + bd645f2 commit a19eeb7
Show file tree
Hide file tree
Showing 9 changed files with 525 additions and 6 deletions.
Binary file added content/posts/translation/content/hero.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 20 additions & 1 deletion content/posts/translation/content/index.es.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
title: "Como traducir las publicaciones"
date: 2020-06-07T06:20:50+06:00
author:
name: BernatBC
image: images/author/bernatbc.png
menu:
sidebar:
name: Traduciendo Publicaciones
Expand All @@ -9,4 +12,20 @@ menu:
weight: 520
---

## Próximamente.......
Este tema tiene soporte integrado para varios idiomas.

Antes de empezar la traducción de la publicación, asegúrese de haber habilitado el idioma en su sitio. Si ese no es el caso, puedes seguir la sección `Añade el idioma en el sitio` de la guía [Como traducir los datos de la página de inicio](/es/posts/translation/site-data/).

## Creando la publicación

Una vez que haya agregado el idioma deseado a su sitio web, sepa que puede traducir publicaciones a ese idioma. Asumiremos que deseas traducir una publicación existente.

### Creado el archivo index

El primer paso es localizar el archivo `index.md` del post que deseas traducir. Después, crea un archivo en el mismo directorio (o simplemente copia el archivo `index.md`), y nómbralo `index.<código_del_idioma>.md`, dónde `<código_del_idioma>` es el código que encontrará en la tabla de idiomas de [Como traducir los datos de la página de inicio](/es/posts/translation/site-data/).

### Traduce la publicación

Ahora ya puede empezar traduciendo la publicación, de la misma forma que escribes una publicación nueva.

> INFORMACIÓN: Si está tratando con referencias internas, necesitarás añadir el prefijo `/<código_del_idioma>` delante del path relativo. Por ejemplo, si quieres crear un link que apunta a `/posts/translation/site-data/`, el link de la publicación traducida será `/<language_code>/posts/translation/site-data/`.
23 changes: 21 additions & 2 deletions content/posts/translation/content/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
title: "How to Translate Posts"
date: 2020-06-07T06:20:50+06:00
date: 2024-01-15T06:20:50+06:00
author:
name: BernatBC
image: images/author/bernatbc.png
menu:
sidebar:
name: Translating Posts
Expand All @@ -9,4 +12,20 @@ menu:
weight: 520
---

## Coming soon.......
This theme has built-in support for multiple language.

Before starting the post translation, make sure that you have enabled the language to your site. If that's not the case, you can follow the section `Add the language to the site` from the guide [How to Translate Site Data](/posts/translation/site-data/).

## Creating the post

Once you have your desired language added to your website, know you can translate posts to that language. We're going to assume that you want to translate an existing post.

### Create the index file

The first step is to locate the `index.md` file from the post that you want to translate. Then you have to create a file in the same directory (or you can just copy the `index.md` file), and name it `index.<language_code>.md`, where `<language_code>` is the language code that you can find in the language table in [How to Translate Site Data](/posts/translation/site-data/).

### Translate the post

Now, you can start translating the post, the same way as you write a new post.

> INFO: If you're dealing with internal references, you'll need to add the prefix `/<language_code>` in front of your relative path. For example, if you want to create a link that is pointing to `/posts/translation/site-data/`, the link for the translated post will be `/<language_code>/posts/translation/site-data/`.
Binary file added content/posts/translation/new-language/hero.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
162 changes: 162 additions & 0 deletions content/posts/translation/new-language/index.es.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
---
title: "Cómo añadir un idioma sin soporte"
date: 2024-01-15T06:20:50+06:00
author:
name: BernatBC
image: images/author/bernatbc.png
menu:
sidebar:
name: Añadiendo un nuevo idioma
identifier: new-language
parent: translation
weight: 510
---

Si desea traducir a un idioma si soporte, puede traducir los elementos de la interfaz de usuario.

## Crea el archivo `i18n`

Para haerlo, debes crear el directorio `i18n` dentro de la raíz del sitio, el directorio dónde puede encontrar el archivo `config.yaml`, y directorios como `data`, `content`, etc.

Luego, puedes crear el archivo `<código_del_idioma>.toml` dentro del directorio `i18n`. En este [directorio](https://github.com/hugo-toha/hugo-toha.github.io/tree/gh-pages/flags/1x1) puedes encontrar todos los códigos de idiomas con las banderas que aparecerán junto a ese idioma.

## Traduce los elementos de la interfaz

Dentro del nuevo archivo, simplemente copia el siguiente contenido, y sustituye el contenido entre comillas con el nombre en tu idioma deseado.

{{< alert type="warning" >}}
Si el contenido de abajo es obsoleto, puedes copiar el conteindo del archivo [en](https://github.com/hugo-toha/toha/blob/main/i18n/en.toml).
{{< /alert >}}

```toml
# More documentation here: https://github.com/nicksnyder/go-i18n
[home]
other = "Home"

[posts]
other = "Posts"

[toc_heading]
other = "Table of Contents"

[tags]
other = "Tags"

[categories]
other = "Categories"

[at]
other = "at"

[resume]
other = "My resume"

[navigation]
other = "Navigation"

[contact_me]
other = "Contact me:"

[email]
other = "Email"

[phone]
other = "Phone"

[newsletter_text]
other = "Stay up to date with email notification"

[newsletter_input_placeholder]
other = "Enter email"

[newsletter_warning]
other = "By entering your email address, you agree to receive the newsletter of this website."

[submit]
other = "Submit"

[hugoAttributionText]
other = "Powered by"

[prev]
other = "Prev"

[next]
other = "Next"

[share_on]
other = "Share on"

[improve_this_page]
other = "Improve this page"

[out_of]
other = "out of"

[publications]
other = "Publications"

[taken_courses]
other = "Taken Courses"

[course_name]
other = "Course Name"

[total_credit]
other = "Total Credit"

[obtained_credit]
other = "Obtained Credit"

[extracurricular_activities]
other = "Extracurricular Activities"

[show_more]
other = "Show More"

[show_less]
other = "Show Less"

[responsibilities]
other = "Responsibilities:"

[present]
other = "Present"

[comments_javascript]
other = "Please enable JavaScript to view the"

[comments_by]
other = "comments powered by"

[read]
other = "Read"

[project_star]
other = "Star"

[project_details]
other = "Details"

[err_404]
other = "The page you are looking for is not there yet."

[more]
other = "More"

[view_certificate]
other = "View Certificate"

[notes]
other = "Notes"

[disclaimer_text]
other = "Liability Notice"

[search]
other = "Search"

[minute]
one = "minute"
other = "minutes"
```
162 changes: 162 additions & 0 deletions content/posts/translation/new-language/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
---
title: "How to add an unsupported language"
date: 2024-01-15T06:20:50+06:00
author:
name: BernatBC
image: images/author/bernatbc.png
menu:
sidebar:
name: Adding new language
identifier: new-language
parent: translation
weight: 510
---

If you want to translate to an unsupported language, you can translate the UI elements.

## Create an `i18n` file

To do so, you have to create the `i18n` diretory inside the root of the site, the directory where you can find the `config.yaml` file, and directories like `data`, `content`, etc.

Afterwards, you can create the file `<language_code>.toml` into the `i18n` directory. In this [directory](https://github.com/hugo-toha/hugo-toha.github.io/tree/gh-pages/flags/1x1), you can find all language codes with the flag that will appear with that code.

## Translate the UI elements

Inside the new file, just copy the following content, and replace the content between the quotation marks with the name in your desired language.

{{< alert type="warning" >}}
If the content below gets obsolete, you can copy the contents from the [en](https://github.com/hugo-toha/toha/blob/main/i18n/en.toml) file.
{{< /alert >}}

```toml
# More documentation here: https://github.com/nicksnyder/go-i18n
[home]
other = "Home"

[posts]
other = "Posts"

[toc_heading]
other = "Table of Contents"

[tags]
other = "Tags"

[categories]
other = "Categories"

[at]
other = "at"

[resume]
other = "My resume"

[navigation]
other = "Navigation"

[contact_me]
other = "Contact me:"

[email]
other = "Email"

[phone]
other = "Phone"

[newsletter_text]
other = "Stay up to date with email notification"

[newsletter_input_placeholder]
other = "Enter email"

[newsletter_warning]
other = "By entering your email address, you agree to receive the newsletter of this website."

[submit]
other = "Submit"

[hugoAttributionText]
other = "Powered by"

[prev]
other = "Prev"

[next]
other = "Next"

[share_on]
other = "Share on"

[improve_this_page]
other = "Improve this page"

[out_of]
other = "out of"

[publications]
other = "Publications"

[taken_courses]
other = "Taken Courses"

[course_name]
other = "Course Name"

[total_credit]
other = "Total Credit"

[obtained_credit]
other = "Obtained Credit"

[extracurricular_activities]
other = "Extracurricular Activities"

[show_more]
other = "Show More"

[show_less]
other = "Show Less"

[responsibilities]
other = "Responsibilities:"

[present]
other = "Present"

[comments_javascript]
other = "Please enable JavaScript to view the"

[comments_by]
other = "comments powered by"

[read]
other = "Read"

[project_star]
other = "Star"

[project_details]
other = "Details"

[err_404]
other = "The page you are looking for is not there yet."

[more]
other = "More"

[view_certificate]
other = "View Certificate"

[notes]
other = "Notes"

[disclaimer_text]
other = "Liability Notice"

[search]
other = "Search"

[minute]
one = "minute"
other = "minutes"
```
Binary file added content/posts/translation/site-data/hero.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a19eeb7

Please sign in to comment.