Custom Factories - Mura Docs v6

Custom Factories

You can also easily create custom resource bundle factories.

customResourceBundleDirectory = ExpandPath('#$.globalConfig('context')#/path/to/your/resourceBundles/');
customFactory = new mura.resourceBundle.resourceBundleFactory(
parentFactory = $.siteConfig('rbFactory')
, resourceDirectory = customResourceBundleDirectory
, local = $.siteConfig('JavaLocale')
);

At this point the custom factory would have the following look up hierarchy:

  1. {customResourceBundleDirectory}/{targetResourceBundle}
  2. /{siteID}/includes/themes/{theme}/resourceBundles/{targetResourceBundle}
  3. /{siteID}/includes/resourceBundles/{targetResourceBundle}
  4. /requirements/mura/resourceBundles/resources/{targetResourceBundle}

Then, wherever you want to output your custom resource bundle keys, simply access your customFactory:

#customFactory.getKey('yourKey')#