All Projects → format-message → Format Message

format-message / Format Message

Licence: mit
Internationalization Made Easy

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Format Message

Eslint Plugin I18n Json
Fully extendable eslint plugin for JSON i18n translation files.
Stars: ✭ 101 (-44.2%)
Mutual labels:  internationalization
Javascript Number Formatter
Lightweight & Fast JavaScript Number Formatter
Stars: ✭ 119 (-34.25%)
Mutual labels:  internationalization
Arbify
ARB files localization tool. Dedicated to Flutter and its intl package.
Stars: ✭ 168 (-7.18%)
Mutual labels:  internationalization
Pseudo Localization
Dynamic pseudo-localization in the browser and nodejs
Stars: ✭ 109 (-39.78%)
Mutual labels:  internationalization
React Native Localize
🌍 A toolbox for your React Native app localization
Stars: ✭ 1,682 (+829.28%)
Mutual labels:  internationalization
Dom I18n
Provides a very basic HTML multilingual support using JavaScript
Stars: ✭ 125 (-30.94%)
Mutual labels:  internationalization
Ajv I18n
Internationalised error messages for Ajv JSON-Schema validator
Stars: ✭ 98 (-45.86%)
Mutual labels:  internationalization
React Translated
A dead simple way to add complex translations (i18n) in a React (DOM/Native) project 🌎🌍🌏
Stars: ✭ 176 (-2.76%)
Mutual labels:  internationalization
React Most Wanted
React starter kit with "Most Wanted" application features
Stars: ✭ 1,867 (+931.49%)
Mutual labels:  internationalization
Jquery.ime
jQuery based input methods library
Stars: ✭ 145 (-19.89%)
Mutual labels:  internationalization
Django Translations
Django model translation for perfectionists with deadlines.
Stars: ✭ 109 (-39.78%)
Mutual labels:  internationalization
Phabricator zh hans
Phabricator zh-Hans Translation & Tools.
Stars: ✭ 113 (-37.57%)
Mutual labels:  internationalization
Jquery I18next
i18next plugin for jquery usage
Stars: ✭ 143 (-20.99%)
Mutual labels:  internationalization
Shiny.i18n
Shiny applications internationalisation made easy
Stars: ✭ 104 (-42.54%)
Mutual labels:  internationalization
Formatjs
The monorepo home to all of the FormatJS related libraries, most notably react-intl.
Stars: ✭ 12,869 (+7009.94%)
Mutual labels:  internationalization
Android Gradle Localization Plugin
Gradle plugin for generating localized string resources
Stars: ✭ 100 (-44.75%)
Mutual labels:  internationalization
Vue I18n Extract
Manage vue-i18n localization with static analysis
Stars: ✭ 123 (-32.04%)
Mutual labels:  internationalization
Attranslate
Semi-automated Text Translator for Websites and Apps
Stars: ✭ 178 (-1.66%)
Mutual labels:  internationalization
Node Gettext
A JavaScript implementation of gettext, a localization framework.
Stars: ✭ 175 (-3.31%)
Mutual labels:  internationalization
Date
🗓 A library to help you work with dates in multiple languages, based on Carbon.
Stars: ✭ 1,773 (+879.56%)
Mutual labels:  internationalization

format-message

Internationalize text, numbers, and dates using ICU Message Format.

npm Version Build Status

JS Standard Style MIT License

Internationalization Made Easy

Start simple. Wrap any user-facing message with formatMessage(). Don't forget to import/require format-message.

var formatMessage = require('format-message');
// ...
formatMessage('My Account Preferences')

Don't concatenate message pieces, use placeholders instead.

formatMessage('Hello, { name }!', { name: user.name })

You can even pick plural and gender forms with placeholders.

formatMessage(`{
  gender, select,
    male {His inbox}
  female {Her inbox}
   other {Their inbox}
 }`, { gender: user.gender })

 formatMessage(`{
   count, plural,
      =0 {No unread messages}
     one {# unread message}
   other {# unread messages}
 }`, { count: messages.unreadCount })

Need to provide extra information to translators? Add a message description. Need 2 translations to the same English message? Add a message id.

formatMessage({
  id: 'update_action_button',
  default: 'Update',
  description: 'Text displayed on the update resource button to trigger the update process'
})
formatMessage({
  id: 'update_label',
  default: 'Update',
  description: 'Label on each item that is an update to another item'
})

Extract all of the messages you've used in your source code.

$ npm i format-message-cli
$ format-message extract "src/**/*.js" > ./locales/en/messages.json

Check that the translators preserved placeholders and proper message formatting.

$ format-message lint -t ./locales/index.js "src/**/*.js"

Use the translations at runtime.

formatMessage.setup({
  generateId: require('format-message-generate-id/underscored_crc32'),
  translations: require('./locales'),
  locale: 'pt'
})

Make a locale-specific build.

$ format-message transform --inline --locale pt "src/**/*.js" > bundle.pt.js

Need more details?

Check out the many ways you can use format-message in your project:

License

This software is free to use under the MIT license. See the LICENSE-MIT file for license text and copyright information.

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].