Have your say in Community Polls: What was/is your greatest motivation to start your own business?

"Error: Too many translation keys" error in the json file.

"Error: Too many translation keys" error in the json file.

SimZ
Visitor
1 0 0

Hi there,

Hope you're well!


I'm trying to translate the website to German, however, I am stuck on defining the 'default' language. I'm adding the translations to the 'en.default.json' file in Locales in my theme's code, however, I am getting the following error:

"This file contains the following errors: Error: Too many translation keys"


Does this mean there are too many translations? If so what can I do about this as I cannot translate 3 pages?

Thanks very much for your help!

Replies 4 (4)

ThemuMitch
Explorer
45 11 15

Hi SimZ,

 

Locale files, like the en.default.json file you've edited, are only meant to be edited by the developers of your theme. Merchants like yourself are able to translate themes from within the Shopify admin.

 

First, restore the original, unedited en.default.json file. Then, you'll be able to edit your theme's language by following this article:

https://help.shopify.com/en/manual/online-store/os/using-themes/translate-theme

 

I hope this helps.

Was your problem solved? Please mark this post as an Accepted Solution
Ally_Paris
Tourist
9 0 0

Hi @ThemuMitch ,

I'm having a similar issue : there is a few missing translations on my checkout process that I'm not able to edit through the theme language editor interface. 

As it's related to the local delivery feature, I've edited them "fr-SCALD.json", it works well but only for a while. Some of them on the example here below : 

Ally_Paris_0-1610407757531.png

 

Do you think you can help ? 

I'm working on the supply theme.

 

Thank you ☀

Gordon_Chan
Shopify Partner
28 2 22

I am joining this thread to provide more finding when I tackle this issue for my client, and as of now it is still an active issue but I believe the finding might help you to work out work around on your own scenario.

 

I am a web developer for my client website which is a giant e-store for light-weight electric appliants, their website has many campaign pages built with a page builder app, where the app will generate differetn template / sections liquid files and css/js asset files.

 

We hit the "TOO_MANY_TRANSLATION_KEY" issue initially on the theme's "Edit Language" interface, the interface we all know 'good' for merchant to edit their default language safely. Since they hit the issue, I help them to find solution as well as helpping them do the dirty task (modify the locales/*.json file....) and I know this is absolutely not the way to go, and eventually it also reaches the limit of the locale files. I got Plus Support saying the file has file size limit 1.5M, but our 2 locales sum up is far smaller then that, yet, the no. of translation key the generated by the page building app is obviously large (every fragment of the campaign page become a translation)

 

I initially blame the app building page for using such approach poluting the locale file, why not saving the content as page content and use Translation API?! But then we find it is fine to remove the translation from the locale file as the app also saved the translation in their generated section liquid file (schema.locales) which avoid polluting the locale file (and those in locale file are for further language customization by merchant if they do not modify the page from the app).

 

This helps avoid the locale file hitting the limit, but the error Too Many Translation Key is still persist when using the theme's "Edit Language" function. Turn out that (and you can try), upon you click "Save" in the Edit Language function, even if you have change nothing, there is a HTTP POST call initiated with a payload for Translation API with a mutation query with ALL translation. But you may wonder, why does no error when direct saving the locale file? It is again refer back to Section File's schema.locales. As the page builder app holds translation inside section file rather than the locale JSON files, while the "Edit Language" function is able to retrieve all those locales data and render in their interface for merchant to manipulate. So the resulted translation is much larger than the translation locale files. Simple math. If locale file have 5000 translation key and assume it is the limit, if there is a section file with corresponding locales in their schema JSON with 2 key, there will be 5002 translation key in total upon the "Save", even you don't introduce any translation change.

 

I shared my finding to Plus Support and waiting for their reply. My suggestion to them is to reference what they have done on Bulk Editor (e.g. the UI for bulk edit product), only save change on row that have change. The Bulk Editor has marked a DOT for the row that have change, and spinner plus tick to indicate the saving process upon clicking "Save". Although the sequential saving process has room to improve, the resulted payload for the change is much reasonablly small and better than huge saving all unchanged translation in 1 goal and hit the wall hardly.

 

So, for couple of your case, if you find you see the error upon direct editing the locale JSON in theme editor, sadly say you might really have a huge translation file. If you see the error using the Theme's Edit Language function (but still able to use direct edit locale JSON file approach), meaning you have some app / someone introduced locales data to some of your section liquid files and resulting a huge translation update payload, which require enhancement from Shopify in order to resolve the issue.

 

Last but not least, asking merchant to RESTORE to original locale file is not practical. They either not have that, or they have so many changes happened over the time operating the store, or introduced by page building app like the case my merchant does. The suggested link https://help.shopify.com/en/manual/online-store/os/using-themes/translate-theme mainly offer the translation the theme default provided. Find a helpful hand from developer community / Shopify Partner shall be a better way, even not all the time resolve the issue immediately, but able to provide some deeper insight for closer to the issue.

 

http://gordon-chan.net
I am a Freelance Web Engineer. Dedicated my life to e-commerce development.
pwsurfsport
Visitor
1 0 0

Hello,

 

Are there any solutions found on this issue? 

 

We use Ecomposser and have the same trouble

 

thanks