123456789101112131415161718192021222324252627282930313233343536373839 |
- /*
- * Licensed Materials - Property of IBM
- *
- * IBM Cognos Products: SHARE
- *
- * (C) Copyright IBM Corp. 2015, 2016
- *
- * US Government Users Restricted Rights - Use, duplication or disclosure
- * restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(["i18n!bi/sharecommon/nls/share_client", "polyglot"], (function(localeResources) {
- var translator = {};
-
- translator.options = {
- verbose: false
- };
- translator.NOT_TRANSLATED = "__NOT_TRANSLATED__";
-
- polyglot = new Polyglot({
- phrases: localeResources
- });
-
- /**
- * Translates a key in the current locale
- * @param key message key
- * @param interpolation key-value pairs for interpolation
- */
- translator.translate = function(key,interpolation) {
- var translated = polyglot.t(key,interpolation);
- if (translator.options.verbose) {
- if (translated === key) {
- translated = translator.NOT_TRANSLATED + "(" + key + ")";
- }
- }
- return translated;
- };
-
- return translator;
- }));
|