Closed MachinisteWeb closed 7 years ago
I've the same problem here. Even Snipcart.DEBUG = false
does not work.
Hi there!
Snipcart.DEBUG = false
do effectively work, but some logs are written before Snipcart has completed its initialization. So by disabling the logs in :
document.addEventListener('snipcart.ready', function() {
Snipcart.DEBUG = false;
});
the notices for missing translation are shown because the language is loaded before Snipcart is fully initialized. It is that way so that people can override specific sentences locally.
The log message Missing localization string {key name} for locale fr
means that a French translation is not defined for that key.
And :
Snipcart.execute('app.ready', function () { /* ... */ });
// must be replace with
Snipcart.execute('bind', 'app.ready', function () { /* ... */ });
You are right that the message Snipcart: Locale fr not found, falling back to en
should not show up. I'll open an issue about it, but being only a message in the dev logs it might not be prioritized very high.
After testing this day, only remain the :
Snipcart: Locale fr not found, falling back to en
messages. All others are removed.
Thx.
We plan to use Snipcart and currently, we try it. But it's appear the debug messages are not relevant. We need a strong debug message system during development phase to be able to do the maximum things without help. So, maybe is just a lack in documentation or me which is not implement my test in a correct way. This is my problem :
Disable messages
I have already read some closed issue and I know there is a way to disable debug message like this :
My curious behavior
It's seems some debug messages not reflect what is actually done.
Below, this is my started implementation:
All files provide a 200 status message and
scripts/fr-FR.js
contain your current repositorylocales/fr-FR.js
file.So currently my console show me this.
Try to add the label
I have translated all labels not provided from
fr-FR.js
and I provide it in this PR : https://github.com/snipcart/snipcart-localization/pull/53What I expected to see was this :
but console show all messages.
Try to wait service API is ok
I had this code to wait the API is loading...
What I expected to see was no messages anymore.
but console show all messages with this additional message:
Hurray ! It's seems debug message work a little bit...
Try to wait service API with the correct code...
Using this alternative code the previous
Snipcart: Command app.ready not recognized
is not display animore.So what I expected is to see no error message anymore and all messages are always displayed.
Bug OR bad documentation explaination
So currently, your error message are not correct because the first message is
And — I try to load
fr-FR
(not somefr
) — My app is currently in French exactly as I expected. So it's just the debug message was not relevant.Then, the rest of message are not correct either because my file is up-to-date : https://github.com/snipcart/snipcart-localization/pull/53
Test it
You can test that to go at
https://blog.lesieur.name/espace-membres/
. Just open console with F12 and see the not relevant message. Test to open interface to see it in french.What I'm doing wrong ?
Thanks !