StringResources.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. 'use strict';
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. /**
  4. * Licensed Materials - Property of IBM
  5. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2019
  6. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. */
  8. define(['i18n!../../dashboard/nls/DashboardResources', 'i18n!./DashboardResources', 'polyglot'], function (titanResources, geminiResources, Polyglot) {
  9. var titanPoly = new Polyglot({
  10. phrases: titanResources,
  11. allowMissing: true
  12. });
  13. var geminiPoly = new Polyglot({
  14. phrases: geminiResources
  15. });
  16. var StringResources = function () {
  17. function StringResources() {
  18. _classCallCheck(this, StringResources);
  19. }
  20. /**
  21. * Get the string resource for the given key and interpolation options
  22. *
  23. * @param {string} key The key of the string to return
  24. * @param {object} [interpolationOptions] see poly.t documentation for details
  25. * @returns {string} The corresponding string for the given key
  26. */
  27. StringResources.prototype.get = function get(key, interpolationOptions) {
  28. var msg = titanPoly.t(key, interpolationOptions);
  29. if (msg === key) {
  30. msg = geminiPoly.t(key, interpolationOptions);
  31. }
  32. return msg;
  33. };
  34. return StringResources;
  35. }();
  36. ;
  37. return new StringResources();
  38. });
  39. //# sourceMappingURL=StringResources.js.map