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

I18n #34

Open
cullophid opened this issue Mar 26, 2016 · 4 comments
Open

I18n #34

cullophid opened this issue Mar 26, 2016 · 4 comments

Comments

@cullophid
Copy link
Owner

Add simple i18n support

@gsantiago
Copy link

@cullophid What about i18n support?

@gsantiago
Copy link

I think we could create a function called formatWithLocale() which works exactly like format but receives a locale object as first argument. Then, the format function could just be a curried version of formatWithLocale:

const format = formatWithLocale(DEFAULT_LOCALE)

With this approach, I could create formatters with any locale:

import { formatWithLocale } from 'date-fp'

// I can define my own locale
const LOCALE_PT_BR = {
  MONTHS: ...,
  WEEKDAYS: ...,
  ...
}

export const formatPtBr = formatWithLocale(LOCALE_PT_BR) 

It would be nice to have some locales available in the package too:

import { formatWithLocale } from 'date-fp'
import LOCALE_PT_BR from 'date-fp/locales/pt-br'

export const formatPtBr = formatWithLocale(LOCALE_PT_BR)

@cullophid, what you think?

@cullophid
Copy link
Owner Author

That sounds like a great idea!
I would merge that PR ;)

@cullophid cullophid reopened this Nov 14, 2017
@mgtitimoli
Copy link

IMO the library should stay as it is, or expand but leaving i18n outside of the movie as that can be handled by Intl.DateTimeFormat.

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

3 participants