Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.0.0-alpha #23

Closed
2 of 8 tasks
aaylward opened this issue Jun 14, 2013 · 14 comments
Closed
2 of 8 tasks

v2.0.0-alpha #23

aaylward opened this issue Jun 14, 2013 · 14 comments

Comments

@aaylward
Copy link
Contributor

Let's use this issue to create a roadmap for humanize v2.

Some things we may want to do:

  • Remove methods that were deprecated in 1.x
  • Drop support for node 0.6.x Upgrading Grunt #13 dd4d5ca
  • Move to grunt ~0.4.1 Upgrading Grunt #13 dd4d5ca
  • intword has been removed from the v2.0.0alpha branch in favor of compactInteger.
  • Naming conventions are addressed in V2/camel case #26
  • truncatenumber is renamed boundedNumber in 98a5be8
  • Consider removing intComma as well. I don't think it adds value over formatNumber.
  • Consider removing public/ from git as it's really just compiled output, not source code.
This was referenced Jun 17, 2013
@aaylward
Copy link
Contributor Author

aaylward commented Jul 1, 2013

We may want to look into some variation of #43 if we want to have an idea of Humanize(value).method(options).

@b-ash
Copy link
Contributor

b-ash commented Jul 1, 2013

I think I like the globally-namespaced nature we have now. The real draw to this is how lightweight it is - the less code / hassle, the better.

@zackbloom
Copy link
Contributor

It shouldn't be all that much code to allow what @aaylward is saying, what about something like this:

extend = (a, b) ->
  for key, val of b when b.hasOwnProperty(key)
    a[key] = b
  a

clone = (obj) ->
  extend {}, obj

methods = {
  doSomething: (a, b, c) ->
}

partiallyApply = (fn, vals..., context) ->
  (args...) ->
    fn.call(context, vals..., args...)

Humanize = (vals...) ->
  if vals?.length
    methods = clone(methods)
    for key, method of methods
      methods[key] = partiallyApply(method, vals..., methods)

  methods

extend(Humanize, Humanize())

That way there is no overhead if you don't use the chaining, and we only add a few lines of code.

@hijonathan
Copy link
Contributor

Both are good first passes. I've seen other implementations, like Moment's (inspired by jQuery I think) and underscore's, that I think are cool too. Thoughts on either of those?

@aaylward
Copy link
Contributor Author

aaylward commented Jul 9, 2013

Something else we may want to consider for this release is supporting more loaders. I think Q has a cool approach: https://github.com/kriskowal/q/blob/master/q.js#L29-L63

@Pasvaz
Copy link

Pasvaz commented Jul 25, 2013

It would be really great to support localization and translations using external files for costans allowing the community to add their own translations.

@hijonathan
Copy link
Contributor

@Pasvaz +1 million. I'd love to do that, but I don't have much experience with internationalization. Any ideas to help us get started?

@Pasvaz
Copy link

Pasvaz commented Jul 26, 2013

The simplest approach is to keep the language specific strings into separate files indexed by key-value and include/load them according to the language settings, the tricky part is to handle pluralization correctly.

For instance, prefix = 'Less than' would be prefix = t('less-than') and locale.en.js contains less-than = 'Less than' while locale.it.js would contain less-than = 'Meno di'. This is just an example, there are many ways to accomplish this task, you can also load translations into arrays and use them like prefix = lang['less-than'] or even using globals (better to avoid this).

For what regards the localization (dates, numbers, formats) there are plenty of projects that have already localized them, for instance Moment.js support the date format and the day names for many languages, also, the ICU project should support any language afaik. But except pluralization that requires some logic, all those steps are quite trivial.

@seblavoie
Copy link

I am currently working on a project on which I would benefit from the localization/translation support feature you previously mentioned. I could sure contribute with a pull request if you guys are interested. I just wanted to make sure the project was still under development first, as this discussion is about a year old.

@b-ash
Copy link
Contributor

b-ash commented May 23, 2014

@seblavoie I'm happy to take a look at a PR. I18n work can be a bit tricky in this context, especially when dealing with functions like pluralize, pace, etc. We'll need to have some tokens that can be swapped out when translating strings that have context, and I'd recommend moment.js for time-related operations. Do you have any ideas on how you'd approach it here?

@seblavoie
Copy link

If fact I did not really have a well defined plan on how I would do it yet. That being said, I also think that going with moment.js would do a great job regarding time operations.

About the l18n, I think the pluralize method wouldn't need much change as we can already specify the alternative plural version (unless I’m missing something?). Although times, ordinal and particularly pace will need to be adapted. I will try to come up with something a little more thought of so we discuss it.

@yairEO
Copy link

yairEO commented Oct 7, 2015

is this an abandonware? Would like to know taking the time to submit bugs and address owners about thoughts and stuff. it very much seems like one.

@blakeyc
Copy link

blakeyc commented Mar 11, 2016

@aaylward - Is anyone maintaining this project anymore?

I use this frequently for most projects would be happy to start contributing to v2.

@aaylward
Copy link
Contributor Author

@blakeyc @yairEO the project is maintained, but I should have closed this issue a while ago (it's almost 3 years old now).

I recommend that you submit any changes as PRs into v1.x, and then we can worry about a major version bump in the context of some specific change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants