How can I add translation files?

Hi there.

I’d like to translate a theme. For now I’ve been using Ghost editor on the browser and following this tutorial, so it’s not clear to me how I’m supposed to load these locale files on the browser. Is this even possible?

If you’re looking for help, please provide information about your environment. If you delete this template and don’t provide any information, your topic will be closed.

Thank you

In the admin:

Inside themes/mytheme/locales/es.json:

{
    "Back": "Volver",
    "Newer Posts": "Artículos Siguientes",
    "Older Posts": "Artículos Anteriores",
    "Page {page} of {pages}": "Página {page} de {pages}",
    "Subscribe": "Suscríbete",
    "Subscribe to {blogtitle}": "Suscríbete a {blogtitle}",
    "Subscribed!": "¡Suscrito!",
    "with the email address": "con el correo electrónico",
    "Your email address": "Tu correo electrónico",
    "You've successfully subscribed to": "Te has suscrito con éxito a",
    "A collection of posts": "Una colección de artículos",
    "A collection of 1 post": "Una colección de 1 artículo",
    "A collection of % posts": "Una colección de % artículos",
    "Get the latest posts delivered right to your inbox": "Recibe los últimos artículos directamente en tu buzón",
    "Latest Posts": "Últimos Artículos",
    "<a href='{url}'>More posts</a> by {name}": "<a href='{url}'>Más artículos</a> de {name}",
    "No posts": "No hay artículos",
    " (Page %)": " (Página %)",
    "Read More": "Lee Más",
    "Read <a href='{url}'>more posts</a> by this author": "Lee <a href='{url}'>más artículos</a> de este autor",
    "See all % posts": "Ver todos los % artículos",
    "Share this": "Comparte",
    "Stay up to date! Get all the latest & greatest posts delivered straight to your inbox": "¡Mantente al día! Recibe todos los últimos y mejores artículos directamente en tu buzón",
    "This post was a collaboration between": "Este artículo fue una colaboración entre",
    "youremail@example.com": "tucorreo@ejemplo.com",
    "1 post": "1 artículo",
    "% posts": "% artículos",
    "1 min read": "1 min de lectura",
    "% min read": "% min de lectura",
    "< 1 min read": "< 1 min de lectura"
}

Inside, for example, post.hbs:

<h1>{{ t "Back"}}</h1>

Will render " Volver". I’ve tried this with the casper theme on Ghost v4.

Hey @SylarRuby Thank you, but how do I upload such a file? Where is that folder you’ve mentioned? Can I somehow download the project to a local directory?

UPDATE:

I think I’ve got it. I have to download the theme files, add the locale file, “re-zip” it, and upload?

You will now need to have Ghost running locally. Have a look here to get started.

Uhmm Ok. After development, do I use the CLI to upload the theme?

What I do is, I navigate to my theme (casper) then yarn install && yarn dev. Make your changes then yarn zip. Your zipped theme will be located in themes/mytheme/dist/. Use the admin to upload the zipped theme then activate it.

You’ll have to create the locales folder :wink:

I have ghost installed locally. I don’t quite understand development workflow yet. I want to customize a theme, what do I have to do? I have to have the ghost directory opened in my IDE? Do I begin with ghost start --development?

You say you have Ghost installed. I’ve told you what to do. If you have it all running then you can visit your localhost: http://localhost:2368/ When you get a local dev running, you make your changes then zip your file then upload. I cannot explain it any other way.

Yes. At this point you may need to have a developer help you further.

Thank you, Sylar.

I just don’t see where installing ghost locally fits in this. Why is it any different from just downloading the theme, running npm install, developing, and finally uploading the content in the settings page?