nodejs / full-icu-npm

convenience loader for 'small-icu' node builds
https://nodejs.org/api/intl.html#intl_providing_icu_data_at_runtime
Other
152 stars 31 forks source link

doc: improve docs on what this is and how it works #68

Closed srl295 closed 2 years ago

mike-lischke commented 2 years ago

@srl295 I just found this node module and thought this would add ICU support to a Node.js application. Apparently, this is not the case, or I got the entire idea of this module wrong.

What actually is that about? The documentation (err readme) says I get some message upon installation, but nothing came up. That's I all I got:

npm i full-icu

added 5 packages, and audited 241 packages in 592ms

55 packages are looking for funding run npm fund for details

I can import it and see the mentioned fields with data, but there's no indication how I can use the module actually. And I guess it's not complete anyway (because it's way too small). Please, it's essential that the documentation includes some examples and how to perform a full installation, otherwise your precious work is totally wasted, since nobody knows how to use the package.

srl295 commented 2 years ago

@srl295 I just found this node module and thought this would add ICU support to a Node.js application. Apparently, this is not the case, or I got the entire idea of this module wrong.

What actually is that about? The documentation (err readme) says I get some message upon installation, but nothing came up. That's I all I got:

You're right. We need to link to https://nodejs.org/api/intl.html#providing-icu-data-at-runtime - please see that. But also note that your node.js version may already have full data.

npm i full-icu added 5 packages, and audited 241 packages in 592ms

Huh, it should print some messages out. Maybe npm quells those now.

55 packages are looking for funding run npm fund for details

I can import it and see the mentioned fields with data, but there's no indication how I can use the module actually. And I guess it's not complete anyway (because it's way too small). Please, it's essential that the documentation includes some examples and how to perform a full installation, otherwise your precious work is totally wasted, since nobody knows how to use the package.

Right.

I (wrongly) expected that people would come here from the node.js docs such as https://nodejs.org/api/intl.html#providing-icu-data-at-runtime and not find the module on their own. I'll work on some improvement.

mike-lischke commented 2 years ago

Thanks for the reply. I'm actually looking for a way to use ICU functionality in a Node.js app (converting Java to Typescript code). There are a number of Unicode files available as Node modules, but I'm not interested to write my own Node.js ICU variant :-)

After reading the the paragraph in the Node.js documentation I still don't know what the full-icu module is for. After all ICU is embedded in Node.js, so why having an ICU node module. But that's just out of curiosity. Regards!

srl295 commented 2 years ago

@mike-lischke so, https://nodejs.org/api/intl.html#internationalization-support will list the different internationalization APIs in Node.js. What specific functionality did you have in mind?

After all ICU is embedded in Node.js, so why having an ICU node module

Because while ICU is embedded in Node.js, its data historically was not. So full-icu is an easy (hopefully) way to get that data.

Since Node.js 13, the full ICU data is available by default: https://nodejs.medium.com/node-js-12-to-lts-and-node-js-13-is-here-e28d6a4a2bd

mike-lischke commented 2 years ago

Well, I need Unicode Block information, character properties (e.g. classes) and more. In the java2ts translator I need to match the Java ICU functionality, if used in the original code. In another project of mine I implemented random sentence generation (for ANTLR4 grammars) and need to pick randomly Unicode blocks and characters (https://github.com/mike-lischke/vscode-antlr4/blob/master/src/backend/Unicode.ts). So there's indeed a need to get ICU functionality in Node.js (besides JS' Unicode regexp features).