Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need an option to download ICU files even if we're not in small-icu situation #77

Open
TBG-FR opened this issue Nov 16, 2022 · 4 comments

Comments

@TBG-FR
Copy link

TBG-FR commented Nov 16, 2022

Hello there !

Issue summary

I can't get an environment in small-icu without pain, and without a such environment, I can't get the files needed to switch to full-icu in another app

Proposal

Could we have an option to still get icudtxxy.dat files downloaded into node-modules/full-icu, even if we are not in small-icu and it will probably be useless ?

Details

I'm facing issues with pkg , that allows to build binaries. It looks like that pkg is built with small-icu, and that causes issues in my app. However, to give the right icu files (i.e. icudt70l.dat), I need to get them, and full-icu won't let me, because the original environment/node isn't in small-icu (Note: Your node was not compiled with the ‘small-icu’ case, so the ICU data is not customizable through this script. Exitting.)

However, since Node is now built in full-icu, I can't get a small-icu, I spent many hours trying, without success 🤯
The icu4c version I need isn't available on npm, and I don't know what to do with Github releases to get the .dat files...
And full-icu seems to be my savior here, it knows how to handle all of these !

Here's a basic example (index.js)

const icu = require('full-icu');
console.log(icu);

const dateKO = new Date('2022-08-14').toLocaleDateString('ko-KR', { day: 'numeric', month: 'short', year: 'numeric' });
console.log(dateKO);

const dateFR = new Date('2022-08-14').toLocaleDateString('fr-FR', { day: 'numeric', month: 'short', year: 'numeric' });
console.log(dateFR);

If I run it inside a node docker (my usual dev environment), I get

{
  nodever: '14.19.1',
  node_maj: '14',
  node_min: '19',
  icu_small: false,
  icuver: '70.1',
  icumaj: '70',
  icuend: 'l',
  icupkg: 'icu4c-data@70l',
  icudat: 'icudt70l.dat',
  haveDat: [Function: haveDat],
  datPath: [Function: datPath]
}
2022 8 14
14 août 2022

But once I package it, I get

{
  nodever: '14.20.0',
  node_maj: '14',
  node_min: '20',
  icu_small: true,
  icuver: '70.1',
  icumaj: '70',
  icuend: 'l',
  icupkg: 'icu4c-data@70l',
  icudat: 'icudt70l.dat',
  haveDat: [Function: haveDat],
  datPath: [Function: datPath]
}
Aug 14, 2022
Aug 14, 2022

Many thanks in advance ! 🙏

@AugustinMauroy
Copy link
Member

Hey! Sorry for the latence. But, wdym by "I package it". Have you an repo for this code to test every things.

@TBG-FR
Copy link
Author

TBG-FR commented Apr 5, 2023

Hey! Sorry for the latence. But, wdym by "I package it". Have you an repo for this code to test every things.

No worries 😉 I detailed every step here vercel/pkg#1731

@srl295
Copy link
Member

srl295 commented Apr 6, 2023

Hey! Sorry for the latence. But, wdym by "I package it". Have you an repo for this code to test every things.

No worries 😉 I detailed every step here vercel/pkg#1731

This isn't a packagable package. It's a loading hack. In short: Don't prepackage it... more on this later.

@srl295
Copy link
Member

srl295 commented Apr 6, 2023

You could help us split full icu into a Helper library maybe ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants