I am referring to https://github.com/wikimedia/jquery.i18n#data-api in the JQuery.i18n documentation:
<li data-i18n="message-key">Fallback text</li>
It is also possible to have the above li node with fallback text already in place.
Unfortunately I don't get this work. When I don't have message-key in the language file then JQuery.i18n displays instead of Fallback text the key: message-key
My question:
What am I doing wrong? As soon I add the key to the language file then it gets replaced, so apparently the language file is loaded correctly and also the function calls seem to work.
It seems to be a bug! I was checking the JQuery.i18n code and I found the problem.
It's all in
jquery.i18n.js. It starts with this code in line #169:The
ifis executed when there is no text defined for the key and then the message becomes the key.I commented the assignment:
Then I had to change in line #244 this code:
to
Now the fallback text does work. The following comment in line number 165 seems to confirm it's a bug and the developer knows it but somehow he lives with it:
If you apply this hack so consider also the modifications for
htmland othertagsfew lines above.