OOTB number formatting for locale prices

Hi, before I go re-invent the wheel or do custom logic.

question 1.

do you know if Apigee has out of the box number formatting for localized prices ?

example something like:

en-US: $1,000.00

ja-JP: ¥123,457

question 2.

I noticed js has a good Intl library, but Im getting error in js policy when I tried to require/include it.

has someone done something like this?

0 2 163
2 REPLIES 2

Yes, I've done... something similar. With Google's phonenumber JS library.

You will need to browserify the library (or otherwise package it so that it will run in an ES5 environment).

hi, @Dino-at-GoogleI was able to see a browserify example and did locally a browserify of a code that runs in node. and create a bundleIntl.js

I was hoping that bundle would take care of the

var Intl = require("intl");

1. I created a JS policy that set anything in the context "I was here"

2. I added the tags like this

<IncludeURL>jsc://bundleIntl.js</IncludeURL>

<ResourceURL>jsc://priceFormat.js</ResourceURL>

bundleIntl.js is the one created by browserify. that defines the

var Intl = require("intl");

priceFormat.js is a code where I expected to use Intl.method();

just when running it I get errors in javascript on the bundleIntl.js .

am I missing something in how to run the browserify ?

my command was very vanilla:

browserify bundle.js -o dist/bundle.js

any thoughts? if this is another internal dependency that fails.... does it means that I need to start bundle up everything that shows me exception ?...

as in

<IncludeURL>... more bundles here... until everything works.</IncludeURL>

<IncludeURL>jsc://anotherBundleNeededInIntl.js</IncludeURL>

<IncludeURL>jsc://bundleIntl.js</IncludeURL>

<ResourceURL>jsc://priceFormat.js</ResourceURL>