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

FormattedRelative translate in english only. Using v1.2.0 and Browserify 9.0.8 #110

Closed
dbyzero opened this issue May 5, 2015 · 1 comment

Comments

@dbyzero
Copy link

dbyzero commented May 5, 2015

I made following test :

<FormattedMessage message={this.getIntlMessage('store.list')} />
<FormattedRelative value={new Date().getTime() - 1000000}/>
<FormattedNumber value={4000000} />
<FormattedDate
    value={new Date()}
    day="numeric"
    month="long"
    year="numeric" />

In english all is good but in other languages I have the following output (spainish example):

lista tienda
17 minutes ago
4.000.000
5 de mayo de 2015

I search in your code and see that ./lib/locales.js is not include in browserify.

If I add the following line in my application it works :

ReactIntl.__addLocaleData({"locale":"es","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"},"fields":{"year":{"displayName":"Año","relative":{"0":"este año","1":"el próximo año","-1":"el año pasado"},"relativeTime":{"future":{"one":"dentro de {0} año","other":"dentro de {0} años"},"past":{"one":"hace {0} año","other":"hace {0} años"}}},"month":{"displayName":"Mes","relative":{"0":"este mes","1":"el próximo mes","-1":"el mes pasado"},"relativeTime":{"future":{"one":"dentro de {0} mes","other":"dentro de {0} meses"},"past":{"one":"hace {0} mes","other":"hace {0} meses"}}},"day":{"displayName":"Día","relative":{"0":"hoy","1":"mañana","2":"pasado mañana","-1":"ayer","-2":"antes de ayer"},"relativeTime":{"future":{"one":"dentro de {0} día","other":"dentro de {0} días"},"past":{"one":"hace {0} día","other":"hace {0} días"}}},"hour":{"displayName":"Hora","relativeTime":{"future":{"one":"dentro de {0} hora","other":"dentro de {0} horas"},"past":{"one":"hace {0} hora","other":"hace {0} horas"}}},"minute":{"displayName":"Minuto","relativeTime":{"future":{"one":"dentro de {0} minuto","other":"dentro de {0} minutos"},"past":{"one":"hace {0} minuto","other":"hace {0} minutos"}}},"second":{"displayName":"Segundo","relative":{"0":"ahora"},"relativeTime":{"future":{"one":"dentro de {0} segundo","other":"dentro de {0} segundos"},"past":{"one":"hace {0} segundo","other":"hace {0} segundos"}}}}});

I suppose my environnement is Intl compatible so you dont have to add formats poyifill but I think there is an issue with relative date..

Can you check please ?
Thanks

@faassen
Copy link

faassen commented May 6, 2015

I think issue #103 is relevant.

@ericf ericf closed this as completed May 11, 2015
longlho pushed a commit that referenced this issue Apr 27, 2020
`./dist` is an es module so we need tu require `.default`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants