A customized I18n plugin has been developed to accept various languages through json files. The goal is to simplify usage for users by allowing them to easily insert their json package directly into a page along with the script:
<script id="pop-language_es" type="application/json" src='languages/es.json'></script>
<script src='pop.js'></script>
To maintain the simplicity of this plugin, external dependencies like Jquery are avoided. The script tag can be retrieved using pure JavaScript:
var json = document.getElementById("pop-language_es");
However, the challenge lies in accessing the actual json content rather than just the tag itself. Is there a way to access the contents using something like json.content
?
This issue has similarities to one discussed here, where suggestions of using Ajax were made. While Ajax could potentially solve the problem, it raises concerns about the client downloading the json file twice (once during page load and again during the Ajax call). This could be problematic especially for large json files.