j-Resource
Resources are very great solution for e.g. translate some texts in all scripts. The component can be appended multiple-times and all components use one repository for storing keys and values.
METHODS:
RESOURCE(key, [def])- is a global methodFIND('resource').download('/my-dictionary.txt', [callback]);- for importing new resources
Use it with <ui-component name="resource">. When the component is not loaded yet, jComponent downloads it on first use from the address in DEF.fallback (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.
Open Web Developer console.
<ui-component name="resource">
<script type="text/plain">
yes : Yes
no : No
message : Are you sure?
</script>
</ui-component>
<ui-component name="resource">
<script type="text/plain">
first : Value of first
second : Value of second
a b c : ABC
</script>
</ui-component>
<script>
setTimeout(function() {
console.log(RESOURCE('yes'));
console.log(RESOURCE('no'));
console.log(RESOURCE('message'));
console.log(RESOURCE('first'));
console.log(RESOURCE('second'));
console.log(RESOURCE('a b c'));
console.log(RESOURCE('notfound', 'NOT FOUND'));
}, 2000);
</script>