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?

: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 :slight_smile: 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 :wink:

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!