I am looking to integrate the ResourceBundle package into my Vue project. After installing it with the following command:
npm install resource-bundle
I discovered these exported functions in the index.js file of the ResourceBundle package:
export function* loader (locale, dir, baseName) {
console.log('in loader')//Does not print
...
return new ResourceBundle(require(file))
};
function ResourceBundle (resource) {
this.resource = resource
}
ResourceBundle.prototype.get = function (key) {
...
return util.format.apply(util, params);
};
export const ResourceBundlee = ResourceBundle
Next, I attempted to import and use the 'loader' function in main.js as follows:
import * as ResourceBundle from 'resource-bundle'
console.log(ResourceBundle)
//console:
// ResourceBundlee:ƒ s(t)
// loader:ƒ r(t,e,n)
console.log(ResourceBundle.loader('en_US',
__dirname+'/resources',message').get)
//console:
//undefined
Since I am unfamiliar with JavaScript, can someone help explain why 'in loader' does not get printed and provide guidance on the correct way to import the loader function? Thank you!