@gasket/plugin-intl
Version:
NodeJS script to build localization files.
28 lines (27 loc) • 964 B
JavaScript
// @ts-nocheck - handled by other PR
/// <reference types="@gasket/plugin-elastic-apm" />
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, /** @type {import('@gasket/core').HookHandler<'apmTransaction'>} */ "default", {
enumerable: true,
get: function() {
return apmTransaction;
}
});
const _debug = /*#__PURE__*/ _interop_require_default(require("debug"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const debugLog = (0, _debug.default)('gasket:plugin:intl:apmTransaction');
async function apmTransaction(gasket, transaction, { req }) {
const locale = await gasket.actions.getIntlLocale(req);
if (locale) {
debugLog(`Setting locale label for transaction to ${locale}`);
transaction.setLabel('locale', locale);
} else {
debugLog('Locale could not be determined for transaction');
}
}