StringResource.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. *+------------------------------------------------------------------------+
  3. *| Licensed Materials - Property of IBM
  4. *| IBM Cognos Products: Content Explorer
  5. *| (C) Copyright IBM Corp. 2015, 2018
  6. *|
  7. *| US Government Users Restricted Rights - Use, duplication or disclosure
  8. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  9. *+------------------------------------------------------------------------+
  10. */
  11. define(['i18n!./CamobileviewsResources', 'polyglot'], function (localeResources, Polyglot) {
  12. 'use strict';
  13. /**
  14. * Module which provides simple access to string resources.
  15. *
  16. */
  17. var poly = new Polyglot({
  18. phrases: localeResources
  19. });
  20. var StringResources = function () {
  21. return undefined;
  22. };
  23. /**
  24. * Get the string resource for the given key and interpolation options
  25. *
  26. * @param key The key of the string to return
  27. * @param interpolationOptions Optional interpolation options (see poly.t documentation for details)
  28. * @returns The string to display
  29. */
  30. StringResources.prototype.get = function (key, interpolationOptions) {
  31. return poly.t(key, interpolationOptions);
  32. };
  33. return new StringResources();
  34. });