Questions tagged [formatjs]

FormatJS is a modular collection of JavaScript libraries for internationalization that are focused on formatting numbers, dates, and strings for displaying to people.

FormatJS is a modular collection of JavaScript libraries for internationalization that are focused on formatting numbers, dates, and strings for displaying to people. It includes a set of core libraries that build on the JavaScript Intl built-ins and industry-wide i18n standards, plus a set of integrations for common template and component libraries.

http://formatjs.io/

39 questions
13
votes
1 answer

i18n for react, formatjs, react-intl

I want to use ICU standard for my i18n in my react app. I want to store my language files like http://userguide.icu-project.org/locale/localizing#TOC-.txt-resource-bundles : de { key1 { "Deutsche Sprache " "schwere Sprache" } key2 {…
DeBoer
  • 551
  • 1
  • 7
  • 15
12
votes
2 answers

React-intl multi language app: changing languages and translations storage

I have react-router app and would like to add i18n. In react-intl example root component wrapped in IntlProvider: ReactDOM.render( , document.getElementById('container') ); But there is only one…
qwe asd
  • 1,274
  • 3
  • 17
  • 31
4
votes
3 answers

Where to find locale for US in @formatjs/intl-relativetimeformat/dist/locale-data/

I'm migrating react-intl to version 3.0, and need to polyfill locale-data for IE. Specifically I want to load a polyfill of locale data for en-US. I can only find @formatjs/intl-relativetimeformat/dist/locale-data/en locale file. if…
Ant1
  • 145
  • 1
  • 7
4
votes
1 answer

Localizing a currency range

A combination of formatjs & javascript's native Intl.NumberFormat() supports formatting of numbers as currency in various cultures and units. But how can I format a range of currency as $1,000.00 - 5000.00. Without repeating the symbol, where ever…
Jason Kleban
  • 18,057
  • 15
  • 68
  • 116
4
votes
0 answers

Use java resource bundles for i18n in React

I'm migrating relatively large java application to React and need to implement internationalisation in React application. Sure, there are many libraries available for i18n in React, like FormaJS and i18next but I found most of them not answering to…
Mikhail Chibel
  • 1,635
  • 1
  • 17
  • 31
4
votes
1 answer

React Intl v2 unable to use with date from SQL

I've been building an demo with React and came across react-intl. I tried to use the FormattedDate component with a 'value' that is returned from an API call and is stored in 'this.state' However the page fails to load and the console shows: …
Thacker
  • 41
  • 1
  • 6
3
votes
0 answers

How to use format.js with node.js

I want to translate error messages on the backend written with the node using https://formatjs.io/ (REST API). Is it possible? I will do the translations based not "accept-language" header.
3
votes
2 answers

How to format a number to percentage with two decimals using FormatJs Message Syntax?

Using react-intl I have the following message: serviceFee: { en: 'Service fee: ({fee, number, percent})', ... }, When I call I expect it to render: Service fee: 6.25% But I get a…
Ramon Balthazar
  • 2,775
  • 3
  • 21
  • 29
2
votes
0 answers

Casing of react-intl does not match the underlying filesystem

Current behavior import { FormattedMessage } from 'react-intl throws eslint error module "/node_modules/react-intl/lib/react-intl" Casing of react-intl does not match the underlying filesystem.eslint(import/no-unresolved) This wasn't…
Henry
  • 301
  • 3
  • 11
2
votes
1 answer

How do I use formatJS/CLI with create-react-app

Really dumb question - what's the correct glob format? I'm trying to run formatjs extract ./src/**/*.js But it's only going one level deep.
Adam
  • 41,349
  • 10
  • 58
  • 78
2
votes
0 answers

react-intl composite message

I'm struggling to work out the best way to structure messages whereby one of the dynamic values also needs a translation. For example if I have the message 'Type in Spanish...' I would like to use this message in every different combination for all…
djskinner
  • 7,517
  • 4
  • 46
  • 70
1
vote
1 answer

How to use intl.formatRelativeTime() in the correct way

In my React app, I have to show info saying create 1 hour ago or 1 day ago and also plural as 10 minutes ago or 3 days ago. To achieve that I'm trying to use this API FormatJS and in the specific intl.formatRelativeTime() What I tried so far is…
Jakub
  • 1,295
  • 3
  • 16
  • 39
1
vote
1 answer

No messages returned when running formatjs extract on project. Any ideas of why?

So, I'm implementing a project in Electron and wanted to implement internationalization into it. I have a simple component that uses react-intl's FormattedMessage and a messages.js file with a description of its message. I tried to follow the…
1
vote
1 answer

Adding new translations

I'm using FormatJS to localize my app. There's a handy CLI to extract all the translations from the code base. I can generate the en.json file, and send it to the translator. When I get the translation back I can save this as fr.json. So far so…
mrtnmgs
  • 1,066
  • 11
  • 22
1
vote
1 answer

Error: Debug Failure. Output generation failed when running formatjs extract

When running formatjs extract this is what we got. From the stack trace it seems that the issue is from formatjs themselves. Feel like I am stuck on what the issue is here. $ formatjs extract './src/**/*.{js,ts,tsx}' --out-file…
developarvin
  • 4,594
  • 12
  • 48
  • 97
1
2 3