question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with setting language

See original GitHub issue

I cannot succeed setting the language in numbro, with language.min.js included. I’m using the CDN-include. What am I doing wrong?

HTML

<div id="number"></div>

JS

numbro.setLanguage("de-DE");
var number = numbro("1111111111").format({thousandSeparated: true});
document.getElementById("number").innerHTML = number;

The result should read 1.111.111.111 but it is 1,111,111,111.

When I step into the underlying method, the variable languages contains only “en-US”, but numbro.allLanguages contains “de-DE”. Somehow the initialization does fail…

http://jsfiddle.net/rj927ewm/

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
the-spykecommented, Feb 4, 2019

If you’re using imports it will be:

import numbro from "numbro";
import languages from "numbro/dist/languages.min";
Object.values(languages).forEach(l => numbro.registerLanguage(l));
3reactions
marcormcommented, Sep 4, 2019

If you want to register one language only:

import numbro from 'numbro'<br/>
import languages from 'numbro/dist/languages.min'
numbro.registerLanguage(languages['it-IT']);
numbro.setLanguage('it-IT')
Read more comments on GitHub >

github_iconTop Results From Across the Web

Change your language on the web - Android - Google Support
Fix problems with changing language. To check your Google Account language, open your Google Account. You'll find the language you selected.
Read more >
Problems with changing System Language of my Laptop ...
Hi! I'm just concerned about changing the system language of my laptop since I changed everything in the Settings > Language sections part ......
Read more >
FIX: Windows 10 Display Language Not Changing (Solved)
How to fix: Cannot Change the Windows 10 Display Language. · 1. Navigate to Start menu · 2. At Language options, click the...
Read more >
How to fix Windows display language not changing?
Solution 1. Fix Corrupted System Files · Reboot your system · If SFC returned an error, then use the following command lines, pressing...
Read more >
3 Quick Ways to Fix Chrome When the Language is Not ...
To fix the problem, you can also adjust the language settings in Chrome and check if that helps.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found