StringResource.js 1.4 KB

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