阿西河

所有教程

公众号
🌙
阿西河前端的公众号

我的收藏

    最近访问  (文章)

      教程列表

      抓包专区
      测试专区

      Node.js 在运行时提供 ICU 数据

      Node.js 在运行时提供 ICU 数据

      If the small-icu option is used, one can still provide additional locale data at runtime so that the JS methods would work for all ICU locales. Assuming the data file is stored at /some/directory, it can be made available to ICU through either:

      • The NODE_ICU_DATA environment variable:
        env NODE_ICU_DATA=/some/directory node
        
      • The –icu-data-dir CLI parameter:
        node --icu-data-dir=/some/directory
        

      (If both are specified, the –icu-data-dir CLI parameter takes precedence.)

      ICU is able to automatically find and load a variety of data formats, but the data must be appropriate for the ICU version, and the file correctly named. The most common name for the data file is icudt6X[bl].dat, where 6X denotes the intended ICU version, and b or l indicates the system’s endianness. Check “ICU Data” article in the ICU User Guide for other supported formats and more details on ICU data in general.

      The full-icu npm module can greatly simplify ICU data installation by detecting the ICU version of the running node executable and downloading the appropriate data file. After installing the module through npm i full-icu, the data file will be available at ./node_modules/full-icu. This path can be then passed either to NODE_ICU_DATA or –icu-data-dir as shown above to enable full Intl support.


      更多内容请参考:Node.js 国际化支持,或者通过 点击对应菜单 进行查看;


      目录
      本文目录
      目录