Skip to content

efkan/node-intl-polyfill-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

INTL POLYFILL and IMPLEMENTATION     (Internationalization API) on NODE.JS

 In Node.js Intl support is not enabled by default yet. Also Intl ICU files should be prepared and added in different ways according to the OS platform.  Beacuse of that, in this example AndyEarnshaw's Intl module has been implemented. It provides a run-time and cross-platform solution.

Setup

If Node.js has been installed on your OS, just download this repository, open a console in the downloaded folder and run the command of npm install to install related node modules.

Then run the command of node app, open your browser and visit http://localhost:3000.

To run static example open another console and run the command of node static. Then open your browser and visit http://localhost:4000.

This example shows how to apply polyfills to beautiful Intl package for the purpose of internationalization (i18n).

Intl package of andyearnshaw provides Javascript Intl object to Node.js (except collators).

Example contains two Node.js applications, app.js for to show complex example and static.js for to show a simple translation.

The apps use three Yahoo Intl packages:

Also apps use a simple-logic translation by using global variables.

All of these bring the following beautiful functions with an object to the Intl object:

  • Intl.NumberFormat
  • Intl.DateTimeFormat
  • Intl.MessageFormat
  • Intl.RelativeFormat
  • Intl.Translations

app.js example screenshot

launch

static.js example screenshot (simple translation)

launch

About

An Intl polyfill example and boilerplate for Node.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published