For some time I’ve been using an array to insert a string of text into an i18n before presentation to the user. Works like charm. But for the first time I’ve attempted to insert a number instead of text. Returns gibberish.
This code works:
var vFee = 'abc';
var vTitle = i18n.getI18NMessage('7office.dlg.newuser');
var vMsg = i18n.getI18NMessage('7office.dlg.newuserfee', new Array(vFee));
var vBtn = plugins.dialogs.showQuestionDialog(vTitle, vMsg);
// returns 'Please approve a one-time charge of $abc.'
This code doesn’t:
var vFee = sevid$sec_to_seven.fee_newuser; // a number field which returns 150
var vTitle = i18n.getI18NMessage('7office.dlg.newuser');
var vMsg = i18n.getI18NMessage('7office.dlg.newuserfee', new Array(vFee));
var vBtn = plugins.dialogs.showQuestionDialog(vTitle, vMsg);
// returns 'Please approve a one-time charge of $java.lang.Object@1336.'
I’m unsure where the problem lies – with the way I’m understanding arrays or with my JavaScript, or both.
I’ve looked for but haven’t found a way of converting a number to a text string.
===========
10 minutes after posting the above I discover a probably inelegant way to force it to work. But beyond having just code that works, I’d also like to know what’s going on here, what I’m misunderstanding.
Code that works:
var vTemp = sevid$sec_to_seven.fee_newuser; // a number field which returns 150
var vFee = '' + vTemp + '';
var vTitle = i18n.getI18NMessage('7office.dlg.newuser');
var vMsg = i18n.getI18NMessage('7office.dlg.newuserfee', new Array(vFee));
var vBtn = plugins.dialogs.showQuestionDialog(vTitle, vMsg);
// returns 'Please approve a one-time charge of $150.'