Giter Club home page Giter Club logo

inter's People

Contributors

alexjeffburke avatar gustavnikolaj avatar papandreou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

inter's Issues

Timezone America/Ciudad_Juarez not found in moment-timezone

Zoneinfo.js
var val = Object.values(moment.tz._zones).some(function (x) { return typeof x !== 'string' && x.name === timeZoneId ;});

apparently, for this timeZoneId, we are getting different names, we are getting the following error.
Error: Timezone America/Ciudad_Juarez not found in moment-timezone.

Missing renderCurrency method

It seems that there is currently no currency rendering method? The patterns are available in CLDR and the implementation shouldn't be too hard to figure out either.

The syntax could look like this:

inter.load('en');
inter.renderCurrency( 10000.23, 'EUR' ); // €10,000.23
inter.renderCurrency( 10000.23, 'EUR', true ); // EUR10,000.23

The 2nd param is of course, the currency we want to see the results in. The 3rd param is borrowed from Google Closure's implementation where they let the user decide if they need a global or local representation of the currency symbol.

buildInter times out

Hello, I tried building inter with CLDR 23.1, because 22.1 has some wrong locale data. However, I had no success - the process just keeps running forever. I got tired after about half an hour.

Any idea what might cause this? I used CLDR 23.1 as the input.

Expose currency special attributes from supplementalData

We could expose digits, rounding, cashDigits, cashRounding from supplementalData.currencyData.fractions, for instance as part of inter.getCurrency

If a currency is not in the list, I suppose we should fall back to using 2 as value for those four properties.

Allow setting precision for renderPercentage method

I know the original ICU implementation does not provide this, but it makes a lot of sense. User should be able to provide the precision for renderPercentage method. Sometimes it is necessary to show something like 0.5%. Currently, it's only possible to go as low as 1%.

Add currency precision parameter to renderCurrencyShort

currently renderCurrencyShort has a fixed precision of 2 digits after the decimal point for all currencies example:

renderCurrencyShort(10, 'JPY', 'latin') will render 10.00 which is not correct since JPY does not support decimal digits according to ISO-4217, my suggestion is to add an extra parameter for precision to renderCurrency or add a precision value to each element in the currencies array and let it decide the number of decimal digits for each one.

Consider a different, perhaps more browser-friendly architecture

First, thanks a lot for this module. It has no doubt been a lot of work!

Consider this as a discussion from someone who does not fully understand the motivation or rationale behind the current architecture.

As I understand, if I want to use inter in the browser, I need to build a different version of it for each locale. If I use a single locale in my client-side app, that works just fine. But when I need to use 2 different locales at the same time, I will probably get into trouble. Why? because I need to load the FULL logic + data both times.

Wouldn't it make more sense to separate the logic from data so that loading multiple locales in the browser (say 2-3 at a time) will be a lot lighter?

Replacement for defaultDateTimePattern

In 4191753 the defaultDateTimePattern property was removed from the calendars, but it turns out I am using this in another library, like this:

var timeFormatString = inter.getDateFormat(formatId[0]),
      dateFormatString = inter.getDateFormat(formatId[1]);
      dateFormat = inter.calendars.gregorian.defaultDateTimePattern.replace('{0}', timeFormatString).replace('{1}', dateFormatString);

Could you advise what the ideal way of replacing this in my end is?

South Sudan is missing in the countries list

For a territory to be classified as a country, it currently has to be listed in https://github.com/papandreou/inter/blob/master/worldInfo/countries.csv and not be historical, nor a subdivision. The list appears to be a a bit outdated (the timestamps in the last column of the file say 2007-10-24). South Sudan declared its independence in 2011, and there has probably been other changes as well.

@bramstein, I think I got the file from you, do you know where I can find an updated version?

CC: @birkestroem

TypeError: Cannot call method 'charCodeAt' of undefined

var inter = require('inter').load('en_in');
console.log(inter.renderNumber(10000000.23));

Results in:

TypeError: Cannot call method 'charCodeAt' of undefined
    at subformatFixed (/Library/WebServer/Documents/node_projects/test_inter/node_modules/inter/build/root.js:175:121)
    at format (/Library/WebServer/Documents/node_projects/test_inter/node_modules/inter/build/root.js:350:84)
    at Object.(anonymous function) [as renderNumber] (/Library/WebServer/Documents/node_projects/test_inter/node_modules/inter/build/root.js:573:162)

I guess this is an issue with this specific locale

makeFileSizeRenderer, always showing size with in GB

For makeFileSizeRenderer, I've got a use case for always showing the size in GB, even though the size might be just a few bytes.

If I were to make a pull request to add such support, would you also like me to rewrite the function so it doesn't use the Function constructor, but just return a normal function instead?

Math float issue arises when formatting certain numbers

Trying to format a number like 123456789201921 reveals the underlying issue with float-precision math that JS has. The result is something like 123,456,789,201,920.992 while it should be 123,456,789,201,921.

I stumbled upon this while working on my own fork of Numeral-JS. The issue can probably only be solved if using a specialized library like Big.js

Of course, this is probably an edge case, but perhaps it is something to be considered.

Inter v1.10.0 missing the 'build' folder

For some reason, npm published inter v1.10.0 without having created the 'build' folder, nor erroring out.

npm publish
> [email protected] prepublish /some/local/path
> rm -fr build && ./bin/buildInter --type node -o build --all --golf --jobsize 100
+ [email protected]

I've unpublished it now, but have to check tomorrow what's going on.

ReferenceError: umalqura is not defined

I was trying to give inter a go but stumbled upon this:

ReferenceError: umalqura is not defined
    at /Library/WebServer/Documents/node_projects/test_inter/node_modules/inter/build/et.js:1669:41
    at /Library/WebServer/Documents/node_projects/test_inter/node_modules/inter/build/et.js:3:26

It looks like it's caused by these 2 lines:

monthNames: P.calendars.islamic-umalqura,
eraNames: P.calendars.islamic-umalqura,

Accessing a property name with a dash in using dot-notation, is, of course, invalid. You should be using literal notation instead.

monthNames: P.calendars['islamic-umalqura'],
eraNames: P.calendars['islamic-umalqura'],

I think it would be best if you would check if the property name has any dashes and use literal notation only then, because literal notation can have a small impact on file size (which matters, if used in browser).

Wrong spellout cardinal for et locale

console.log(inter.renderSpelloutCardinal(2439871));

Gives: üks miljonit nelisada ükskümmend üheksa tuhat kolmkümmend üks

The above result is totally messed up. It should say:
kaks miljonit nelisada kolmkümmend üheksa tuhat kaheksasada seitsekümmend üks

Basically, translated to english, it is currently saying:
One millione four-hunderd onety-nine-thousand thrity-one

I guess there must be a serious flaw in the cardinal function generator.

Add currencySpacing support in the renderCurrency methods

In CLDR, there is a currencySpacing section available, which has the same content for each number system and locale. This information is being made available by node-cldr now:
papandreou/node-cldr@a31ab16

In currencySpacing, there's a regex "[:^S:]", which according to this page stands for Symbol:
http://unicode.org/glossary/#graphic_character

In the case of currencySpacing, we could limit its range to just currency symbols:
http://unicode.org/charts/PDF/U20A0.pdf

We could expand [:^S:] to:
/[^\u20a0-\u20cf \u0024 \u00a2-\u00a5 \u0192 \u058f \u060b \u09f2 \u09f3 \u0af1 \u0bf9 \u0e3f \u17db \u2133 \u5143 \u5186 \u5706 \u5713 \ufdfc]/

@papandreou do you agree with doing such an expansion in inter, or would it fit better in node-cldr?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.