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.

question: what would be the simplest way to customize abbreviations?

See original GitHub issue

for instance, my designer wants a capital ‘M’ for millions v lowercase ‘m’, i see i could overwrite my entire locale spec, but i was hoping for a more terse way, something like:

numeral.language().override({abbreviations: {million: 'M'}})

or i could use underscore/lodash extend() or default() against the abbreviation object if there was a method to return it, but right now it looks like numeral.language() just returns the string name of the language…

regards, tony.

Issue Analytics

  • State:open
  • Created 10 years ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

2reactions
wuzhuzhucommented, Jul 18, 2017

In chinese culture, we don’t use thousands as a delimiter, but in 10k, as a ‘1万’. Is there any way to make a custom 4 digit per delimiter local config?

1reaction
flynfishcommented, Nov 3, 2015

@cymen you should be able to using the CDN version as it shouldn’t be any different then having the JS loaded locally.

You can modify the object that’s returned from numeral.languageData() using underscore/lodash to change just the abbreviations or do as @wopian showed to overwrite everything.

_.assign(numeral.languageData('en'), {
    abbreviations: {
        thousand: "K",
        million: "M",
        billion: "B",
        trillion: "T"
    }
});

In my case, I didn’t want abbreviations enabled so I null them out:

_.assign(numeral.languageData(), { abbreviations: {} })
Read more comments on GitHub >

github_iconTop Results From Across the Web

Grammar: Abbreviations and Acronyms - GCF Global
A good rule for abbreviations is to put the reader first. Ask yourself: Will the abbreviation make the sentence easier to read, or...
Read more >
What is the java regex to extract words and abbreviations?
Using the regex [\\w']+ suggested in this question, I can extract the words. But, the abbreviated words are coming as separate words for ......
Read more >
Expert writing tip: Easily create list of abbreviations in a Word ...
Open an Excel spreadsheet. In the home ribbon, navigate to Paste> Paste options and select 'Match Destination formatting'. This will paste all ...
Read more >
How to Create a List of Abbreviations in Microsoft Word | Proofed
You can create a list of abbreviations manually by going through your work and noting each one down, then adding them all to...
Read more >
Double-check your acronyms – quick and easy - YouTube
This video will show you how to double-check that you have used your acronyms correctly in your document or paper i.e. that you...
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