All Projects → danilobuerger → react-intl-loader

danilobuerger / react-intl-loader

Licence: MIT license
Async react-intl locale data loader for webpack

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-intl-loader

v-intl
Add i18n to your awesome Vue 3 app 🔉
Stars: ✭ 13 (-71.74%)
Mutual labels:  intl
pe-loader
A Windows PE format file loader
Stars: ✭ 81 (+76.09%)
Mutual labels:  loader
core
An advanced and highly optimized Java library to build frameworks: it's useful for scanning class paths, generating classes at runtime, facilitating the use of reflection, scanning the filesystem, executing stringified source code and much more...
Stars: ✭ 100 (+117.39%)
Mutual labels:  loader
react-nested-loader
The easiest way to manage loaders/errors inside a button. NOT an UI lib.
Stars: ✭ 62 (+34.78%)
Mutual labels:  loader
lp-loader
Frictionless language packs for Webpack.
Stars: ✭ 14 (-69.57%)
Mutual labels:  loader
tiny-skeleton-loader-react
zero dependency, ultra lightweight (1KB gzipped) skeleton loader component for react 🐥
Stars: ✭ 28 (-39.13%)
Mutual labels:  loader
skeleton-loader
Loader module for webpack to execute your custom procedure. It works as your custom loader.
Stars: ✭ 19 (-58.7%)
Mutual labels:  loader
moonlight-admin
Easy to use admin panel, designed for cheat loaders.
Stars: ✭ 29 (-36.96%)
Mutual labels:  loader
svelte-intl
Internationalize your Svelte apps using format-message and Intl object
Stars: ✭ 48 (+4.35%)
Mutual labels:  intl
webpack-image-srcset-loader
Generate srcset string from image
Stars: ✭ 28 (-39.13%)
Mutual labels:  loader
ngx-loaders-css
Loaders.css component for Angular X
Stars: ✭ 13 (-71.74%)
Mutual labels:  loader
webpack-modernizr-loader
Get your modernizr build bundled with webpack, use modernizr with webpack easily
Stars: ✭ 35 (-23.91%)
Mutual labels:  loader
react-intl-currency-input
React component for i18n currency input using Intl API.
Stars: ✭ 158 (+243.48%)
Mutual labels:  intl
markup-inline-loader
a webpack loader to embed svg/MathML to html
Stars: ✭ 24 (-47.83%)
Mutual labels:  loader
react-native-less-transformer
Use Less to style your React Native apps.
Stars: ✭ 26 (-43.48%)
Mutual labels:  loader
react-native-pullview
scrollview&&FlatList Pull refresh and loadmore
Stars: ✭ 26 (-43.48%)
Mutual labels:  loader
ngx-loader-indicator
Awesome loader for angular applications. No wrappers only you elements
Stars: ✭ 44 (-4.35%)
Mutual labels:  loader
favicon-canvas-loader
Create and display a circular loading <canvas> animation as a webpage favicon.
Stars: ✭ 83 (+80.43%)
Mutual labels:  loader
Prevailer-orientation-support-library-for-Android
Prevailer is a simple android library that helps in preserving object instances across orientation change in android and is JAVA 8 and MVP ready.
Stars: ✭ 17 (-63.04%)
Mutual labels:  loader
enlite-starter
Enlite Starter - React Dashboard Starter Template with Firebase Auth
Stars: ✭ 28 (-39.13%)
Mutual labels:  intl

react-intl-loader

Async react-intl locale data loader for webpack.

Motivation

Instead of needing a long utility function with a require.ensure for every locale, you can write something like this:

// ES6 syntax

const locales = {
  en: () => require('react-intl?locale=en!./en.json'),
  de: () => require('react-intl?locale=de!./de.json')
}

function loadLocaleData (locale) {
  return new Promise((resolve) => {
    locales[locale]()(resolve)
  })
}

loadLocaleData(someLocale).then((messages) => {
  // do something with messages
})

Installation

$ npm install --save intl intl-locales-supported react-intl
$ npm install --save-dev react-intl-loader

Usage

Documentation: Using loaders

To asynchronously load your locale data from ./en.json with the locale en, use:

require('react-intl?locale=en!./en.json')(function (messages) {
  // messages contains the require of ./en.json
});

This will asynchronously require (via webpack's require.ensure) the following modules:

'intl/locale-data/jsonp/en' // Optional: only if Intl does not support this locale
'react-intl/locale-data/en'
'./en.json'

You can use any file and file type for your locale data as long as you have the appropriate webpack loader installed and configured.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].