Page 1 of 1

[javascript FR] support Intl object in javascript

Posted: Wed May 07, 2025 8:23 pm
by Mathew
As of build 395 the ECMAScript Internationalization API is not supported in PXCE. It would be very useful for sorting according to international rules, and number formatting.

Code: Select all

new Intl.Collator();
//Console:Exec:1: ReferenceError: Intl is not defined

Re: [javascript FR] support Intl object in javascript

Posted: Wed May 07, 2025 8:49 pm
by Daniel - PDF-XChange
Hello, Mathew

Thank you for the request, I have passed it up to the Dev team for review!

Kind regards,

Re: [javascript FR] support Intl object in javascript

Posted: Thu May 08, 2025 6:13 pm
by Daniel - PDF-XChange
Hello again!

I have just head back from the Dev team, apparently this will not be possible to implement at this time, due to the complexity of the API involved.

Our of curiosity, did you find that this worked in the past? I (perhaps mistakenly) thought from your wording that this should have worked in build 394 or previous, but in testing it does not see that it does.

Kind regards,

Re: [javascript FR] support Intl object in javascript

Posted: Thu May 08, 2025 7:36 pm
by Mathew
Well, that's somewhat disappointing but thank you for checking. There is String.localeCompare() available for sorting, but I don't think any of the settings work.

I was just thinking about it because often languages other than US-English (that I use) sort in different orders, have different letters, etc. So for a script to work for those languages, it makes sense to use something a bit more internationally aware.

I was also running into a bit of a quagmire trying to figure out how to convert number strings to numbers when the decimal point and thousands separator may vary. How does PDF XChange handle this internally? Do the developers have a suggestion on how I should handle it?
All I really need to make number conversion work is to have a way of knowing the system Decimal symbol and Digit grouping symbol.

For example, if I use util.printf does it default to the system nDecSep?

Code: Select all

util.printf('%f',1.234);
// for a german system would it output 1,234000 ?
Daniel - PDF-XChange wrote: Thu May 08, 2025 6:13 pm Our of curiosity, did you find that this worked in the past? I (perhaps mistakenly) thought from your wording that this should have worked in build 394 or previous, but in testing it does not see that it does.
No it doesn't work in any previous builds. I'd not updated to the most recent version yet :oops: so just wanted to note the version that I was using.

Re: [javascript FR] support Intl object in javascript  SOLVED

Posted: Wed May 28, 2025 10:59 pm
by Daniel - PDF-XChange
Hello, Mathew

Sorry for the delay, some further discussion has happened, and the Dev team realized we may have a way to implement these options. I cannot promise that it will be possible, but they are digging a bit deeper into it, and if they find we can, it may be be present in the next "feature" release (V10.7 or V11.0), they did not specify whether that was a "normal", or "major" release, I am sorry to say...

Kind regards,