Translations problem

Hello :slight_smile:

I have problem with translations,

1.I add to /locales/pl.json
2. I translate pl.json
3. I add


4. Upload new theme, and translations not change, what I doing wrong?

1 Like

:wave:t3:

Have you restarted your Ghost? Also please note that /locales folder must be inside the theme folder.

Which theme are you using? Is it coded to use translations?

Thanks all! Ghost.io need moment to change translations :) All work

Hey Kevin,

Maybe you can shed some light as I’m having a similar issue to the one raised by @Karolek

I’m using the Casper theme, I am aware there’s a git repository with translations to my locale but it isn’t compatible with the theme version (3.0.12)
I’ve followed these instructions

On step number 2, do I need to create a .json file for english as well? I’ve purely created one for spanish (locale es) but I am not sure if both (en.json and es.json) are required.

Also, I’ve replaced all special characters (@, accent/exclamation/question marks) by HTML entities:

{
“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”,
“More posts by {name}”: “Más artículos de {name}”,
“No posts”: “No hay artículos”,
" (Page %)“: " (Página %)”,
“Read More”: “Lee Más”,
“Read more posts by this author”: “Lee más artículos 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@examplecom”: “tucorreo@ejemplocom”,
“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”
}

Step 4 (Ensure templates exist):

I download both handlebar files (.hbs) and place them in the /partials/ folder, however, this leads to an error.

Step 5 (Use translator helper) and 6 (Declare language in HTML):

Already there? No need to action as far as I can see (maybe I’m wrong?)

Many thanks in advance.

On step number 2, do I need to create a .json file for english as well?

I think you should be able to only have an es.json file

however, this leads to an error.

Please share any errors, otherwise there’s no information for us to help you ;-)

Already there? No need to action as far as I can see

If you are using default Casper then it doesn’t use the {{t}} helper, you’d need to go through every theme file and switch to using the {{t}} helper anywhere you’re rendering text that should be translated.

If this is a theme purely for your own site that will only be in one language it may be easier to not use the {{t}} helper and translations files and instead swap out the English in each template file for Spanish?

Thanks Kevin.

I’m browsing through the .hbs files within the theme (Casper) and either adding {{t “text”}} where required or performing a straight translation.

There are a lot of elements featured within the .json file I cannot find in any of the .hbs files, for example:

“Page {page} of {pages}”: “Página {page} de {pages}”,

I’m using Atom and it cannot find Page {page} of {pages} in any of the .hbs files within the .zip file downloaded from Ghost.

This applies to many of the entries to be translated, so far I’ve only located those within the subscribe-form.hbs

To make things awkward, I can see the text in English within the main live blog but I cannot locate where the text is gathered from so it can be translated…

Can you shed any light?

Regards,

You need to follow “Step 4” of the translation guide - the text is in the optional template overrides

Thanks Kevin,

Created both pagination.hbs and navigation.hbs, I was able to create 3 more {{t}} wrappers; there is still loads that has not been translated like:

"Back": "Volver",
"Subscribed&excl;": "&iexcl;Suscrito&excl;",
"with the email address": "con el correo electr&oacute;nico",
"Your email address": "Tu correo electr&oacute;nico",
"You've successfully subscribed to": "Te has suscrito con &eacute;xito a",
"A collection of posts": "Una colecci&oacute;n de art&iacute;culos",
"A collection of 1 post": "Una colecci&oacute;n de 1 art&iacute;culo",
"A collection of &percnt; posts": "Una colecci&oacute;n de &percnt; art&iacute;culos",
"Get the latest posts delivered right to your inbox": "Recibe los &uacute;ltimos art&iacute;culos directamente en tu buz&oacute;n",
"Latest Posts": "&uacute;ltimos Art&iacute;culos",
"<a href='{url}'>More posts</a> by {name}": "<a href='{url}'>M&aacute;s art&iacute;culos</a> de {name}",
"No posts": "No hay art&iacute;culos",
" (Page &percnt;)": " (P&aacute;gina &percnt;)",
"Read More": "Lee M&aacute;s",
"Read <a href='{url}'>more posts</a> by this author": "Lee <a href='{url}'>m&aacute;s art&iacute;culos</a> de este autor",
"See all &percnt; posts": "Ver todos los &percnt; art&iacute;culos",
"Share this": "Comparte",
"Stay up to date&excl; Get all the latest &amp; greatest posts delivered straight to your inbox": "&iexcl;Mantente al d&iacute;a&excl; Recibe todos los &uacute;ltimos y mejores art&iacute;culos directamente en tu buz&oacute;n",
"This post was a collaboration between": "Este art&iacute;culo fue una colaboraci&oacute;n entre",
"youremail&commat;example.com": "tucorreo&commat;ejemplo.com",
"1 post": "1 art&iacute;culo",
"&percnt; posts": "&percnt; art&iacute;culos",
"1 min read": "1 min de lectura",
"&percnt; min read": "&percnt; min de lectura",
"&lt; 1 min read": "&lt; 1 min de lectura"

None of these elements are within any of the below .hbs files:

Can’t really tell what I’m missing / doing wrong.

@ricapachanga you’re better off working from the .hbs files into the translation files as that will reflect the text that is actually in the theme.

Did you copy the translation example from the guide? That is only an example of what the end result may be, it will be different for every theme.

I see, looking at it and for simplicity (as it is a one language site) I’m going to follow your suggestion:

Blockquote
If this is a theme purely for your own site that will only be in one language it may be easier to not use the {{t}} helper and translations files and instead swap out the English in each template file for Spanish?

By doing this, there’s no need to set a publication language within settings and/or follow any of the other instructions on your walkthrough guide. Correct?

Just out of curiosity, does any of your free templates support the {{t}} helper?

Many thanks in advance once again!

1 Like

Hi! I’m in the same situation as you were, I read all the doc about it and still cant make it work. I want to translate the whole site into Spanish. Can you tell me what you did?

  • I’ve already added the es.json to /ghost/content/themes/casper/locales
  • Then change in the settings option the language to es.

The {{t}} and the hbs steps are quite confusing to me…

I will appreciate any help :slight_smile:

1 Like

Hi! Did you find solution? Same situation(

bump. need some guidance on the documentation

ahh never mind i just needed to add quotes to strings when using the t helper.

<h2 class="single-cta-title">{{t "This post is for subscribers only" }}</h2>

hi guys just wanted to jump in and ask

so after we add the translation helpers + locales language .json file, how can we turn the language on for end-users?

does this also work for multi-lingual site?

thanks

Hi all,

I’m having the same problem here. The theme is only partially translated (to French), and some of the things I see on the page I can’t find in any .hbs file. (see https://mirari.media, the newsletter sign up form at the bottom of the page for instance).

If any of you have found a solution to that problem, that’d be GREAT :slight_smile:

Cheers,

Brian

There’s a current effort to translate the portal. Help translate Ghost (beta) - #23 by tebiscottieilmac

1 Like