npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fz-i18n

v1.2.0-beta.15

Published

i18n handling

Downloads

1,512

Readme

fz-i18n

Components

  1. I18NProvider
  2. ConnectI18NProvider
  3. I18N
  4. FormatText
  5. PluralFormat
  6. DateTimeDiffFormat
  7. UserTimeDiffFormat

How to use

   <I18NProvider i18n={{key:"value"}} timeZone="Asia/kolkatta">
      <YourApp>
      </YourApp>
   </I18NProvider>
   <ConnectI18NProvider i18n={(state)=>{return state.i18nObj }} timeZone={(state)=>state.user.timeZone}
   onChange=((accept,reject)=>{call accept or reject})>
      <YourApp>
      </YourApp>
   </ConnectI18NProvider>
   <FormatText i18NKey="" values={[] | ""}/>
   <PluralFormat one="i18n key for singluar" many="i18n key for plural" zero="i18n key for zero" value={1}/>
   <DateTimeDiffFormat from="2016-10-25T05:55:28.000Z" fromTimeZone="Asia/Kolkata" to="2016-10-18T05:55:29.000Z" toTimeZone="Asia/Kolkata"
        today={{key:"today",params:["hh","mm","ss"]}}
        yesterday={{key:"yesterday",params:["hh","mm","ss"]}}
        tomorrow={{key:"tomorrow",params:["hh","mm","ss"]}}
        others={({years, days, hours, minutes})=>{
          if( days > 7){
            return "DD-MM-YYYY"
          }else{
            return getDateKeyWithParam(years, days, hours, minutes)
          }
        }}
        ago="ago"
        later="later"
        />
  <UserTimeDiffFormat to="2016-12-19T05:55:29.000Z" today={{key:"today",params:["hh","mm","ss"]}}
    yesterday={{key:"yesterday",params:["hh","mm","ss"]}}
    tomorrow={{key:"tomorrow",params:["hh","mm","ss"]}}
    others={({years, days, hours, minutes})=>{
      if( days > 7){
         return "DD-MM-YYYY"
      }else{
         return getDateKeyWithParam(years, days, hours, minutes)
      }
        }}
        ago="ago"
        later="later"
        />

Some scenario

More general component

var Greetings = ()=>{
   return <span>Hello,{this.props.name}</span>
}
<Greetings name="vimal"/>

Hello - hard coded data
name - dynamic data mostly no need to I18N. In case any dynamic data going to pass generic component. use i18nUtils.getI18NValue function

I18N Implementation
var Greetings = ()=>{
   return <span><FormatText key="helloI18nKey"/>,{this.props.name}</span>
}
<Greetings name="vimal"/>
<Greetings name={i18nUtils.getI18NValue("world")}/>
textarea placeholder display i18n value
var Textarea=()=>{
return <textarea placeHolder={this.props.placeHolder} value={this.props.value}></textarea>
}

You can mention particular props going to accept i18n key. so convert using I18N HOC
Textarea = HOCI18N(["placeHolder"])(Textarea)
<Textarea placeHolder="i18n.please.enter.desc.key"/>

You can use utils function
<Textarea placeHolder={i18nUtils.getI18NValue("i18n.please.enter.desc.key")}/>

i18n json build time composes not yet done

#1.2.0-beta.9

  • es6 move and prettier format

#1.2.0-beta.11

title support missing use Cases today yesterday tomorrow error fix pattern format changed

#1.2.0-beta.12 user date format pattern issue fix

#1.2.0-beta.13 suffix issue fix - pattern "00000" to "0000"

#1.2.0-beta.14 proptypes move to prop-types package "getValues" duplicate method build issue

#1.2.0-beta.15 Support For Date/Month Translations